@authorizerdev/authorizer-js 2.0.2 → 3.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,16 @@
1
- var authorizerdev=(()=>{var ye=Object.create;var k=Object.defineProperty,_e=Object.defineProperties,me=Object.getOwnPropertyDescriptor,ge=Object.getOwnPropertyDescriptors,we=Object.getOwnPropertyNames,G=Object.getOwnPropertySymbols,be=Object.getPrototypeOf,W=Object.prototype.hasOwnProperty,Re=Object.prototype.propertyIsEnumerable;var P=(n,e,o)=>e in n?k(n,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[e]=o,I=(n,e)=>{for(var o in e||(e={}))W.call(e,o)&&P(n,o,e[o]);if(G)for(var o of G(e))Re.call(e,o)&&P(n,o,e[o]);return n},Z=(n,e)=>_e(n,ge(e)),a=(n,e)=>k(n,"name",{value:e,configurable:!0});var ve=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Ee=(n,e)=>{for(var o in e)k(n,o,{get:e[o],enumerable:!0})},X=(n,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of we(e))!W.call(n,r)&&r!==o&&k(n,r,{get:()=>e[r],enumerable:!(s=me(e,r))||s.enumerable});return n};var Te=(n,e,o)=>(o=n!=null?ye(be(n)):{},X(e||!n||!n.__esModule?k(o,"default",{value:n,enumerable:!0}):o,n)),Ue=n=>X(k({},"__esModule",{value:!0}),n);var u=(n,e,o)=>(P(n,typeof e!="symbol"?e+"":e,o),o);var l=(n,e,o)=>new Promise((s,r)=>{var c=m=>{try{w(o.next(m))}catch(_){r(_)}},g=m=>{try{w(o.throw(m))}catch(_){r(_)}},w=m=>m.done?s(m.value):Promise.resolve(m.value).then(c,g);w((o=o.apply(n,e)).next())});var ee=ve((R,Y)=>{var K=typeof self!="undefined"?self:R,$=function(){function n(){this.fetch=!1,this.DOMException=K.DOMException}return a(n,"F"),n.prototype=K,new n}();(function(n){var e=function(o){var s={searchParams:"URLSearchParams"in n,iterable:"Symbol"in n&&"iterator"in Symbol,blob:"FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in n,arrayBuffer:"ArrayBuffer"in n};function r(t){return t&&DataView.prototype.isPrototypeOf(t)}if(a(r,"isDataView"),s.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],g=ArrayBuffer.isView||function(t){return t&&c.indexOf(Object.prototype.toString.call(t))>-1};function w(t){if(typeof t!="string"&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}a(w,"normalizeName");function m(t){return typeof t!="string"&&(t=String(t)),t}a(m,"normalizeValue");function _(t){var i={next:function(){var h=t.shift();return{done:h===void 0,value:h}}};return s.iterable&&(i[Symbol.iterator]=function(){return i}),i}a(_,"iteratorFor");function p(t){this.map={},t instanceof p?t.forEach(function(i,h){this.append(h,i)},this):Array.isArray(t)?t.forEach(function(i){this.append(i[0],i[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(i){this.append(i,t[i])},this)}a(p,"Headers"),p.prototype.append=function(t,i){t=w(t),i=m(i);var h=this.map[t];this.map[t]=h?h+", "+i:i},p.prototype.delete=function(t){delete this.map[w(t)]},p.prototype.get=function(t){return t=w(t),this.has(t)?this.map[t]:null},p.prototype.has=function(t){return this.map.hasOwnProperty(w(t))},p.prototype.set=function(t,i){this.map[w(t)]=m(i)},p.prototype.forEach=function(t,i){for(var h in this.map)this.map.hasOwnProperty(h)&&t.call(i,this.map[h],h,this)},p.prototype.keys=function(){var t=[];return this.forEach(function(i,h){t.push(h)}),_(t)},p.prototype.values=function(){var t=[];return this.forEach(function(i){t.push(i)}),_(t)},p.prototype.entries=function(){var t=[];return this.forEach(function(i,h){t.push([h,i])}),_(t)},s.iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);function D(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}a(D,"consumed");function Q(t){return new Promise(function(i,h){t.onload=function(){i(t.result)},t.onerror=function(){h(t.error)}})}a(Q,"fileReaderReady");function ae(t){var i=new FileReader,h=Q(i);return i.readAsArrayBuffer(t),h}a(ae,"readBlobAsArrayBuffer");function ce(t){var i=new FileReader,h=Q(i);return i.readAsText(t),h}a(ce,"readBlobAsText");function he(t){for(var i=new Uint8Array(t),h=new Array(i.length),y=0;y<i.length;y++)h[y]=String.fromCharCode(i[y]);return h.join("")}a(he,"readArrayBufferAsText");function V(t){if(t.slice)return t.slice(0);var i=new Uint8Array(t.byteLength);return i.set(new Uint8Array(t)),i.buffer}a(V,"bufferClone");function J(){return this.bodyUsed=!1,this._initBody=function(t){this._bodyInit=t,t?typeof t=="string"?this._bodyText=t:s.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:s.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:s.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s.arrayBuffer&&s.blob&&r(t)?(this._bodyArrayBuffer=V(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||g(t))?this._bodyArrayBuffer=V(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||(typeof t=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):s.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},s.blob&&(this.blob=function(){var t=D(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?D(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(ae)}),this.text=function(){var t=D(this);if(t)return t;if(this._bodyBlob)return ce(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(he(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s.formData&&(this.formData=function(){return this.text().then(le)}),this.json=function(){return this.text().then(JSON.parse)},this}a(J,"Body");var ue=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function de(t){var i=t.toUpperCase();return ue.indexOf(i)>-1?i:t}a(de,"normalizeMethod");function E(t,i){i=i||{};var h=i.body;if(t instanceof E){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,i.headers||(this.headers=new p(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,!h&&t._bodyInit!=null&&(h=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=i.credentials||this.credentials||"same-origin",(i.headers||!this.headers)&&(this.headers=new p(i.headers)),this.method=de(i.method||this.method||"GET"),this.mode=i.mode||this.mode||null,this.signal=i.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&h)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(h)}a(E,"Request"),E.prototype.clone=function(){return new E(this,{body:this._bodyInit})};function le(t){var i=new FormData;return t.trim().split("&").forEach(function(h){if(h){var y=h.split("="),f=y.shift().replace(/\+/g," "),d=y.join("=").replace(/\+/g," ");i.append(decodeURIComponent(f),decodeURIComponent(d))}}),i}a(le,"decode");function pe(t){var i=new p,h=t.replace(/\r?\n[\t ]+/g," ");return h.split(/\r?\n/).forEach(function(y){var f=y.split(":"),d=f.shift().trim();if(d){var x=f.join(":").trim();i.append(d,x)}}),i}a(pe,"parseHeaders"),J.call(E.prototype);function b(t,i){i||(i={}),this.type="default",this.status=i.status===void 0?200:i.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in i?i.statusText:"OK",this.headers=new p(i.headers),this.url=i.url||"",this._initBody(t)}a(b,"Response"),J.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:0,statusText:""});return t.type="error",t};var fe=[301,302,303,307,308];b.redirect=function(t,i){if(fe.indexOf(i)===-1)throw new RangeError("Invalid status code");return new b(null,{status:i,headers:{location:t}})},o.DOMException=n.DOMException;try{new o.DOMException}catch(t){o.DOMException=function(i,h){this.message=i,this.name=h;var y=Error(i);this.stack=y.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function B(t,i){return new Promise(function(h,y){var f=new E(t,i);if(f.signal&&f.signal.aborted)return y(new o.DOMException("Aborted","AbortError"));var d=new XMLHttpRequest;function x(){d.abort()}a(x,"abortXhr"),d.onload=function(){var O={status:d.status,statusText:d.statusText,headers:pe(d.getAllResponseHeaders()||"")};O.url="responseURL"in d?d.responseURL:O.headers.get("X-Request-URL");var C="response"in d?d.response:d.responseText;h(new b(C,O))},d.onerror=function(){y(new TypeError("Network request failed"))},d.ontimeout=function(){y(new TypeError("Network request failed"))},d.onabort=function(){y(new o.DOMException("Aborted","AbortError"))},d.open(f.method,f.url,!0),f.credentials==="include"?d.withCredentials=!0:f.credentials==="omit"&&(d.withCredentials=!1),"responseType"in d&&s.blob&&(d.responseType="blob"),f.headers.forEach(function(O,C){d.setRequestHeader(C,O)}),f.signal&&(f.signal.addEventListener("abort",x),d.onreadystatechange=function(){d.readyState===4&&f.signal.removeEventListener("abort",x)}),d.send(typeof f._bodyInit=="undefined"?null:f._bodyInit)})}return a(B,"fetch"),B.polyfill=!0,n.fetch||(n.fetch=B,n.Headers=p,n.Request=E,n.Response=b),o.Headers=p,o.Request=E,o.Response=b,o.fetch=B,Object.defineProperty(o,"__esModule",{value:!0}),o}({})})($);$.fetch.ponyfill=!0;delete $.fetch.polyfill;var A=$;R=A.fetch;R.default=A.fetch;R.fetch=A.fetch;R.Headers=A.Headers;R.Request=A.Request;R.Response=A.Response;Y.exports=R});var Oe={};Ee(Oe,{Authorizer:()=>H,OAuthProviders:()=>q,ResponseTypes:()=>L});var ie=Te(ee());var q;(function(n){n.Apple="apple",n.Github="github",n.Google="google",n.Facebook="facebook",n.LinkedIn="linkedin",n.Twitter="twitter",n.Microsoft="microsoft",n.Twitch="twitch"})(q||(q={}));var L;(function(n){n.Code="code",n.Token="token"})(L||(L={}));var T=a(()=>typeof window!="undefined","hasWindow"),j=a(n=>{let e=n.trim();return e[e.length-1]==="/"&&(e=e.slice(0,-1)),e},"trimURL"),re=a(()=>T()?window.crypto||window.msCrypto:null,"getCrypto"),Ae=a(()=>{let n=re();return n&&n.subtle||n.webkitSubtle},"getCryptoSubtle"),U=a(()=>{let n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.",e="",o=re();return o&&Array.from(o.getRandomValues(new Uint8Array(43))).forEach(r=>e+=n[r%n.length]),e},"createRandomString"),v=a(n=>T()?btoa(n):Buffer.from(n).toString("base64"),"encode");var te=a(n=>Object.keys(n).filter(e=>typeof n[e]!="undefined").map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(n[e])}`).join("&"),"createQueryParams"),oe=a(n=>l(void 0,null,function*(){let e=Ae().digest({name:"SHA-256"},new TextEncoder().encode(n));return window.msCrypto?new Promise((o,s)=>{e.oncomplete=r=>{o(r.target.result)},e.onerror=r=>{s(r.error)},e.onabort=()=>{s(new Error("The digest operation was aborted"))}}):yield e}),"sha256"),Le=a(n=>{let e={"+":"-","/":"_","=":""};return n.replace(/[+/=]/g,o=>e[o])},"urlEncodeB64");var se=a(n=>{let e=new Uint8Array(n);return Le(window.btoa(String.fromCharCode(...Array.from(e))))},"bufferToBase64UrlEncoded"),ne=a((n,e,o=60)=>new Promise((s,r)=>{let c=window.document.createElement("iframe");c.setAttribute("id","authorizer-iframe"),c.setAttribute("width","0"),c.setAttribute("height","0"),c.style.display="none";let g=a(()=>{window.document.body.contains(c)&&(window.document.body.removeChild(c),window.removeEventListener("message",m,!1))},"removeIframe"),w=setTimeout(()=>{g()},o*1e3),m=a(function(_){if(_.origin!==e||!_.data||!_.data.response)return;let p=_.source;p&&p.close(),_.data.response.error?r(_.data.response):s(_.data.response),clearTimeout(w),window.removeEventListener("message",m,!1),setTimeout(g,2*1e3)},"iframeEventHandler");window.addEventListener("message",m,!1),window.document.body.appendChild(c),c.setAttribute("src",n)}),"executeIframe");var z="id email email_verified given_name family_name middle_name nickname preferred_username picture signup_methods gender birthdate phone_number phone_number_verified roles created_at updated_at is_multi_factor_auth_enabled app_data",S=`message access_token expires_in refresh_token id_token should_show_email_otp_screen should_show_mobile_otp_screen should_show_totp_screen authenticator_scanner_image authenticator_secret authenticator_recovery_codes user { ${z} }`,M=a(()=>T()?window.fetch:ie.default,"getFetcher"),N=class N{constructor(e){u(this,"config");u(this,"codeVerifier");u(this,"authorize",a(e=>l(this,null,function*(){if(!T())return this.errorResponse([new Error("this feature is only supported in browser")]);let o=["openid","profile","email"];e.use_refresh_token&&o.push("offline_access");let s={redirect_uri:this.config.redirectURL,response_mode:e.response_mode||"web_message",state:v(U()),nonce:v(U()),response_type:e.response_type,scope:o.join(" "),client_id:this.config.clientID};if(e.response_type===L.Code){this.codeVerifier=U();let c=yield oe(this.codeVerifier),g=se(c);s.code_challenge=g}let r=`${this.config.authorizerURL}/authorize?${te(s)}`;if(s.response_mode!=="web_message")return window.location.replace(r),this.okResponse(void 0);try{let c=yield ne(r,this.config.authorizerURL,60);if(e.response_type===L.Code){let g=yield this.getToken({code:c.code});return g.errors.length?this.errorResponse(g.errors):this.okResponse(g.data)}return this.okResponse(c)}catch(c){return c.error&&window.location.replace(`${this.config.authorizerURL}/app?state=${v(JSON.stringify(this.config))}&redirect_uri=${this.config.redirectURL}`),this.errorResponse(c)}}),"authorize"));u(this,"browserLogin",a(()=>l(this,null,function*(){try{let e=yield this.getSession();return e.errors.length?this.errorResponse(e.errors):this.okResponse(e.data)}catch(e){return T()?(window.location.replace(`${this.config.authorizerURL}/app?state=${v(JSON.stringify(this.config))}&redirect_uri=${this.config.redirectURL}`),this.errorResponse(e)):{data:void 0,errors:[new Error("browserLogin is only supported for browsers")]}}}),"browserLogin"));u(this,"forgotPassword",a(e=>l(this,null,function*(){var o;e.state||(e.state=v(U())),e.redirect_uri||(e.redirect_uri=this.config.redirectURL);try{let s=yield this.graphqlQuery({query:"mutation forgotPassword($data: ForgotPasswordInput!) { forgot_password(params: $data) { message should_show_mobile_otp_screen } }",variables:{data:e}});return(o=s==null?void 0:s.errors)!=null&&o.length?this.errorResponse(s.errors):this.okResponse(s==null?void 0:s.data.forgot_password)}catch(s){return this.errorResponse([s])}}),"forgotPassword"));u(this,"getMetaData",a(()=>l(this,null,function*(){var e;try{let o=yield this.graphqlQuery({query:"query { meta { version client_id is_google_login_enabled is_facebook_login_enabled is_github_login_enabled is_linkedin_login_enabled is_apple_login_enabled is_twitter_login_enabled is_microsoft_login_enabled is_twitch_login_enabled is_email_verification_enabled is_basic_authentication_enabled is_magic_link_login_enabled is_sign_up_enabled is_strong_password_enabled is_multi_factor_auth_enabled is_mobile_basic_authentication_enabled is_phone_verification_enabled } }"});return(e=o==null?void 0:o.errors)!=null&&e.length?this.errorResponse(o.errors):this.okResponse(o.data.meta)}catch(o){return this.errorResponse([o])}}),"getMetaData"));u(this,"getProfile",a(e=>l(this,null,function*(){var o;try{let s=yield this.graphqlQuery({query:`query { profile { ${z} } }`,headers:e});return(o=s==null?void 0:s.errors)!=null&&o.length?this.errorResponse(s.errors):this.okResponse(s.data.profile)}catch(s){return this.errorResponse([s])}}),"getProfile"));u(this,"getSession",a((e,o)=>l(this,null,function*(){var s,r;try{let c=yield this.graphqlQuery({query:`query getSession($params: SessionQueryInput){session(params: $params) { ${S} } }`,headers:e,variables:{params:o}});return(s=c==null?void 0:c.errors)!=null&&s.length?this.errorResponse(c.errors):this.okResponse((r=c.data)==null?void 0:r.session)}catch(c){return this.errorResponse(c)}}),"getSession"));u(this,"getToken",a(e=>l(this,null,function*(){if(e.grant_type||(e.grant_type="authorization_code"),e.grant_type==="refresh_token"&&!e.refresh_token)return this.errorResponse([new Error("Invalid refresh_token")]);if(e.grant_type==="authorization_code"&&!this.codeVerifier)return this.errorResponse([new Error("Invalid code verifier")]);let o={client_id:this.config.clientID,code:e.code||"",code_verifier:this.codeVerifier||"",grant_type:e.grant_type||"",refresh_token:e.refresh_token||""};try{let r=yield M()(`${this.config.authorizerURL}/oauth/token`,{method:"POST",body:JSON.stringify(o),headers:I({},this.config.extraHeaders),credentials:"include"}),c=yield r.json();return r.status>=400?this.errorResponse([new Error(c.error_description||c.error)]):this.okResponse(c)}catch(s){return this.errorResponse(s)}}),"getToken"));u(this,"login",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:`
2
- mutation login($data: LoginInput!) { login(params: $data) { ${S}}}
1
+ var authorizerdev=(()=>{var ye=Object.create;var k=Object.defineProperty,_e=Object.defineProperties,me=Object.getOwnPropertyDescriptor,ge=Object.getOwnPropertyDescriptors,we=Object.getOwnPropertyNames,G=Object.getOwnPropertySymbols,be=Object.getPrototypeOf,W=Object.prototype.hasOwnProperty,Re=Object.prototype.propertyIsEnumerable;var P=(n,e,o)=>e in n?k(n,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[e]=o,q=(n,e)=>{for(var o in e||(e={}))W.call(e,o)&&P(n,o,e[o]);if(G)for(var o of G(e))Re.call(e,o)&&P(n,o,e[o]);return n},Z=(n,e)=>_e(n,ge(e)),a=(n,e)=>k(n,"name",{value:e,configurable:!0});var ve=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Ee=(n,e)=>{for(var o in e)k(n,o,{get:e[o],enumerable:!0})},X=(n,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of we(e))!W.call(n,r)&&r!==o&&k(n,r,{get:()=>e[r],enumerable:!(s=me(e,r))||s.enumerable});return n};var Te=(n,e,o)=>(o=n!=null?ye(be(n)):{},X(e||!n||!n.__esModule?k(o,"default",{value:n,enumerable:!0}):o,n)),Ue=n=>X(k({},"__esModule",{value:!0}),n);var u=(n,e,o)=>(P(n,typeof e!="symbol"?e+"":e,o),o);var l=(n,e,o)=>new Promise((s,r)=>{var c=w=>{try{p(o.next(w))}catch(m){r(m)}},g=w=>{try{p(o.throw(w))}catch(m){r(m)}},p=w=>w.done?s(w.value):Promise.resolve(w.value).then(c,g);p((o=o.apply(n,e)).next())});var ee=ve((R,Y)=>{var K=typeof self!="undefined"?self:R,I=function(){function n(){this.fetch=!1,this.DOMException=K.DOMException}return a(n,"F"),n.prototype=K,new n}();(function(n){var e=function(o){var s={searchParams:"URLSearchParams"in n,iterable:"Symbol"in n&&"iterator"in Symbol,blob:"FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in n,arrayBuffer:"ArrayBuffer"in n};function r(t){return t&&DataView.prototype.isPrototypeOf(t)}if(a(r,"isDataView"),s.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],g=ArrayBuffer.isView||function(t){return t&&c.indexOf(Object.prototype.toString.call(t))>-1};function p(t){if(typeof t!="string"&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}a(p,"normalizeName");function w(t){return typeof t!="string"&&(t=String(t)),t}a(w,"normalizeValue");function m(t){var i={next:function(){var h=t.shift();return{done:h===void 0,value:h}}};return s.iterable&&(i[Symbol.iterator]=function(){return i}),i}a(m,"iteratorFor");function f(t){this.map={},t instanceof f?t.forEach(function(i,h){this.append(h,i)},this):Array.isArray(t)?t.forEach(function(i){this.append(i[0],i[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(i){this.append(i,t[i])},this)}a(f,"Headers"),f.prototype.append=function(t,i){t=p(t),i=w(i);var h=this.map[t];this.map[t]=h?h+", "+i:i},f.prototype.delete=function(t){delete this.map[p(t)]},f.prototype.get=function(t){return t=p(t),this.has(t)?this.map[t]:null},f.prototype.has=function(t){return this.map.hasOwnProperty(p(t))},f.prototype.set=function(t,i){this.map[p(t)]=w(i)},f.prototype.forEach=function(t,i){for(var h in this.map)this.map.hasOwnProperty(h)&&t.call(i,this.map[h],h,this)},f.prototype.keys=function(){var t=[];return this.forEach(function(i,h){t.push(h)}),m(t)},f.prototype.values=function(){var t=[];return this.forEach(function(i){t.push(i)}),m(t)},f.prototype.entries=function(){var t=[];return this.forEach(function(i,h){t.push([h,i])}),m(t)},s.iterable&&(f.prototype[Symbol.iterator]=f.prototype.entries);function D(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}a(D,"consumed");function Q(t){return new Promise(function(i,h){t.onload=function(){i(t.result)},t.onerror=function(){h(t.error)}})}a(Q,"fileReaderReady");function ae(t){var i=new FileReader,h=Q(i);return i.readAsArrayBuffer(t),h}a(ae,"readBlobAsArrayBuffer");function ce(t){var i=new FileReader,h=Q(i);return i.readAsText(t),h}a(ce,"readBlobAsText");function he(t){for(var i=new Uint8Array(t),h=new Array(i.length),_=0;_<i.length;_++)h[_]=String.fromCharCode(i[_]);return h.join("")}a(he,"readArrayBufferAsText");function V(t){if(t.slice)return t.slice(0);var i=new Uint8Array(t.byteLength);return i.set(new Uint8Array(t)),i.buffer}a(V,"bufferClone");function J(){return this.bodyUsed=!1,this._initBody=function(t){this._bodyInit=t,t?typeof t=="string"?this._bodyText=t:s.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:s.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:s.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s.arrayBuffer&&s.blob&&r(t)?(this._bodyArrayBuffer=V(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||g(t))?this._bodyArrayBuffer=V(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||(typeof t=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):s.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},s.blob&&(this.blob=function(){var t=D(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?D(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(ae)}),this.text=function(){var t=D(this);if(t)return t;if(this._bodyBlob)return ce(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(he(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s.formData&&(this.formData=function(){return this.text().then(le)}),this.json=function(){return this.text().then(JSON.parse)},this}a(J,"Body");var ue=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function de(t){var i=t.toUpperCase();return ue.indexOf(i)>-1?i:t}a(de,"normalizeMethod");function E(t,i){i=i||{};var h=i.body;if(t instanceof E){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,i.headers||(this.headers=new f(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,!h&&t._bodyInit!=null&&(h=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=i.credentials||this.credentials||"same-origin",(i.headers||!this.headers)&&(this.headers=new f(i.headers)),this.method=de(i.method||this.method||"GET"),this.mode=i.mode||this.mode||null,this.signal=i.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&h)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(h)}a(E,"Request"),E.prototype.clone=function(){return new E(this,{body:this._bodyInit})};function le(t){var i=new FormData;return t.trim().split("&").forEach(function(h){if(h){var _=h.split("="),y=_.shift().replace(/\+/g," "),d=_.join("=").replace(/\+/g," ");i.append(decodeURIComponent(y),decodeURIComponent(d))}}),i}a(le,"decode");function fe(t){var i=new f,h=t.replace(/\r?\n[\t ]+/g," ");return h.split(/\r?\n/).forEach(function(_){var y=_.split(":"),d=y.shift().trim();if(d){var $=y.join(":").trim();i.append(d,$)}}),i}a(fe,"parseHeaders"),J.call(E.prototype);function b(t,i){i||(i={}),this.type="default",this.status=i.status===void 0?200:i.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in i?i.statusText:"OK",this.headers=new f(i.headers),this.url=i.url||"",this._initBody(t)}a(b,"Response"),J.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:0,statusText:""});return t.type="error",t};var pe=[301,302,303,307,308];b.redirect=function(t,i){if(pe.indexOf(i)===-1)throw new RangeError("Invalid status code");return new b(null,{status:i,headers:{location:t}})},o.DOMException=n.DOMException;try{new o.DOMException}catch(t){o.DOMException=function(i,h){this.message=i,this.name=h;var _=Error(i);this.stack=_.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function B(t,i){return new Promise(function(h,_){var y=new E(t,i);if(y.signal&&y.signal.aborted)return _(new o.DOMException("Aborted","AbortError"));var d=new XMLHttpRequest;function $(){d.abort()}a($,"abortXhr"),d.onload=function(){var L={status:d.status,statusText:d.statusText,headers:fe(d.getAllResponseHeaders()||"")};L.url="responseURL"in d?d.responseURL:L.headers.get("X-Request-URL");var C="response"in d?d.response:d.responseText;h(new b(C,L))},d.onerror=function(){_(new TypeError("Network request failed"))},d.ontimeout=function(){_(new TypeError("Network request failed"))},d.onabort=function(){_(new o.DOMException("Aborted","AbortError"))},d.open(y.method,y.url,!0),y.credentials==="include"?d.withCredentials=!0:y.credentials==="omit"&&(d.withCredentials=!1),"responseType"in d&&s.blob&&(d.responseType="blob"),y.headers.forEach(function(L,C){d.setRequestHeader(C,L)}),y.signal&&(y.signal.addEventListener("abort",$),d.onreadystatechange=function(){d.readyState===4&&y.signal.removeEventListener("abort",$)}),d.send(typeof y._bodyInit=="undefined"?null:y._bodyInit)})}return a(B,"fetch"),B.polyfill=!0,n.fetch||(n.fetch=B,n.Headers=f,n.Request=E,n.Response=b),o.Headers=f,o.Request=E,o.Response=b,o.fetch=B,Object.defineProperty(o,"__esModule",{value:!0}),o}({})})(I);I.fetch.ponyfill=!0;delete I.fetch.polyfill;var x=I;R=x.fetch;R.default=x.fetch;R.fetch=x.fetch;R.Headers=x.Headers;R.Request=x.Request;R.Response=x.Response;Y.exports=R});var Le={};Ee(Le,{Authorizer:()=>H,OAuthProviders:()=>O,ResponseTypes:()=>A});var ie=Te(ee());var O;(function(n){n.Apple="apple",n.Github="github",n.Google="google",n.Facebook="facebook",n.LinkedIn="linkedin",n.Twitter="twitter",n.Microsoft="microsoft",n.Twitch="twitch",n.Roblox="roblox",n.Discord="discord"})(O||(O={}));var A;(function(n){n.Code="code",n.Token="token"})(A||(A={}));var T=a(()=>typeof window!="undefined","hasWindow"),j=a(n=>{let e=n.trim();return e[e.length-1]==="/"&&(e=e.slice(0,-1)),e},"trimURL"),re=a(()=>T()?window.crypto||window.msCrypto:null,"getCrypto"),xe=a(()=>{let n=re();return n&&n.subtle||n.webkitSubtle},"getCryptoSubtle"),U=a(()=>{let n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.",e="",o=re();return o&&Array.from(o.getRandomValues(new Uint8Array(43))).forEach(r=>e+=n[r%n.length]),e},"createRandomString"),v=a(n=>T()?btoa(n):Buffer.from(n).toString("base64"),"encode");var te=a(n=>Object.keys(n).filter(e=>typeof n[e]!="undefined").map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(n[e])}`).join("&"),"createQueryParams"),oe=a(n=>l(void 0,null,function*(){let e=xe().digest({name:"SHA-256"},new TextEncoder().encode(n));return window.msCrypto?new Promise((o,s)=>{e.oncomplete=r=>{o(r.target.result)},e.onerror=r=>{s(r.error)},e.onabort=()=>{s(new Error("The digest operation was aborted"))}}):yield e}),"sha256"),Ae=a(n=>{let e={"+":"-","/":"_","=":""};return n.replace(/[+/=]/g,o=>e[o])},"urlEncodeB64");var se=a(n=>{let e=new Uint8Array(n);return Ae(window.btoa(String.fromCharCode(...Array.from(e))))},"bufferToBase64UrlEncoded"),ne=a((n,e,o=60)=>new Promise((s,r)=>{let c=window.document.createElement("iframe");c.setAttribute("id","authorizer-iframe"),c.setAttribute("width","0"),c.setAttribute("height","0"),c.style.display="none";let g=a(()=>{window.document.body.contains(c)&&(window.document.body.removeChild(c),window.removeEventListener("message",w,!1))},"removeIframe"),p=setTimeout(()=>{g()},o*1e3),w=a(function(m){if(m.origin!==e||!m.data||!m.data.response)return;let f=m.source;f&&f.close(),m.data.response.error?r(m.data.response):s(m.data.response),clearTimeout(p),window.removeEventListener("message",w,!1),setTimeout(g,2*1e3)},"iframeEventHandler");window.addEventListener("message",w,!1),window.document.body.appendChild(c),c.setAttribute("src",n)}),"executeIframe");var z="id email email_verified given_name family_name middle_name nickname preferred_username picture signup_methods gender birthdate phone_number phone_number_verified roles created_at updated_at revoked_timestamp is_multi_factor_auth_enabled app_data",S=`message access_token expires_in refresh_token id_token should_show_email_otp_screen should_show_mobile_otp_screen should_show_totp_screen authenticator_scanner_image authenticator_secret authenticator_recovery_codes user { ${z} }`,M=a(()=>T()?window.fetch:ie.default,"getFetcher"),N=class N{constructor(e){u(this,"config");u(this,"codeVerifier");u(this,"authorize",a(e=>l(this,null,function*(){var c;if(!T())return this.errorResponse([new Error("this feature is only supported in browser")]);let o=["openid","profile","email"];e.use_refresh_token&&o.push("offline_access");let s={redirect_uri:this.config.redirectURL,response_mode:e.response_mode||"web_message",state:v(U()),nonce:v(U()),response_type:e.response_type,scope:o.join(" "),client_id:((c=this.config)==null?void 0:c.clientID)||""};if(e.response_type===A.Code){this.codeVerifier=U();let g=yield oe(this.codeVerifier),p=se(g);s.code_challenge=p}let r=`${this.config.authorizerURL}/authorize?${te(s)}`;if(s.response_mode!=="web_message")return window.location.replace(r),this.okResponse(void 0);try{let g=yield ne(r,this.config.authorizerURL,60);if(e.response_type===A.Code){let p=yield this.getToken({code:g.code});return p.errors.length?this.errorResponse(p.errors):this.okResponse(p.data)}return this.okResponse(g)}catch(g){return g.error&&window.location.replace(`${this.config.authorizerURL}/app?state=${v(JSON.stringify(this.config))}&redirect_uri=${this.config.redirectURL}`),this.errorResponse(g)}}),"authorize"));u(this,"browserLogin",a(()=>l(this,null,function*(){try{let e=yield this.getSession();return e.errors.length?this.errorResponse(e.errors):this.okResponse(e.data)}catch(e){return T()?(window.location.replace(`${this.config.authorizerURL}/app?state=${v(JSON.stringify(this.config))}&redirect_uri=${this.config.redirectURL}`),this.errorResponse(e)):{data:void 0,errors:[new Error("browserLogin is only supported for browsers")]}}}),"browserLogin"));u(this,"forgotPassword",a(e=>l(this,null,function*(){var o;e.state||(e.state=v(U())),e.redirect_uri||(e.redirect_uri=this.config.redirectURL);try{let s=yield this.graphqlQuery({query:"mutation forgotPassword($data: ForgotPasswordRequest!) { forgot_password(params: $data) { message should_show_mobile_otp_screen } }",variables:{data:e}});return(o=s==null?void 0:s.errors)!=null&&o.length?this.errorResponse(s.errors):this.okResponse(s==null?void 0:s.data.forgot_password)}catch(s){return this.errorResponse([s])}}),"forgotPassword"));u(this,"getMetaData",a(()=>l(this,null,function*(){var e;try{let o=yield this.graphqlQuery({query:"query { meta { version client_id is_google_login_enabled is_facebook_login_enabled is_github_login_enabled is_linkedin_login_enabled is_apple_login_enabled is_twitter_login_enabled is_microsoft_login_enabled is_twitch_login_enabled is_roblox_login_enabled is_email_verification_enabled is_basic_authentication_enabled is_magic_link_login_enabled is_sign_up_enabled is_strong_password_enabled is_multi_factor_auth_enabled is_mobile_basic_authentication_enabled is_phone_verification_enabled } }"});return(e=o==null?void 0:o.errors)!=null&&e.length?this.errorResponse(o.errors):this.okResponse(o.data.meta)}catch(o){return this.errorResponse([o])}}),"getMetaData"));u(this,"getProfile",a(e=>l(this,null,function*(){var o;try{let s=yield this.graphqlQuery({query:`query { profile { ${z} } }`,headers:e});return(o=s==null?void 0:s.errors)!=null&&o.length?this.errorResponse(s.errors):this.okResponse(s.data.profile)}catch(s){return this.errorResponse([s])}}),"getProfile"));u(this,"getSession",a((e,o)=>l(this,null,function*(){var s,r;try{let c=yield this.graphqlQuery({query:`query getSession($params: SessionQueryRequest){session(params: $params) { ${S} } }`,headers:e,variables:{params:o}});return(s=c==null?void 0:c.errors)!=null&&s.length?this.errorResponse(c.errors):this.okResponse((r=c.data)==null?void 0:r.session)}catch(c){return this.errorResponse(c)}}),"getSession"));u(this,"getToken",a(e=>l(this,null,function*(){if(e.grant_type||(e.grant_type="authorization_code"),e.grant_type==="refresh_token"&&!e.refresh_token)return this.errorResponse([new Error("Invalid refresh_token")]);if(e.grant_type==="authorization_code"&&!this.codeVerifier)return this.errorResponse([new Error("Invalid code verifier")]);let o={client_id:this.config.clientID,code:e.code||"",code_verifier:this.codeVerifier||"",grant_type:e.grant_type||"",refresh_token:e.refresh_token||""};try{let r=yield M()(`${this.config.authorizerURL}/oauth/token`,{method:"POST",body:JSON.stringify(o),headers:q({},this.config.extraHeaders),credentials:"include"}),c=yield r.json();return r.status>=400?this.errorResponse([new Error(c.error_description||c.error)]):this.okResponse(c)}catch(s){return this.errorResponse(s)}}),"getToken"));u(this,"login",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:`
2
+ mutation login($data: LoginRequest!) { login(params: $data) { ${S}}}
3
3
  `,variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.login)}catch(r){return this.errorResponse([new Error(r)])}}),"login"));u(this,"logout",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:" mutation { logout { message } } ",headers:e});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.response)}catch(r){return this.errorResponse([r])}}),"logout"));u(this,"magicLinkLogin",a(e=>l(this,null,function*(){var o,s;try{e.state||(e.state=v(U())),e.redirect_uri||(e.redirect_uri=this.config.redirectURL);let r=yield this.graphqlQuery({query:`
4
- mutation magicLinkLogin($data: MagicLinkLoginInput!) { magic_link_login(params: $data) { message }}
5
- `,variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.magic_link_login)}catch(r){return this.errorResponse([r])}}),"magicLinkLogin"));u(this,"oauthLogin",a((e,o,s,r)=>l(this,null,function*(){let c=r;if(c||(c=v(U())),!Object.values(q).includes(e))throw new Error(`only following oauth providers are supported: ${Object.values(e).toString()}`);if(!T())throw new Error("oauthLogin is only supported for browsers");o&&o.length&&(c+=`&roles=${o.join(",")}`),window.location.replace(`${this.config.authorizerURL}/oauth_login/${e}?redirect_uri=${s||this.config.redirectURL}&state=${c}`)}),"oauthLogin"));u(this,"resendOtp",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:`
4
+ mutation magicLinkLogin($data: MagicLinkLoginRequest!) { magic_link_login(params: $data) { message }}
5
+ `,variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.magic_link_login)}catch(r){return this.errorResponse([r])}}),"magicLinkLogin"));u(this,"oauthLogin",a((e,o,s,r)=>l(this,null,function*(){let c=r;if(c||(c=v(U())),!Object.values(O).includes(e))throw new Error(`only following oauth providers are supported: ${Object.values(e).toString()}`);if(!T())throw new Error("oauthLogin is only supported for browsers");o&&o.length&&(c+=`&roles=${o.join(",")}`),window.location.replace(`${this.config.authorizerURL}/oauth_login/${e}?redirect_uri=${s||this.config.redirectURL}&state=${c}`)}),"oauthLogin"));u(this,"resendOtp",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:`
6
6
  mutation resendOtp($data: ResendOTPRequest!) { resend_otp(params: $data) { message }}
7
- `,variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.resend_otp)}catch(r){return this.errorResponse([r])}}),"resendOtp"));u(this,"resetPassword",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:"mutation resetPassword($data: ResetPasswordInput!) { reset_password(params: $data) { message } }",variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.reset_password)}catch(r){return this.errorResponse([r])}}),"resetPassword"));u(this,"revokeToken",a(e=>l(this,null,function*(){if(!e.refresh_token&&!e.refresh_token.trim())return this.errorResponse([new Error("Invalid refresh_token")]);let r=yield(yield M()(`${this.config.authorizerURL}/oauth/revoke`,{method:"POST",headers:I({},this.config.extraHeaders),body:JSON.stringify({refresh_token:e.refresh_token,client_id:this.config.clientID})})).json();return this.okResponse(r)}),"revokeToken"));u(this,"signup",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:`
8
- mutation signup($data: SignUpInput!) { signup(params: $data) { ${S}}}
9
- `,variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.signup)}catch(r){return this.errorResponse([r])}}),"signup"));u(this,"updateProfile",a((e,o)=>l(this,null,function*(){var s,r;try{let c=yield this.graphqlQuery({query:"mutation updateProfile($data: UpdateProfileInput!) { update_profile(params: $data) { message } }",headers:o,variables:{data:e}});return(s=c==null?void 0:c.errors)!=null&&s.length?this.errorResponse(c.errors):this.okResponse((r=c.data)==null?void 0:r.update_profile)}catch(c){return this.errorResponse([c])}}),"updateProfile"));u(this,"deactivateAccount",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:"mutation deactivateAccount { deactivate_account { message } }",headers:e});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.deactivate_account)}catch(r){return this.errorResponse([r])}}),"deactivateAccount"));u(this,"validateJWTToken",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:"query validateJWTToken($params: ValidateJWTTokenInput!){validate_jwt_token(params: $params) { is_valid claims } }",variables:{params:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.validate_jwt_token)}catch(r){return this.errorResponse([r])}}),"validateJWTToken"));u(this,"validateSession",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:`query validateSession($params: ValidateSessionInput){validate_session(params: $params) { is_valid user { ${z} } } }`,variables:{params:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.validate_session)}catch(r){return this.errorResponse([r])}}),"validateSession"));u(this,"verifyEmail",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:`
10
- mutation verifyEmail($data: VerifyEmailInput!) { verify_email(params: $data) { ${S}}}
7
+ `,variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.resend_otp)}catch(r){return this.errorResponse([r])}}),"resendOtp"));u(this,"resetPassword",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:"mutation resetPassword($data: ResetPasswordRequest!) { reset_password(params: $data) { message } }",variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.reset_password)}catch(r){return this.errorResponse([r])}}),"resetPassword"));u(this,"revokeToken",a(e=>l(this,null,function*(){if(!e.refresh_token&&!e.refresh_token.trim())return this.errorResponse([new Error("Invalid refresh_token")]);let r=yield(yield M()(`${this.config.authorizerURL}/oauth/revoke`,{method:"POST",headers:q({},this.config.extraHeaders),body:JSON.stringify({refresh_token:e.refresh_token,client_id:this.config.clientID})})).json();return this.okResponse(r)}),"revokeToken"));u(this,"signup",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:`
8
+ mutation signup($data: SignUpRequest!) { signup(params: $data) { ${S}}}
9
+ `,variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.signup)}catch(r){return this.errorResponse([r])}}),"signup"));u(this,"updateProfile",a((e,o)=>l(this,null,function*(){var s,r;try{let c=yield this.graphqlQuery({query:"mutation updateProfile($data: UpdateProfileRequest!) { update_profile(params: $data) { message } }",headers:o,variables:{data:e}});return(s=c==null?void 0:c.errors)!=null&&s.length?this.errorResponse(c.errors):this.okResponse((r=c.data)==null?void 0:r.update_profile)}catch(c){return this.errorResponse([c])}}),"updateProfile"));u(this,"deactivateAccount",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:"mutation deactivateAccount { deactivate_account { message } }",headers:e});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.deactivate_account)}catch(r){return this.errorResponse([r])}}),"deactivateAccount"));u(this,"validateJWTToken",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:"query validateJWTToken($params: ValidateJWTTokenRequest!){validate_jwt_token(params: $params) { is_valid claims } }",variables:{params:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.validate_jwt_token)}catch(r){return this.errorResponse([r])}}),"validateJWTToken"));u(this,"validateSession",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:`query validateSession($params: ValidateSessionRequest){validate_session(params: $params) { is_valid user { ${z} } } }`,variables:{params:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.validate_session)}catch(r){return this.errorResponse([r])}}),"validateSession"));u(this,"verifyEmail",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:`
10
+ mutation verifyEmail($data: VerifyEmailRequest!) { verify_email(params: $data) { ${S}}}
11
11
  `,variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.verify_email)}catch(r){return this.errorResponse([r])}}),"verifyEmail"));u(this,"resendVerifyEmail",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:`
12
- mutation resendVerifyEmail($data: ResendVerifyEmailInput!) { resend_verify_email(params: $data) { message }}
13
- `,variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.verify_email)}catch(r){return this.errorResponse([r])}}),"resendVerifyEmail"));u(this,"verifyOtp",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:`
12
+ mutation resendVerifyEmail($data: ResendVerifyEmailRequest!) { resend_verify_email(params: $data) { message }}
13
+ `,variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.resend_verify_email)}catch(r){return this.errorResponse([r])}}),"resendVerifyEmail"));u(this,"verifyOtp",a(e=>l(this,null,function*(){var o,s;try{let r=yield this.graphqlQuery({query:`
14
14
  mutation verifyOtp($data: VerifyOTPRequest!) { verify_otp(params: $data) { ${S}}}
15
- `,variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.verify_otp)}catch(r){return this.errorResponse([r])}}),"verifyOtp"));u(this,"graphqlQuery",a(e=>l(this,null,function*(){var c;let r=yield(yield M()(`${this.config.authorizerURL}/graphql`,{method:"POST",body:JSON.stringify({query:e.query,variables:e.variables||{}}),headers:I(I({},this.config.extraHeaders),e.headers||{}),credentials:"include"})).json();return(c=r==null?void 0:r.errors)!=null&&c.length?{data:void 0,errors:r.errors}:{data:r.data,errors:[]}}),"graphqlQuery"));u(this,"errorResponse",a(e=>({data:void 0,errors:e}),"errorResponse"));u(this,"okResponse",a(e=>({data:e,errors:[]}),"okResponse"));if(!e)throw new Error("Configuration is required");if(this.config=e,!e.authorizerURL&&!e.authorizerURL.trim())throw new Error("Invalid authorizerURL");if(e.authorizerURL&&(this.config.authorizerURL=j(e.authorizerURL)),!e.redirectURL&&!e.redirectURL.trim())throw new Error("Invalid redirectURL");this.config.redirectURL=j(e.redirectURL),this.config.extraHeaders=Z(I({},e.extraHeaders||{}),{"x-authorizer-url":this.config.authorizerURL,"x-authorizer-client-id":this.config.clientID||"","Content-Type":"application/json"}),this.config.clientID=e.clientID.trim()}};a(N,"Authorizer");var H=N;return Ue(Oe);})();
16
- window.__TAURI__ = authorizerdev
15
+ `,variables:{data:e}});return(o=r==null?void 0:r.errors)!=null&&o.length?this.errorResponse(r.errors):this.okResponse((s=r.data)==null?void 0:s.verify_otp)}catch(r){return this.errorResponse([r])}}),"verifyOtp"));u(this,"graphqlQuery",a(e=>l(this,null,function*(){var c;let r=yield(yield M()(`${this.config.authorizerURL}/graphql`,{method:"POST",body:JSON.stringify({query:e.query,variables:e.variables||{}}),headers:q(q({},this.config.extraHeaders),e.headers||{}),credentials:"include"})).json();return(c=r==null?void 0:r.errors)!=null&&c.length?{data:void 0,errors:r.errors}:{data:r.data,errors:[]}}),"graphqlQuery"));u(this,"errorResponse",a(e=>({data:void 0,errors:e}),"errorResponse"));u(this,"okResponse",a(e=>({data:e,errors:[]}),"okResponse"));if(!e)throw new Error("Configuration is required");if(this.config=e,!e.authorizerURL&&!e.authorizerURL.trim())throw new Error("Invalid authorizerURL");if(e.authorizerURL&&(this.config.authorizerURL=j(e.authorizerURL)),!e.redirectURL&&!e.redirectURL.trim())throw new Error("Invalid redirectURL");this.config.redirectURL=j(e.redirectURL),this.config.extraHeaders=Z(q({},e.extraHeaders||{}),{"x-authorizer-url":this.config.authorizerURL,"x-authorizer-client-id":this.config.clientID||"","Content-Type":"application/json"}),this.config.clientID=((e==null?void 0:e.clientID)||"").trim()}};a(N,"Authorizer");var H=N;return Ue(Le);})();
16
+ if (typeof window !== "undefined") { window.authorizerdev = authorizerdev; }
package/lib/index.d.mts CHANGED
@@ -9,169 +9,240 @@ interface ApiResponse<T> {
9
9
  interface ConfigType {
10
10
  authorizerURL: string;
11
11
  redirectURL: string;
12
- clientID: string;
12
+ clientID?: string;
13
13
  extraHeaders?: Record<string, string>;
14
14
  }
15
+ interface Pagination {
16
+ limit: number;
17
+ page: number;
18
+ offset: number;
19
+ total: number;
20
+ }
21
+ interface Meta {
22
+ version: string;
23
+ client_id: string;
24
+ is_google_login_enabled: boolean;
25
+ is_facebook_login_enabled: boolean;
26
+ is_github_login_enabled: boolean;
27
+ is_linkedin_login_enabled: boolean;
28
+ is_apple_login_enabled: boolean;
29
+ is_discord_login_enabled: boolean;
30
+ is_twitter_login_enabled: boolean;
31
+ is_microsoft_login_enabled: boolean;
32
+ is_twitch_login_enabled: boolean;
33
+ is_roblox_login_enabled: boolean;
34
+ is_email_verification_enabled: boolean;
35
+ is_basic_authentication_enabled: boolean;
36
+ is_magic_link_login_enabled: boolean;
37
+ is_sign_up_enabled: boolean;
38
+ is_strong_password_enabled: boolean;
39
+ is_multi_factor_auth_enabled: boolean;
40
+ is_mobile_basic_authentication_enabled: boolean;
41
+ is_phone_verification_enabled: boolean;
42
+ }
15
43
  interface User {
16
44
  id: string;
17
- email: string;
18
- preferred_username: string;
45
+ email: string | null;
19
46
  email_verified: boolean;
20
47
  signup_methods: string;
48
+ given_name: string | null;
49
+ family_name: string | null;
50
+ middle_name: string | null;
51
+ nickname: string | null;
52
+ preferred_username: string | null;
53
+ gender: string | null;
54
+ birthdate: string | null;
55
+ phone_number: string | null;
56
+ phone_number_verified: boolean;
57
+ picture: string | null;
58
+ roles: string[];
59
+ created_at: number | null;
60
+ updated_at: number | null;
61
+ revoked_timestamp: number | null;
62
+ is_multi_factor_auth_enabled: boolean | null;
63
+ app_data: Record<string, any> | null;
64
+ }
65
+ interface Users {
66
+ pagination: Pagination;
67
+ users: User[];
68
+ }
69
+ interface VerificationRequest {
70
+ id: string;
71
+ identifier: string | null;
72
+ token: string | null;
73
+ email: string | null;
74
+ expires: number | null;
75
+ created_at: number | null;
76
+ updated_at: number | null;
77
+ nonce: string | null;
78
+ redirect_uri: string | null;
79
+ }
80
+ interface VerificationRequests {
81
+ pagination: Pagination;
82
+ verification_requests: VerificationRequest[];
83
+ }
84
+ interface AuthorizerError {
85
+ message: string;
86
+ reason: string;
87
+ }
88
+ interface AuthResponse {
89
+ message: string;
90
+ should_show_email_otp_screen: boolean | null;
91
+ should_show_mobile_otp_screen: boolean | null;
92
+ should_show_totp_screen: boolean | null;
93
+ access_token: string | null;
94
+ id_token: string | null;
95
+ refresh_token: string | null;
96
+ expires_in: number | null;
97
+ user: User | null;
98
+ authenticator_scanner_image: string | null;
99
+ authenticator_secret: string | null;
100
+ authenticator_recovery_codes: string[] | null;
101
+ }
102
+ type AuthToken = AuthResponse;
103
+ interface Response {
104
+ message: string;
105
+ }
106
+ type GenericResponse = Response;
107
+ interface ForgotPasswordResponse {
108
+ message: string;
109
+ should_show_mobile_otp_screen: boolean | null;
110
+ }
111
+ interface InviteMembersResponse {
112
+ message: string;
113
+ Users: User[];
114
+ }
115
+ interface LoginRequest {
116
+ email?: string | null;
117
+ phone_number?: string | null;
118
+ password: string;
119
+ roles?: string[] | null;
120
+ scope?: string[] | null;
121
+ state?: string | null;
122
+ }
123
+ interface SignUpRequest {
124
+ email?: string | null;
21
125
  given_name?: string | null;
22
126
  family_name?: string | null;
23
127
  middle_name?: string | null;
24
128
  nickname?: string | null;
25
- picture?: string | null;
26
129
  gender?: string | null;
27
130
  birthdate?: string | null;
28
131
  phone_number?: string | null;
29
- phone_number_verified?: boolean | null;
30
- roles?: string[];
31
- created_at: number;
32
- updated_at: number;
33
- is_multi_factor_auth_enabled?: boolean;
34
- app_data?: Record<string, any>;
35
- }
36
- interface AuthToken {
37
- message?: string;
38
- access_token: string;
39
- expires_in: number;
40
- id_token: string;
41
- refresh_token?: string;
42
- user?: User;
43
- should_show_email_otp_screen?: boolean;
44
- should_show_mobile_otp_screen?: boolean;
45
- should_show_totp_screen?: boolean;
46
- authenticator_scanner_image?: string;
47
- authenticator_secret?: string;
48
- authenticator_recovery_codes?: string[];
49
- }
50
- interface GenericResponse {
51
- message: string;
52
- }
53
- type Headers = Record<string, string>;
54
- interface LoginInput {
55
- email?: string;
56
- phone_number?: string;
57
- password: string;
58
- roles?: string[];
59
- scope?: string[];
60
- state?: string;
61
- }
62
- interface SignupInput {
63
- email?: string;
132
+ picture?: string | null;
64
133
  password: string;
65
134
  confirm_password: string;
66
- given_name?: string;
67
- family_name?: string;
68
- middle_name?: string;
69
- nickname?: string;
70
- picture?: string;
71
- gender?: string;
72
- birthdate?: string;
73
- phone_number?: string;
74
- roles?: string[];
75
- scope?: string[];
76
- redirect_uri?: string;
77
- is_multi_factor_auth_enabled?: boolean;
78
- state?: string;
79
- app_data?: Record<string, any>;
80
- }
81
- interface MagicLinkLoginInput {
135
+ roles?: string[] | null;
136
+ scope?: string[] | null;
137
+ redirect_uri?: string | null;
138
+ is_multi_factor_auth_enabled?: boolean | null;
139
+ state?: string | null;
140
+ app_data?: Record<string, any> | null;
141
+ }
142
+ type SignupRequest = SignUpRequest;
143
+ interface MagicLinkLoginRequest {
82
144
  email: string;
83
- roles?: string[];
84
- scopes?: string[];
85
- state?: string;
86
- redirect_uri?: string;
145
+ roles?: string[] | null;
146
+ scope?: string[] | null;
147
+ state?: string | null;
148
+ redirect_uri?: string | null;
87
149
  }
88
- interface VerifyEmailInput {
150
+ interface VerifyEmailRequest {
89
151
  token: string;
90
- state?: string;
152
+ state?: string | null;
91
153
  }
92
- interface ResendVerifyEmailInput {
154
+ interface ResendVerifyEmailRequest {
93
155
  email: string;
94
156
  identifier: string;
157
+ state?: string | null;
95
158
  }
96
- interface VerifyOtpInput {
97
- email?: string;
98
- phone_number?: string;
159
+ interface VerifyOTPRequest {
160
+ email?: string | null;
161
+ phone_number?: string | null;
99
162
  otp: string;
100
- state?: string;
101
- is_totp?: boolean;
163
+ is_totp?: boolean | null;
164
+ state?: string | null;
102
165
  }
103
- interface ResendOtpInput {
104
- email?: string;
105
- phone_number?: string;
106
- }
107
- interface GraphqlQueryInput {
108
- query: string;
109
- variables?: Record<string, any>;
110
- headers?: Headers;
111
- }
112
- interface MetaData {
113
- version: string;
114
- client_id: string;
115
- is_google_login_enabled: boolean;
116
- is_facebook_login_enabled: boolean;
117
- is_github_login_enabled: boolean;
118
- is_linkedin_login_enabled: boolean;
119
- is_apple_login_enabled: boolean;
120
- is_twitter_login_enabled: boolean;
121
- is_microsoft_login_enabled: boolean;
122
- is_twitch_login_enabled: boolean;
123
- is_email_verification_enabled: boolean;
124
- is_basic_authentication_enabled: boolean;
125
- is_magic_link_login_enabled: boolean;
126
- is_sign_up_enabled: boolean;
127
- is_strong_password_enabled: boolean;
128
- is_multi_factor_auth_enabled: boolean;
129
- is_mobile_basic_authentication_enabled: boolean;
130
- is_phone_verification_enabled: boolean;
166
+ type VerifyOtpRequest = VerifyOTPRequest;
167
+ interface ResendOTPRequest {
168
+ email?: string | null;
169
+ phone_number?: string | null;
170
+ state?: string | null;
171
+ }
172
+ type ResendOtpRequest = ResendOTPRequest;
173
+ interface UpdateProfileRequest {
174
+ old_password?: string | null;
175
+ new_password?: string | null;
176
+ confirm_new_password?: string | null;
177
+ email?: string | null;
178
+ given_name?: string | null;
179
+ family_name?: string | null;
180
+ middle_name?: string | null;
181
+ nickname?: string | null;
182
+ gender?: string | null;
183
+ birthdate?: string | null;
184
+ phone_number?: string | null;
185
+ picture?: string | null;
186
+ is_multi_factor_auth_enabled?: boolean | null;
187
+ app_data?: Record<string, any> | null;
131
188
  }
132
- interface UpdateProfileInput {
133
- old_password?: string;
134
- new_password?: string;
135
- confirm_new_password?: string;
136
- email?: string;
137
- given_name?: string;
138
- family_name?: string;
139
- middle_name?: string;
140
- nickname?: string;
141
- gender?: string;
142
- birthdate?: string;
143
- phone_number?: string;
144
- picture?: string;
145
- is_multi_factor_auth_enabled?: boolean;
146
- app_data?: Record<string, any>;
147
- }
148
- interface ForgotPasswordInput {
149
- email?: string;
150
- phone_number?: string;
151
- state?: string;
152
- redirect_uri?: string;
189
+ interface UpdateUserRequest {
190
+ id: string;
191
+ email?: string | null;
192
+ email_verified?: boolean | null;
193
+ given_name?: string | null;
194
+ family_name?: string | null;
195
+ middle_name?: string | null;
196
+ nickname?: string | null;
197
+ gender?: string | null;
198
+ birthdate?: string | null;
199
+ phone_number?: string | null;
200
+ phone_number_verified?: boolean | null;
201
+ picture?: string | null;
202
+ roles?: string[] | null;
203
+ is_multi_factor_auth_enabled?: boolean | null;
204
+ app_data?: Record<string, any> | null;
153
205
  }
154
- interface ForgotPasswordResponse {
155
- message: string;
156
- should_show_mobile_otp_screen?: boolean;
206
+ interface ForgotPasswordRequest {
207
+ email?: string | null;
208
+ phone_number?: string | null;
209
+ state?: string | null;
210
+ redirect_uri?: string | null;
157
211
  }
158
- interface ResetPasswordInput {
159
- token?: string;
160
- otp?: string;
161
- phone_number?: string;
212
+ interface ResetPasswordRequest {
213
+ token?: string | null;
214
+ otp?: string | null;
215
+ phone_number?: string | null;
162
216
  password: string;
163
217
  confirm_password: string;
164
218
  }
165
- interface SessionQueryInput {
166
- roles?: string[];
219
+ type ResetPasswordInput = ResetPasswordRequest;
220
+ interface DeleteUserRequest {
221
+ email: string;
167
222
  }
168
- interface IsValidJWTQueryInput {
169
- jwt: string;
170
- roles?: string[];
223
+ interface SessionQueryRequest {
224
+ roles?: string[] | null;
225
+ scope?: string[] | null;
171
226
  }
172
- interface ValidJWTResponse {
173
- valid: string;
174
- message: string;
227
+ type SessionQueryInput = SessionQueryRequest;
228
+ interface ValidateJWTTokenRequest {
229
+ token_type: string;
230
+ token: string;
231
+ roles?: string[] | null;
232
+ }
233
+ type ValidateJWTTokenInput = ValidateJWTTokenRequest;
234
+ interface ValidateJWTTokenResponse {
235
+ is_valid: boolean;
236
+ claims: Record<string, any>;
237
+ }
238
+ interface ValidateSessionRequest {
239
+ cookie: string;
240
+ roles?: string[] | null;
241
+ }
242
+ type ValidateSessionInput = ValidateSessionRequest;
243
+ interface ValidateSessionResponse {
244
+ is_valid: boolean;
245
+ user: User;
175
246
  }
176
247
  declare enum OAuthProviders {
177
248
  Apple = "apple",
@@ -181,17 +252,20 @@ declare enum OAuthProviders {
181
252
  LinkedIn = "linkedin",
182
253
  Twitter = "twitter",
183
254
  Microsoft = "microsoft",
184
- Twitch = "twitch"
255
+ Twitch = "twitch",
256
+ Roblox = "roblox",
257
+ Discord = "discord"
185
258
  }
186
259
  declare enum ResponseTypes {
187
260
  Code = "code",
188
261
  Token = "token"
189
262
  }
190
- interface AuthorizeInput {
263
+ interface AuthorizeRequest {
191
264
  response_type: ResponseTypes;
192
265
  use_refresh_token?: boolean;
193
266
  response_mode?: string;
194
267
  }
268
+ type AuthorizeInput = AuthorizeRequest;
195
269
  interface AuthorizeResponse {
196
270
  state: string;
197
271
  code?: string;
@@ -201,66 +275,66 @@ interface AuthorizeResponse {
201
275
  interface RevokeTokenInput {
202
276
  refresh_token: string;
203
277
  }
204
- interface GetTokenInput {
278
+ interface GetTokenRequest {
205
279
  code?: string;
206
280
  grant_type?: string;
207
281
  refresh_token?: string;
208
282
  }
283
+ type GetTokenInput = GetTokenRequest;
209
284
  interface GetTokenResponse {
210
285
  access_token: string;
211
286
  expires_in: number;
212
287
  id_token: string;
213
288
  refresh_token?: string;
214
289
  }
215
- interface ValidateJWTTokenInput {
216
- token_type: 'access_token' | 'id_token' | 'refresh_token';
217
- token: string;
218
- roles?: string[];
219
- }
220
- interface ValidateJWTTokenResponse {
221
- is_valid: boolean;
222
- claims: Record<string, any>;
290
+ type Headers = Record<string, string>;
291
+ interface GraphqlQueryRequest {
292
+ query: string;
293
+ variables?: Record<string, any>;
294
+ headers?: Headers;
223
295
  }
224
- interface ValidateSessionInput {
225
- cookie?: string;
296
+ interface IsValidJWTQueryInput {
297
+ jwt: string;
226
298
  roles?: string[];
227
299
  }
228
- interface ValidateSessionResponse {
229
- is_valid: boolean;
230
- user: User;
300
+ interface ValidJWTResponse {
301
+ valid: string;
302
+ message: string;
231
303
  }
304
+ type MetaDataResponse = Meta;
305
+ type MetaData = Meta;
232
306
 
233
307
  declare class Authorizer {
234
308
  config: ConfigType;
235
309
  codeVerifier: string;
236
310
  constructor(config: ConfigType);
237
- authorize: (data: AuthorizeInput) => Promise<ApiResponse<GetTokenResponse> | ApiResponse<AuthorizeResponse>>;
311
+ authorize: (data: AuthorizeRequest) => Promise<ApiResponse<GetTokenResponse> | ApiResponse<AuthorizeResponse>>;
238
312
  browserLogin: () => Promise<ApiResponse<AuthToken>>;
239
- forgotPassword: (data: ForgotPasswordInput) => Promise<ApiResponse<ForgotPasswordResponse>>;
313
+ forgotPassword: (data: ForgotPasswordRequest) => Promise<ApiResponse<ForgotPasswordResponse>>;
240
314
  getMetaData: () => Promise<ApiResponse<MetaData>>;
241
315
  getProfile: (headers?: Headers) => Promise<ApiResponse<User>>;
242
- getSession: (headers?: Headers, params?: SessionQueryInput) => Promise<ApiResponse<AuthToken>>;
243
- getToken: (data: GetTokenInput) => Promise<ApiResponse<GetTokenResponse>>;
244
- login: (data: LoginInput) => Promise<ApiResponse<AuthToken>>;
316
+ getSession: (headers?: Headers, params?: SessionQueryRequest) => Promise<ApiResponse<AuthToken>>;
317
+ getToken: (data: GetTokenRequest) => Promise<ApiResponse<GetTokenResponse>>;
318
+ login: (data: LoginRequest) => Promise<ApiResponse<AuthToken>>;
245
319
  logout: (headers?: Headers) => Promise<ApiResponse<GenericResponse>>;
246
- magicLinkLogin: (data: MagicLinkLoginInput) => Promise<ApiResponse<GenericResponse>>;
320
+ magicLinkLogin: (data: MagicLinkLoginRequest) => Promise<ApiResponse<GenericResponse>>;
247
321
  oauthLogin: (oauthProvider: string, roles?: string[], redirect_uri?: string, state?: string) => Promise<void>;
248
- resendOtp: (data: ResendOtpInput) => Promise<ApiResponse<GenericResponse>>;
249
- resetPassword: (data: ResetPasswordInput) => Promise<ApiResponse<GenericResponse>>;
322
+ resendOtp: (data: ResendOtpRequest) => Promise<ApiResponse<GenericResponse>>;
323
+ resetPassword: (data: ResetPasswordRequest) => Promise<ApiResponse<GenericResponse>>;
250
324
  revokeToken: (data: {
251
325
  refresh_token: string;
252
326
  }) => Promise<ApiResponse<any>>;
253
- signup: (data: SignupInput) => Promise<ApiResponse<AuthToken>>;
254
- updateProfile: (data: UpdateProfileInput, headers?: Headers) => Promise<ApiResponse<GenericResponse>>;
327
+ signup: (data: SignUpRequest) => Promise<ApiResponse<AuthToken>>;
328
+ updateProfile: (data: UpdateProfileRequest, headers?: Headers) => Promise<ApiResponse<GenericResponse>>;
255
329
  deactivateAccount: (headers?: Headers) => Promise<ApiResponse<GenericResponse>>;
256
- validateJWTToken: (params?: ValidateJWTTokenInput) => Promise<ApiResponse<ValidateJWTTokenResponse>>;
257
- validateSession: (params?: ValidateSessionInput) => Promise<ApiResponse<ValidateSessionResponse>>;
258
- verifyEmail: (data: VerifyEmailInput) => Promise<ApiResponse<AuthToken>>;
259
- resendVerifyEmail: (data: ResendVerifyEmailInput) => Promise<ApiResponse<GenericResponse>>;
260
- verifyOtp: (data: VerifyOtpInput) => Promise<ApiResponse<AuthToken>>;
261
- graphqlQuery: (data: GraphqlQueryInput) => Promise<GrapQlResponseType>;
330
+ validateJWTToken: (params?: ValidateJWTTokenRequest) => Promise<ApiResponse<ValidateJWTTokenResponse>>;
331
+ validateSession: (params?: ValidateSessionRequest) => Promise<ApiResponse<ValidateSessionResponse>>;
332
+ verifyEmail: (data: VerifyEmailRequest) => Promise<ApiResponse<AuthToken>>;
333
+ resendVerifyEmail: (data: ResendVerifyEmailRequest) => Promise<ApiResponse<GenericResponse>>;
334
+ verifyOtp: (data: VerifyOtpRequest) => Promise<ApiResponse<AuthToken>>;
335
+ graphqlQuery: (data: GraphqlQueryRequest) => Promise<GrapQlResponseType>;
262
336
  errorResponse: (errors: Error[]) => ApiResponse<any>;
263
337
  okResponse: (data: any) => ApiResponse<any>;
264
338
  }
265
339
 
266
- export { type ApiResponse, type AuthToken, type AuthorizeInput, type AuthorizeResponse, Authorizer, type ConfigType, type ForgotPasswordInput, type ForgotPasswordResponse, type GenericResponse, type GetTokenInput, type GetTokenResponse, type GrapQlResponseType, type GraphqlQueryInput, type Headers, type IsValidJWTQueryInput, type LoginInput, type MagicLinkLoginInput, type MetaData, OAuthProviders, type ResendOtpInput, type ResendVerifyEmailInput, type ResetPasswordInput, ResponseTypes, type RevokeTokenInput, type SessionQueryInput, type SignupInput, type UpdateProfileInput, type User, type ValidJWTResponse, type ValidateJWTTokenInput, type ValidateJWTTokenResponse, type ValidateSessionInput, type ValidateSessionResponse, type VerifyEmailInput, type VerifyOtpInput };
340
+ export { type ApiResponse, type AuthResponse, type AuthToken, type AuthorizeInput, type AuthorizeRequest, type AuthorizeResponse, Authorizer, type AuthorizerError, type ConfigType, type DeleteUserRequest, type ForgotPasswordRequest, type ForgotPasswordResponse, type GenericResponse, type GetTokenInput, type GetTokenRequest, type GetTokenResponse, type GrapQlResponseType, type GraphqlQueryRequest, type Headers, type InviteMembersResponse, type IsValidJWTQueryInput, type LoginRequest, type MagicLinkLoginRequest, type Meta, type MetaData, type MetaDataResponse, OAuthProviders, type Pagination, type ResendOTPRequest, type ResendOtpRequest, type ResendVerifyEmailRequest, type ResetPasswordInput, type ResetPasswordRequest, type Response, ResponseTypes, type RevokeTokenInput, type SessionQueryInput, type SessionQueryRequest, type SignUpRequest, type SignupRequest, type UpdateProfileRequest, type UpdateUserRequest, type User, type Users, type ValidJWTResponse, type ValidateJWTTokenInput, type ValidateJWTTokenRequest, type ValidateJWTTokenResponse, type ValidateSessionInput, type ValidateSessionRequest, type ValidateSessionResponse, type VerificationRequest, type VerificationRequests, type VerifyEmailRequest, type VerifyOTPRequest, type VerifyOtpRequest };