authifyer-sdk 1.0.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/dist/authifyer-sdk.css +1 -0
- package/dist/authifyer-sdk.es.js +2531 -0
- package/dist/authifyer-sdk.umd.js +27 -0
- package/package.json +30 -0
- package/src/core/api.ts +50 -0
- package/src/core/client.ts +208 -0
- package/src/core/types.ts +27 -0
- package/src/index.ts +5 -0
- package/src/react/AuthifyerProvider.tsx +79 -0
- package/src/react/components/AuthBox.tsx +35 -0
- package/src/react/components/SignIn.tsx +96 -0
- package/src/react/components/SignUp.tsx +114 -0
- package/src/react/components/authifyerui.css +223 -0
- package/src/react/context.ts +13 -0
- package/src/react/hooks.ts +26 -0
- package/src/utils/token.ts +42 -0
- package/tsconfig.json +35 -0
- package/tsconfig.node.json +12 -0
- package/vite.config.ts +28 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
(function(N,S){typeof exports=="object"&&typeof module<"u"?S(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],S):(N=typeof globalThis<"u"?globalThis:N||self,S(N.AuthifyerSDK={},N.React))})(this,(function(N,S){"use strict";var Rn=Object.defineProperty;var Sn=(N,S,H)=>S in N?Rn(N,S,{enumerable:!0,configurable:!0,writable:!0,value:H}):N[S]=H;var Q=(N,S,H)=>Sn(N,typeof S!="symbol"?S+"":S,H);var H={exports:{}},se={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Ve;function It(){if(Ve)return se;Ve=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(n,s,o){var i=null;if(o!==void 0&&(i=""+o),s.key!==void 0&&(i=""+s.key),"key"in s){o={};for(var c in s)c!=="key"&&(o[c]=s[c])}else o=s;return s=o.ref,{$$typeof:t,type:n,key:i,ref:s!==void 0?s:null,props:o}}return se.Fragment=e,se.jsx=r,se.jsxs=r,se}var oe={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var $e;function Ft(){return $e||($e=1,process.env.NODE_ENV!=="production"&&(function(){function t(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===Oe?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case h:return"Fragment";case U:return"Profiler";case T:return"StrictMode";case z:return"Suspense";case I:return"SuspenseList";case xe:return"Activity"}if(typeof l=="object")switch(typeof l.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),l.$$typeof){case b:return"Portal";case v:return l.displayName||"Context";case O:return(l._context.displayName||"Context")+".Consumer";case F:var w=l.render;return l=l.displayName,l||(l=w.displayName||w.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case he:return w=l.displayName||null,w!==null?w:t(l.type)||"Memo";case J:w=l._payload,l=l._init;try{return t(l(w))}catch{}}return null}function e(l){return""+l}function r(l){try{e(l);var w=!1}catch{w=!0}if(w){w=console;var A=w.error,_=typeof Symbol=="function"&&Symbol.toStringTag&&l[Symbol.toStringTag]||l.constructor.name||"Object";return A.call(w,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",_),e(l)}}function n(l){if(l===h)return"<>";if(typeof l=="object"&&l!==null&&l.$$typeof===J)return"<...>";try{var w=t(l);return w?"<"+w+">":"<...>"}catch{return"<...>"}}function s(){var l=V.A;return l===null?null:l.getOwner()}function o(){return Error("react-stack-top-frame")}function i(l){if($.call(l,"key")){var w=Object.getOwnPropertyDescriptor(l,"key").get;if(w&&w.isReactWarning)return!1}return l.key!==void 0}function c(l,w){function A(){P||(P=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",w))}A.isReactWarning=!0,Object.defineProperty(l,"key",{get:A,configurable:!0})}function p(){var l=t(this.type);return pe[l]||(pe[l]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),l=this.props.ref,l!==void 0?l:null}function d(l,w,A,_,G,We){var C=A.ref;return l={$$typeof:f,type:l,key:w,props:A,_owner:_},(C!==void 0?C:null)!==null?Object.defineProperty(l,"ref",{enumerable:!1,get:p}):Object.defineProperty(l,"ref",{enumerable:!1,value:null}),l._store={},Object.defineProperty(l._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(l,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(l,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:G}),Object.defineProperty(l,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:We}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l}function u(l,w,A,_,G,We){var C=w.children;if(C!==void 0)if(_)if(W(C)){for(_=0;_<C.length;_++)m(C[_]);Object.freeze&&Object.freeze(C)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else m(C);if($.call(w,"key")){C=t(l);var ne=Object.keys(w).filter(function(En){return En!=="key"});_=0<ne.length?"{key: someKey, "+ne.join(": ..., ")+": ...}":"{key: someKey}",Ne[C+_]||(ne=0<ne.length?"{"+ne.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
|
+
let props = %s;
|
|
19
|
+
<%s {...props} />
|
|
20
|
+
React keys must be passed directly to JSX without using spread:
|
|
21
|
+
let props = %s;
|
|
22
|
+
<%s key={someKey} {...props} />`,_,C,ne,C),Ne[C+_]=!0)}if(C=null,A!==void 0&&(r(A),C=""+A),i(w)&&(r(w.key),C=""+w.key),"key"in w){A={};for(var Je in w)Je!=="key"&&(A[Je]=w[Je])}else A=w;return C&&c(A,typeof l=="function"?l.displayName||l.name||"Unknown":l),d(l,C,A,s(),G,We)}function m(l){E(l)?l._store&&(l._store.validated=1):typeof l=="object"&&l!==null&&l.$$typeof===J&&(l._payload.status==="fulfilled"?E(l._payload.value)&&l._payload.value._store&&(l._payload.value._store.validated=1):l._store&&(l._store.validated=1))}function E(l){return typeof l=="object"&&l!==null&&l.$$typeof===f}var R=S,f=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),U=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),v=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),he=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),xe=Symbol.for("react.activity"),Oe=Symbol.for("react.client.reference"),V=R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,W=Array.isArray,re=console.createTask?console.createTask:function(){return null};R={react_stack_bottom_frame:function(l){return l()}};var P,pe={},M=R.react_stack_bottom_frame.bind(R,o)(),me=re(n(o)),Ne={};oe.Fragment=h,oe.jsx=function(l,w,A){var _=1e4>V.recentlyCreatedOwnerStacks++;return u(l,w,A,!1,_?Error("react-stack-top-frame"):M,_?re(n(l)):me)},oe.jsxs=function(l,w,A){var _=1e4>V.recentlyCreatedOwnerStacks++;return u(l,w,A,!0,_?Error("react-stack-top-frame"):M,_?re(n(l)):me)}})()),oe}var Ke;function Bt(){return Ke||(Ke=1,process.env.NODE_ENV==="production"?H.exports=It():H.exports=Ft()),H.exports}var y=Bt();function Ye(t,e){return function(){return t.apply(e,arguments)}}const{toString:Dt}=Object.prototype,{getPrototypeOf:Ce}=Object,{iterator:ye,toStringTag:Xe}=Symbol,be=(t=>e=>{const r=Dt.call(e);return t[r]||(t[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),D=t=>(t=t.toLowerCase(),e=>be(e)===t),ge=t=>e=>typeof e===t,{isArray:Z}=Array,ee=ge("undefined");function ie(t){return t!==null&&!ee(t)&&t.constructor!==null&&!ee(t.constructor)&&k(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Ge=D("ArrayBuffer");function Mt(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Ge(t.buffer),e}const Ht=ge("string"),k=ge("function"),Qe=ge("number"),ae=t=>t!==null&&typeof t=="object",qt=t=>t===!0||t===!1,we=t=>{if(be(t)!=="object")return!1;const e=Ce(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Xe in t)&&!(ye in t)},zt=t=>{if(!ae(t)||ie(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Wt=D("Date"),Jt=D("File"),Vt=D("Blob"),$t=D("FileList"),Kt=t=>ae(t)&&k(t.pipe),Yt=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||k(t.append)&&((e=be(t))==="formdata"||e==="object"&&k(t.toString)&&t.toString()==="[object FormData]"))},Xt=D("URLSearchParams"),[Gt,Qt,Zt,er]=["ReadableStream","Request","Response","Headers"].map(D),tr=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ce(t,e,{allOwnKeys:r=!1}={}){if(t===null||typeof t>"u")return;let n,s;if(typeof t!="object"&&(t=[t]),Z(t))for(n=0,s=t.length;n<s;n++)e.call(null,t[n],n,t);else{if(ie(t))return;const o=r?Object.getOwnPropertyNames(t):Object.keys(t),i=o.length;let c;for(n=0;n<i;n++)c=o[n],e.call(null,t[c],c,t)}}function Ze(t,e){if(ie(t))return null;e=e.toLowerCase();const r=Object.keys(t);let n=r.length,s;for(;n-- >0;)if(s=r[n],e===s.toLowerCase())return s;return null}const K=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,et=t=>!ee(t)&&t!==K;function Pe(){const{caseless:t,skipUndefined:e}=et(this)&&this||{},r={},n=(s,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const i=t&&Ze(r,o)||o;we(r[i])&&we(s)?r[i]=Pe(r[i],s):we(s)?r[i]=Pe({},s):Z(s)?r[i]=s.slice():(!e||!ee(s))&&(r[i]=s)};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&ce(arguments[s],n);return r}const rr=(t,e,r,{allOwnKeys:n}={})=>(ce(e,(s,o)=>{r&&k(s)?Object.defineProperty(t,o,{value:Ye(s,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),t),nr=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),sr=(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},or=(t,e,r,n)=>{let s,o,i;const c={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),o=s.length;o-- >0;)i=s[o],(!n||n(i,t,e))&&!c[i]&&(e[i]=t[i],c[i]=!0);t=r!==!1&&Ce(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},ir=(t,e,r)=>{t=String(t),(r===void 0||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return n!==-1&&n===r},ar=t=>{if(!t)return null;if(Z(t))return t;let e=t.length;if(!Qe(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},cr=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Ce(Uint8Array)),lr=(t,e)=>{const n=(t&&t[ye]).call(t);let s;for(;(s=n.next())&&!s.done;){const o=s.value;e.call(t,o[0],o[1])}},ur=(t,e)=>{let r;const n=[];for(;(r=t.exec(e))!==null;)n.push(r);return n},fr=D("HTMLFormElement"),dr=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,s){return n.toUpperCase()+s}),tt=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),hr=D("RegExp"),rt=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};ce(r,(s,o)=>{let i;(i=e(s,o,t))!==!1&&(n[o]=i||s)}),Object.defineProperties(t,n)},pr=t=>{rt(t,(e,r)=>{if(k(t)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=t[r];if(k(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},mr=(t,e)=>{const r={},n=s=>{s.forEach(o=>{r[o]=!0})};return Z(t)?n(t):n(String(t).split(e)),r},yr=()=>{},br=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function gr(t){return!!(t&&k(t.append)&&t[Xe]==="FormData"&&t[ye])}const wr=t=>{const e=new Array(10),r=(n,s)=>{if(ae(n)){if(e.indexOf(n)>=0)return;if(ie(n))return n;if(!("toJSON"in n)){e[s]=n;const o=Z(n)?[]:{};return ce(n,(i,c)=>{const p=r(i,s+1);!ee(p)&&(o[c]=p)}),e[s]=void 0,o}}return n};return r(t,0)},Er=D("AsyncFunction"),Rr=t=>t&&(ae(t)||k(t))&&k(t.then)&&k(t.catch),nt=((t,e)=>t?setImmediate:e?((r,n)=>(K.addEventListener("message",({source:s,data:o})=>{s===K&&o===r&&n.length&&n.shift()()},!1),s=>{n.push(s),K.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",k(K.postMessage)),Sr=typeof queueMicrotask<"u"?queueMicrotask.bind(K):typeof process<"u"&&process.nextTick||nt,a={isArray:Z,isArrayBuffer:Ge,isBuffer:ie,isFormData:Yt,isArrayBufferView:Mt,isString:Ht,isNumber:Qe,isBoolean:qt,isObject:ae,isPlainObject:we,isEmptyObject:zt,isReadableStream:Gt,isRequest:Qt,isResponse:Zt,isHeaders:er,isUndefined:ee,isDate:Wt,isFile:Jt,isBlob:Vt,isRegExp:hr,isFunction:k,isStream:Kt,isURLSearchParams:Xt,isTypedArray:cr,isFileList:$t,forEach:ce,merge:Pe,extend:rr,trim:tr,stripBOM:nr,inherits:sr,toFlatObject:or,kindOf:be,kindOfTest:D,endsWith:ir,toArray:ar,forEachEntry:lr,matchAll:ur,isHTMLForm:fr,hasOwnProperty:tt,hasOwnProp:tt,reduceDescriptors:rt,freezeMethods:pr,toObjectSet:mr,toCamelCase:dr,noop:yr,toFiniteNumber:br,findKey:Ze,global:K,isContextDefined:et,isSpecCompliantForm:gr,toJSONObject:wr,isAsyncFn:Er,isThenable:Rr,setImmediate:nt,asap:Sr,isIterable:t=>t!=null&&k(t[ye])};let g=class Lt extends Error{static from(e,r,n,s,o,i){const c=new Lt(e.message,r||e.code,n,s,o);return c.cause=e,c.name=e.name,i&&Object.assign(c,i),c}constructor(e,r,n,s,o){super(e),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),s&&(this.request=s),o&&(this.response=o,this.status=o.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.status}}};g.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",g.ERR_BAD_OPTION="ERR_BAD_OPTION",g.ECONNABORTED="ECONNABORTED",g.ETIMEDOUT="ETIMEDOUT",g.ERR_NETWORK="ERR_NETWORK",g.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",g.ERR_DEPRECATED="ERR_DEPRECATED",g.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",g.ERR_BAD_REQUEST="ERR_BAD_REQUEST",g.ERR_CANCELED="ERR_CANCELED",g.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",g.ERR_INVALID_URL="ERR_INVALID_URL";const Tr=null;function je(t){return a.isPlainObject(t)||a.isArray(t)}function st(t){return a.endsWith(t,"[]")?t.slice(0,-2):t}function ot(t,e,r){return t?t.concat(e).map(function(s,o){return s=st(s),!r&&o?"["+s+"]":s}).join(r?".":""):e}function Ar(t){return a.isArray(t)&&!t.some(je)}const _r=a.toFlatObject(a,{},null,function(e){return/^is[A-Z]/.test(e)});function Ee(t,e,r){if(!a.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,r=a.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,h){return!a.isUndefined(h[b])});const n=r.metaTokens,s=r.visitor||u,o=r.dots,i=r.indexes,p=(r.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(e);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function d(f){if(f===null)return"";if(a.isDate(f))return f.toISOString();if(a.isBoolean(f))return f.toString();if(!p&&a.isBlob(f))throw new g("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(f)||a.isTypedArray(f)?p&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function u(f,b,h){let T=f;if(f&&!h&&typeof f=="object"){if(a.endsWith(b,"{}"))b=n?b:b.slice(0,-2),f=JSON.stringify(f);else if(a.isArray(f)&&Ar(f)||(a.isFileList(f)||a.endsWith(b,"[]"))&&(T=a.toArray(f)))return b=st(b),T.forEach(function(O,v){!(a.isUndefined(O)||O===null)&&e.append(i===!0?ot([b],v,o):i===null?b:b+"[]",d(O))}),!1}return je(f)?!0:(e.append(ot(h,b,o),d(f)),!1)}const m=[],E=Object.assign(_r,{defaultVisitor:u,convertValue:d,isVisitable:je});function R(f,b){if(!a.isUndefined(f)){if(m.indexOf(f)!==-1)throw Error("Circular reference detected in "+b.join("."));m.push(f),a.forEach(f,function(T,U){(!(a.isUndefined(T)||T===null)&&s.call(e,T,a.isString(U)?U.trim():U,b,E))===!0&&R(T,b?b.concat(U):[U])}),m.pop()}}if(!a.isObject(t))throw new TypeError("data must be an object");return R(t),e}function it(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function ve(t,e){this._pairs=[],t&&Ee(t,this,e)}const at=ve.prototype;at.append=function(e,r){this._pairs.push([e,r])},at.toString=function(e){const r=e?function(n){return e.call(this,n,it)}:it;return this._pairs.map(function(s){return r(s[0])+"="+r(s[1])},"").join("&")};function xr(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ct(t,e,r){if(!e)return t;const n=r&&r.encode||xr,s=a.isFunction(r)?{serialize:r}:r,o=s&&s.serialize;let i;if(o?i=o(e,s):i=a.isURLSearchParams(e)?e.toString():new ve(e,s).toString(n),i){const c=t.indexOf("#");c!==-1&&(t=t.slice(0,c)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class lt{constructor(){this.handlers=[]}use(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){a.forEach(this.handlers,function(n){n!==null&&e(n)})}}const ke={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Or={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:ve,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},Le=typeof window<"u"&&typeof document<"u",Ue=typeof navigator=="object"&&navigator||void 0,Nr=Le&&(!Ue||["ReactNative","NativeScript","NS"].indexOf(Ue.product)<0),Cr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Pr=Le&&window.location.href||"http://localhost",j={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Le,hasStandardBrowserEnv:Nr,hasStandardBrowserWebWorkerEnv:Cr,navigator:Ue,origin:Pr},Symbol.toStringTag,{value:"Module"})),...Or};function jr(t,e){return Ee(t,new j.classes.URLSearchParams,{visitor:function(r,n,s,o){return j.isNode&&a.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...e})}function vr(t){return a.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function kr(t){const e={},r=Object.keys(t);let n;const s=r.length;let o;for(n=0;n<s;n++)o=r[n],e[o]=t[o];return e}function ut(t){function e(r,n,s,o){let i=r[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),p=o>=r.length;return i=!i&&a.isArray(s)?s.length:i,p?(a.hasOwnProp(s,i)?s[i]=[s[i],n]:s[i]=n,!c):((!s[i]||!a.isObject(s[i]))&&(s[i]=[]),e(r,n,s[i],o)&&a.isArray(s[i])&&(s[i]=kr(s[i])),!c)}if(a.isFormData(t)&&a.isFunction(t.entries)){const r={};return a.forEachEntry(t,(n,s)=>{e(vr(n),s,r,0)}),r}return null}function Lr(t,e,r){if(a.isString(t))try{return(e||JSON.parse)(t),a.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}const le={transitional:ke,adapter:["xhr","http","fetch"],transformRequest:[function(e,r){const n=r.getContentType()||"",s=n.indexOf("application/json")>-1,o=a.isObject(e);if(o&&a.isHTMLForm(e)&&(e=new FormData(e)),a.isFormData(e))return s?JSON.stringify(ut(e)):e;if(a.isArrayBuffer(e)||a.isBuffer(e)||a.isStream(e)||a.isFile(e)||a.isBlob(e)||a.isReadableStream(e))return e;if(a.isArrayBufferView(e))return e.buffer;if(a.isURLSearchParams(e))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return jr(e,this.formSerializer).toString();if((c=a.isFileList(e))||n.indexOf("multipart/form-data")>-1){const p=this.env&&this.env.FormData;return Ee(c?{"files[]":e}:e,p&&new p,this.formSerializer)}}return o||s?(r.setContentType("application/json",!1),Lr(e)):e}],transformResponse:[function(e){const r=this.transitional||le.transitional,n=r&&r.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(e)||a.isReadableStream(e))return e;if(e&&a.isString(e)&&(n&&!this.responseType||s)){const i=!(r&&r.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(c){if(i)throw c.name==="SyntaxError"?g.from(c,g.ERR_BAD_RESPONSE,this,null,this.response):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:j.classes.FormData,Blob:j.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],t=>{le.headers[t]={}});const Ur=a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Ir=t=>{const e={};let r,n,s;return t&&t.split(`
|
|
23
|
+
`).forEach(function(i){s=i.indexOf(":"),r=i.substring(0,s).trim().toLowerCase(),n=i.substring(s+1).trim(),!(!r||e[r]&&Ur[r])&&(r==="set-cookie"?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e},ft=Symbol("internals");function ue(t){return t&&String(t).trim().toLowerCase()}function Re(t){return t===!1||t==null?t:a.isArray(t)?t.map(Re):String(t)}function Fr(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}const Br=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Ie(t,e,r,n,s){if(a.isFunction(n))return n.call(this,e,r);if(s&&(e=r),!!a.isString(e)){if(a.isString(n))return e.indexOf(n)!==-1;if(a.isRegExp(n))return n.test(e)}}function Dr(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,r,n)=>r.toUpperCase()+n)}function Mr(t,e){const r=a.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(s,o,i){return this[n].call(this,e,s,o,i)},configurable:!0})})}let L=class{constructor(e){e&&this.set(e)}set(e,r,n){const s=this;function o(c,p,d){const u=ue(p);if(!u)throw new Error("header name must be a non-empty string");const m=a.findKey(s,u);(!m||s[m]===void 0||d===!0||d===void 0&&s[m]!==!1)&&(s[m||p]=Re(c))}const i=(c,p)=>a.forEach(c,(d,u)=>o(d,u,p));if(a.isPlainObject(e)||e instanceof this.constructor)i(e,r);else if(a.isString(e)&&(e=e.trim())&&!Br(e))i(Ir(e),r);else if(a.isObject(e)&&a.isIterable(e)){let c={},p,d;for(const u of e){if(!a.isArray(u))throw TypeError("Object iterator must return a key-value pair");c[d=u[0]]=(p=c[d])?a.isArray(p)?[...p,u[1]]:[p,u[1]]:u[1]}i(c,r)}else e!=null&&o(r,e,n);return this}get(e,r){if(e=ue(e),e){const n=a.findKey(this,e);if(n){const s=this[n];if(!r)return s;if(r===!0)return Fr(s);if(a.isFunction(r))return r.call(this,s,n);if(a.isRegExp(r))return r.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,r){if(e=ue(e),e){const n=a.findKey(this,e);return!!(n&&this[n]!==void 0&&(!r||Ie(this,this[n],n,r)))}return!1}delete(e,r){const n=this;let s=!1;function o(i){if(i=ue(i),i){const c=a.findKey(n,i);c&&(!r||Ie(n,n[c],c,r))&&(delete n[c],s=!0)}}return a.isArray(e)?e.forEach(o):o(e),s}clear(e){const r=Object.keys(this);let n=r.length,s=!1;for(;n--;){const o=r[n];(!e||Ie(this,this[o],o,e,!0))&&(delete this[o],s=!0)}return s}normalize(e){const r=this,n={};return a.forEach(this,(s,o)=>{const i=a.findKey(n,o);if(i){r[i]=Re(s),delete r[o];return}const c=e?Dr(o):String(o).trim();c!==o&&delete r[o],r[c]=Re(s),n[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const r=Object.create(null);return a.forEach(this,(n,s)=>{n!=null&&n!==!1&&(r[s]=e&&a.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,r])=>e+": "+r).join(`
|
|
24
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...r){const n=new this(e);return r.forEach(s=>n.set(s)),n}static accessor(e){const n=(this[ft]=this[ft]={accessors:{}}).accessors,s=this.prototype;function o(i){const c=ue(i);n[c]||(Mr(s,i),n[c]=!0)}return a.isArray(e)?e.forEach(o):o(e),this}};L.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),a.reduceDescriptors(L.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[r]=n}}}),a.freezeMethods(L);function Fe(t,e){const r=this||le,n=e||r,s=L.from(n.headers);let o=n.data;return a.forEach(t,function(c){o=c.call(r,o,s.normalize(),e?e.status:void 0)}),s.normalize(),o}function dt(t){return!!(t&&t.__CANCEL__)}let fe=class extends g{constructor(e,r,n){super(e??"canceled",g.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function ht(t,e,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?t(r):e(new g("Request failed with status code "+r.status,[g.ERR_BAD_REQUEST,g.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Hr(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function qr(t,e){t=t||10;const r=new Array(t),n=new Array(t);let s=0,o=0,i;return e=e!==void 0?e:1e3,function(p){const d=Date.now(),u=n[o];i||(i=d),r[s]=p,n[s]=d;let m=o,E=0;for(;m!==s;)E+=r[m++],m=m%t;if(s=(s+1)%t,s===o&&(o=(o+1)%t),d-i<e)return;const R=u&&d-u;return R?Math.round(E*1e3/R):void 0}}function zr(t,e){let r=0,n=1e3/e,s,o;const i=(d,u=Date.now())=>{r=u,s=null,o&&(clearTimeout(o),o=null),t(...d)};return[(...d)=>{const u=Date.now(),m=u-r;m>=n?i(d,u):(s=d,o||(o=setTimeout(()=>{o=null,i(s)},n-m)))},()=>s&&i(s)]}const Se=(t,e,r=3)=>{let n=0;const s=qr(50,250);return zr(o=>{const i=o.loaded,c=o.lengthComputable?o.total:void 0,p=i-n,d=s(p),u=i<=c;n=i;const m={loaded:i,total:c,progress:c?i/c:void 0,bytes:p,rate:d||void 0,estimated:d&&c&&u?(c-i)/d:void 0,event:o,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(m)},r)},pt=(t,e)=>{const r=t!=null;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},mt=t=>(...e)=>a.asap(()=>t(...e)),Wr=j.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,j.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(j.origin),j.navigator&&/(msie|trident)/i.test(j.navigator.userAgent)):()=>!0,Jr=j.hasStandardBrowserEnv?{write(t,e,r,n,s,o,i){if(typeof document>"u")return;const c=[`${t}=${encodeURIComponent(e)}`];a.isNumber(r)&&c.push(`expires=${new Date(r).toUTCString()}`),a.isString(n)&&c.push(`path=${n}`),a.isString(s)&&c.push(`domain=${s}`),o===!0&&c.push("secure"),a.isString(i)&&c.push(`SameSite=${i}`),document.cookie=c.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Vr(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function $r(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function yt(t,e,r){let n=!Vr(e);return t&&(n||r==!1)?$r(t,e):e}const bt=t=>t instanceof L?{...t}:t;function Y(t,e){e=e||{};const r={};function n(d,u,m,E){return a.isPlainObject(d)&&a.isPlainObject(u)?a.merge.call({caseless:E},d,u):a.isPlainObject(u)?a.merge({},u):a.isArray(u)?u.slice():u}function s(d,u,m,E){if(a.isUndefined(u)){if(!a.isUndefined(d))return n(void 0,d,m,E)}else return n(d,u,m,E)}function o(d,u){if(!a.isUndefined(u))return n(void 0,u)}function i(d,u){if(a.isUndefined(u)){if(!a.isUndefined(d))return n(void 0,d)}else return n(void 0,u)}function c(d,u,m){if(m in e)return n(d,u);if(m in t)return n(void 0,d)}const p={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:c,headers:(d,u,m)=>s(bt(d),bt(u),m,!0)};return a.forEach(Object.keys({...t,...e}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const m=a.hasOwnProp(p,u)?p[u]:s,E=m(t[u],e[u],u);a.isUndefined(E)&&m!==c||(r[u]=E)}),r}const gt=t=>{const e=Y({},t);let{data:r,withXSRFToken:n,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:c}=e;if(e.headers=i=L.from(i),e.url=ct(yt(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),a.isFormData(r)){if(j.hasStandardBrowserEnv||j.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(a.isFunction(r.getHeaders)){const p=r.getHeaders(),d=["content-type","content-length"];Object.entries(p).forEach(([u,m])=>{d.includes(u.toLowerCase())&&i.set(u,m)})}}if(j.hasStandardBrowserEnv&&(n&&a.isFunction(n)&&(n=n(e)),n||n!==!1&&Wr(e.url))){const p=s&&o&&Jr.read(o);p&&i.set(s,p)}return e},Kr=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(r,n){const s=gt(t);let o=s.data;const i=L.from(s.headers).normalize();let{responseType:c,onUploadProgress:p,onDownloadProgress:d}=s,u,m,E,R,f;function b(){R&&R(),f&&f(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function T(){if(!h)return;const O=L.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),F={data:!c||c==="text"||c==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:O,config:t,request:h};ht(function(I){r(I),b()},function(I){n(I),b()},F),h=null}"onloadend"in h?h.onloadend=T:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(T)},h.onabort=function(){h&&(n(new g("Request aborted",g.ECONNABORTED,t,h)),h=null)},h.onerror=function(v){const F=v&&v.message?v.message:"Network Error",z=new g(F,g.ERR_NETWORK,t,h);z.event=v||null,n(z),h=null},h.ontimeout=function(){let v=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const F=s.transitional||ke;s.timeoutErrorMessage&&(v=s.timeoutErrorMessage),n(new g(v,F.clarifyTimeoutError?g.ETIMEDOUT:g.ECONNABORTED,t,h)),h=null},o===void 0&&i.setContentType(null),"setRequestHeader"in h&&a.forEach(i.toJSON(),function(v,F){h.setRequestHeader(F,v)}),a.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),c&&c!=="json"&&(h.responseType=s.responseType),d&&([E,f]=Se(d,!0),h.addEventListener("progress",E)),p&&h.upload&&([m,R]=Se(p),h.upload.addEventListener("progress",m),h.upload.addEventListener("loadend",R)),(s.cancelToken||s.signal)&&(u=O=>{h&&(n(!O||O.type?new fe(null,t,h):O),h.abort(),h=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const U=Hr(s.url);if(U&&j.protocols.indexOf(U)===-1){n(new g("Unsupported protocol "+U+":",g.ERR_BAD_REQUEST,t));return}h.send(o||null)})},Yr=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let n=new AbortController,s;const o=function(d){if(!s){s=!0,c();const u=d instanceof Error?d:this.reason;n.abort(u instanceof g?u:new fe(u instanceof Error?u.message:u))}};let i=e&&setTimeout(()=>{i=null,o(new g(`timeout of ${e}ms exceeded`,g.ETIMEDOUT))},e);const c=()=>{t&&(i&&clearTimeout(i),i=null,t.forEach(d=>{d.unsubscribe?d.unsubscribe(o):d.removeEventListener("abort",o)}),t=null)};t.forEach(d=>d.addEventListener("abort",o));const{signal:p}=n;return p.unsubscribe=()=>a.asap(c),p}},Xr=function*(t,e){let r=t.byteLength;if(r<e){yield t;return}let n=0,s;for(;n<r;)s=n+e,yield t.slice(n,s),n=s},Gr=async function*(t,e){for await(const r of Qr(t))yield*Xr(r,e)},Qr=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:r,value:n}=await e.read();if(r)break;yield n}}finally{await e.cancel()}},wt=(t,e,r,n)=>{const s=Gr(t,e);let o=0,i,c=p=>{i||(i=!0,n&&n(p))};return new ReadableStream({async pull(p){try{const{done:d,value:u}=await s.next();if(d){c(),p.close();return}let m=u.byteLength;if(r){let E=o+=m;r(E)}p.enqueue(new Uint8Array(u))}catch(d){throw c(d),d}},cancel(p){return c(p),s.return()}},{highWaterMark:2})},Et=64*1024,{isFunction:Te}=a,Zr=(({Request:t,Response:e})=>({Request:t,Response:e}))(a.global),{ReadableStream:Rt,TextEncoder:St}=a.global,Tt=(t,...e)=>{try{return!!t(...e)}catch{return!1}},en=t=>{t=a.merge.call({skipUndefined:!0},Zr,t);const{fetch:e,Request:r,Response:n}=t,s=e?Te(e):typeof fetch=="function",o=Te(r),i=Te(n);if(!s)return!1;const c=s&&Te(Rt),p=s&&(typeof St=="function"?(f=>b=>f.encode(b))(new St):async f=>new Uint8Array(await new r(f).arrayBuffer())),d=o&&c&&Tt(()=>{let f=!1;const b=new r(j.origin,{body:new Rt,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!b}),u=i&&c&&Tt(()=>a.isReadableStream(new n("").body)),m={stream:u&&(f=>f.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!m[f]&&(m[f]=(b,h)=>{let T=b&&b[f];if(T)return T.call(b);throw new g(`Response type '${f}' is not supported`,g.ERR_NOT_SUPPORT,h)})});const E=async f=>{if(f==null)return 0;if(a.isBlob(f))return f.size;if(a.isSpecCompliantForm(f))return(await new r(j.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(a.isArrayBufferView(f)||a.isArrayBuffer(f))return f.byteLength;if(a.isURLSearchParams(f)&&(f=f+""),a.isString(f))return(await p(f)).byteLength},R=async(f,b)=>{const h=a.toFiniteNumber(f.getContentLength());return h??E(b)};return async f=>{let{url:b,method:h,data:T,signal:U,cancelToken:O,timeout:v,onDownloadProgress:F,onUploadProgress:z,responseType:I,headers:he,withCredentials:J="same-origin",fetchOptions:xe}=gt(f),Oe=e||fetch;I=I?(I+"").toLowerCase():"text";let V=Yr([U,O&&O.toAbortSignal()],v),$=null;const W=V&&V.unsubscribe&&(()=>{V.unsubscribe()});let re;try{if(z&&d&&h!=="get"&&h!=="head"&&(re=await R(he,T))!==0){let l=new r(b,{method:"POST",body:T,duplex:"half"}),w;if(a.isFormData(T)&&(w=l.headers.get("content-type"))&&he.setContentType(w),l.body){const[A,_]=pt(re,Se(mt(z)));T=wt(l.body,Et,A,_)}}a.isString(J)||(J=J?"include":"omit");const P=o&&"credentials"in r.prototype,pe={...xe,signal:V,method:h.toUpperCase(),headers:he.normalize().toJSON(),body:T,duplex:"half",credentials:P?J:void 0};$=o&&new r(b,pe);let M=await(o?Oe($,xe):Oe(b,pe));const me=u&&(I==="stream"||I==="response");if(u&&(F||me&&W)){const l={};["status","statusText","headers"].forEach(G=>{l[G]=M[G]});const w=a.toFiniteNumber(M.headers.get("content-length")),[A,_]=F&&pt(w,Se(mt(F),!0))||[];M=new n(wt(M.body,Et,A,()=>{_&&_(),W&&W()}),l)}I=I||"text";let Ne=await m[a.findKey(m,I)||"text"](M,f);return!me&&W&&W(),await new Promise((l,w)=>{ht(l,w,{data:Ne,headers:L.from(M.headers),status:M.status,statusText:M.statusText,config:f,request:$})})}catch(P){throw W&&W(),P&&P.name==="TypeError"&&/Load failed|fetch/i.test(P.message)?Object.assign(new g("Network Error",g.ERR_NETWORK,f,$,P&&P.response),{cause:P.cause||P}):g.from(P,P&&P.code,f,$,P&&P.response)}}},tn=new Map,At=t=>{let e=t&&t.env||{};const{fetch:r,Request:n,Response:s}=e,o=[n,s,r];let i=o.length,c=i,p,d,u=tn;for(;c--;)p=o[c],d=u.get(p),d===void 0&&u.set(p,d=c?new Map:en(e)),u=d;return d};At();const Be={http:Tr,xhr:Kr,fetch:{get:At}};a.forEach(Be,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const _t=t=>`- ${t}`,rn=t=>a.isFunction(t)||t===null||t===!1;function nn(t,e){t=a.isArray(t)?t:[t];const{length:r}=t;let n,s;const o={};for(let i=0;i<r;i++){n=t[i];let c;if(s=n,!rn(n)&&(s=Be[(c=String(n)).toLowerCase()],s===void 0))throw new g(`Unknown adapter '${c}'`);if(s&&(a.isFunction(s)||(s=s.get(e))))break;o[c||"#"+i]=s}if(!s){const i=Object.entries(o).map(([p,d])=>`adapter ${p} `+(d===!1?"is not supported by the environment":"is not available in the build"));let c=r?i.length>1?`since :
|
|
25
|
+
`+i.map(_t).join(`
|
|
26
|
+
`):" "+_t(i[0]):"as no adapter specified";throw new g("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const xt={getAdapter:nn,adapters:Be};function De(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new fe(null,t)}function Ot(t){return De(t),t.headers=L.from(t.headers),t.data=Fe.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),xt.getAdapter(t.adapter||le.adapter,t)(t).then(function(n){return De(t),n.data=Fe.call(t,t.transformResponse,n),n.headers=L.from(n.headers),n},function(n){return dt(n)||(De(t),n&&n.response&&(n.response.data=Fe.call(t,t.transformResponse,n.response),n.response.headers=L.from(n.response.headers))),Promise.reject(n)})}const Nt="1.13.5",Ae={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Ae[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const Ct={};Ae.transitional=function(e,r,n){function s(o,i){return"[Axios v"+Nt+"] Transitional option '"+o+"'"+i+(n?". "+n:"")}return(o,i,c)=>{if(e===!1)throw new g(s(i," has been removed"+(r?" in "+r:"")),g.ERR_DEPRECATED);return r&&!Ct[i]&&(Ct[i]=!0,console.warn(s(i," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(o,i,c):!0}},Ae.spelling=function(e){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function sn(t,e,r){if(typeof t!="object")throw new g("options must be an object",g.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let s=n.length;for(;s-- >0;){const o=n[s],i=e[o];if(i){const c=t[o],p=c===void 0||i(c,o,t);if(p!==!0)throw new g("option "+o+" must be "+p,g.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new g("Unknown option "+o,g.ERR_BAD_OPTION)}}const _e={assertOptions:sn,validators:Ae},B=_e.validators;let X=class{constructor(e){this.defaults=e||{},this.interceptors={request:new lt,response:new lt}}async request(e,r){try{return await this._request(e,r)}catch(n){if(n instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const o=s.stack?s.stack.replace(/^.+\n/,""):"";try{n.stack?o&&!String(n.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(n.stack+=`
|
|
27
|
+
`+o):n.stack=o}catch{}}throw n}}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=Y(this.defaults,r);const{transitional:n,paramsSerializer:s,headers:o}=r;n!==void 0&&_e.assertOptions(n,{silentJSONParsing:B.transitional(B.boolean),forcedJSONParsing:B.transitional(B.boolean),clarifyTimeoutError:B.transitional(B.boolean),legacyInterceptorReqResOrdering:B.transitional(B.boolean)},!1),s!=null&&(a.isFunction(s)?r.paramsSerializer={serialize:s}:_e.assertOptions(s,{encode:B.function,serialize:B.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),_e.assertOptions(r,{baseUrl:B.spelling("baseURL"),withXsrfToken:B.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let i=o&&a.merge(o.common,o[r.method]);o&&a.forEach(["delete","get","head","post","put","patch","common"],f=>{delete o[f]}),r.headers=L.concat(i,o);const c=[];let p=!0;this.interceptors.request.forEach(function(b){if(typeof b.runWhen=="function"&&b.runWhen(r)===!1)return;p=p&&b.synchronous;const h=r.transitional||ke;h&&h.legacyInterceptorReqResOrdering?c.unshift(b.fulfilled,b.rejected):c.push(b.fulfilled,b.rejected)});const d=[];this.interceptors.response.forEach(function(b){d.push(b.fulfilled,b.rejected)});let u,m=0,E;if(!p){const f=[Ot.bind(this),void 0];for(f.unshift(...c),f.push(...d),E=f.length,u=Promise.resolve(r);m<E;)u=u.then(f[m++],f[m++]);return u}E=c.length;let R=r;for(;m<E;){const f=c[m++],b=c[m++];try{R=f(R)}catch(h){b.call(this,h);break}}try{u=Ot.call(this,R)}catch(f){return Promise.reject(f)}for(m=0,E=d.length;m<E;)u=u.then(d[m++],d[m++]);return u}getUri(e){e=Y(this.defaults,e);const r=yt(e.baseURL,e.url,e.allowAbsoluteUrls);return ct(r,e.params,e.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(e){X.prototype[e]=function(r,n){return this.request(Y(n||{},{method:e,url:r,data:(n||{}).data}))}}),a.forEach(["post","put","patch"],function(e){function r(n){return function(o,i,c){return this.request(Y(c||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}X.prototype[e]=r(),X.prototype[e+"Form"]=r(!0)});let on=class Ut{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});const n=this;this.promise.then(s=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](s);n._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(c=>{n.subscribe(c),o=c}).then(s);return i.cancel=function(){n.unsubscribe(o)},i},e(function(o,i,c){n.reason||(n.reason=new fe(o,i,c),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){const e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new Ut(function(s){e=s}),cancel:e}}};function an(t){return function(r){return t.apply(null,r)}}function cn(t){return a.isObject(t)&&t.isAxiosError===!0}const Me={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Me).forEach(([t,e])=>{Me[e]=t});function Pt(t){const e=new X(t),r=Ye(X.prototype.request,e);return a.extend(r,X.prototype,e,{allOwnKeys:!0}),a.extend(r,e,null,{allOwnKeys:!0}),r.create=function(s){return Pt(Y(t,s))},r}const x=Pt(le);x.Axios=X,x.CanceledError=fe,x.CancelToken=on,x.isCancel=dt,x.VERSION=Nt,x.toFormData=Ee,x.AxiosError=g,x.Cancel=x.CanceledError,x.all=function(e){return Promise.all(e)},x.spread=an,x.isAxiosError=cn,x.mergeConfig=Y,x.AxiosHeaders=L,x.formToJSON=t=>ut(a.isHTMLForm(t)?new FormData(t):t),x.getAdapter=xt.getAdapter,x.HttpStatusCode=Me,x.default=x;const{Axios:Cn,AxiosError:Pn,CanceledError:jn,isCancel:vn,CancelToken:kn,VERSION:Ln,all:Un,Cancel:In,isAxiosError:Fn,spread:Bn,toFormData:Dn,AxiosHeaders:Mn,HttpStatusCode:Hn,formToJSON:qn,getAdapter:zn,mergeConfig:Wn}=x,q=x.create({baseURL:"https://api.authifyer.com",withCredentials:!0,headers:{"Content-Type":"application/json"}}),jt=t=>{t?q.defaults.headers.common.Authorization=`Bearer ${t}`:delete q.defaults.headers.common.Authorization},He="authifyer_refresh_token",qe=t=>{try{t?localStorage.setItem(He,t):localStorage.removeItem(He)}catch(e){console.warn("Authifyer: localStorage is not accessible. Session persistence may fail.",e),typeof window<"u"&&window.dispatchEvent(new CustomEvent("auth:storage_error"))}},vt=()=>{try{return localStorage.getItem(He)}catch(t){return console.warn("Authifyer: localStorage is not accessible. Session persistence may fail.",t),typeof window<"u"&&window.dispatchEvent(new CustomEvent("auth:storage_error")),null}};class de extends Error{}de.prototype.name="InvalidTokenError";function ln(t){return decodeURIComponent(atob(t).replace(/(.)/g,(e,r)=>{let n=r.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}function un(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return ln(e)}catch{return atob(e)}}function fn(t,e){if(typeof t!="string")throw new de("Invalid token specified: must be a string");e||(e={});const r=e.header===!0?0:1,n=t.split(".")[r];if(typeof n!="string")throw new de(`Invalid token specified: missing part #${r+1}`);let s;try{s=un(n)}catch(o){throw new de(`Invalid token specified: invalid base64 for part #${r+1} (${o.message})`)}try{return JSON.parse(s)}catch(o){throw new de(`Invalid token specified: invalid json for part #${r+1} (${o.message})`)}}const dn=t=>{try{const e=fn(t),r=Date.now()/1e3;if(e.exp<r)return null;const n={authifyerId:e.sub,name:e.name,email:e.email,emailVerified:!1,isActive:!0,provider:"email"};return{token:t,sessionId:e.sid,expireAt:e.exp,user:n}}catch(e){return console.error("Invalid token",e),null}};class hn{constructor(e,r){Q(this,"publishableKey");Q(this,"refreshTimer",null);Q(this,"session",null);Q(this,"config",null);Q(this,"isLoading",!0);Q(this,"listeners",[]);this.publishableKey=e,r!=null&&r.backendUrl&&(q.defaults.baseURL=r.backendUrl)}async load(){try{this.isLoading=!0,this.notifyListeners(),await this.refreshSession()}catch(e){console.error("Failed to load Authifyer client",e)}finally{this.isLoading=!1,this.notifyListeners()}}async signInWithEmail(e,r){try{const n=await q.post("/authifyer/project/login/email",{email:e,password:r,publicProjectId:this.publishableKey});this.handleAuthResponse(n.data)}catch(n){throw n}}async signUpWithEmail(e,r){try{const n=await q.post("/authifyer/project/register/email",{email:e,password:r,publicProjectId:this.publishableKey});this.handleAuthResponse(n.data)}catch(n){throw n}}async signOut(){try{await q.post("/authifyer/session/logout")}catch(e){console.warn("Logout failed",e)}finally{this.clearSession()}}signInWithOAuth(e){const r=window.location.origin,n=`${q.defaults.baseURL}/oauth2/authorization/${e}?publishable_key=${this.publishableKey}&redirect_uri=${r}`;window.location.href=n}async refreshSession(){try{const e=vt(),r=await q.post("/authifyer/jwt/refresh-jwt",{refresh_token:e||void 0}),{access_token:n,refresh_token:s}=r.data;if(n){const o=n.accessToken||n;this.setSession(o)}s&&qe(s)}catch{this.clearSession()}}async rotateSession(){try{const e=vt();await q.post("/authifyer/session/refresh",{refresh_token:e||void 0}),await this.refreshSession()}catch(e){console.warn("Session rotation failed",e),this.clearSession()}}handleAuthResponse(e){e.accessToken&&this.setSession(e.accessToken),(e.refreshToken||e.refresh_token)&&qe(e.refreshToken||e.refresh_token)}setSession(e){const r=dn(e);r&&(this.session=r,jt(e),this.startRefreshTimer(),this.notifyListeners())}clearSession(){this.session=null,jt(null),qe(null),this.stopRefreshTimer(),this.notifyListeners()}startRefreshTimer(){this.stopRefreshTimer(),this.refreshTimer=setInterval(()=>{this.refreshSession()},270*1e3)}stopRefreshTimer(){this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=null)}subscribe(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(r=>r!==e)}}notifyListeners(){this.listeners.forEach(e=>e(this))}}const kt=S.createContext(void 0),pn=({publishableKey:t,backendUrl:e,config:r,children:n})=>{var f;const s=S.useMemo(()=>{const b=typeof process<"u"&&process.env&&(process.env.NEXT_PUBLIC_AUTHIFYER_PUBLISHABLE_KEY||process.env.REACT_APP_AUTHIFYER_PUBLISHABLE_KEY),h=t||b;h||console.error("AuthifyerProvider requires a publishableKey either passed as a prop or set as an environment variable (e.g. VITE_AUTHIFYER_PUBLISHABLE_KEY, NEXT_PUBLIC_AUTHIFYER_PUBLISHABLE_KEY, REACT_APP_AUTHIFYER_PUBLISHABLE_KEY).");const T=new hn(h||"",{backendUrl:e});return r&&(T.config=r),T},[t,e,r]),[o,i]=S.useState(((f=s.session)==null?void 0:f.user)||null),[c,p]=S.useState(s.session),[d,u]=S.useState(s.config),[m,E]=S.useState(s.isLoading);S.useEffect(()=>{const b=s.subscribe(h=>{var T;i(((T=h.session)==null?void 0:T.user)||null),p(h.session),r||u(h.config),E(h.isLoading)});return s.load(),()=>{b()}},[s,r]);const R={client:s,user:o,session:c,config:r||d,isLoading:m};return y.jsx(kt.Provider,{value:R,children:n})},te=()=>{const t=S.useContext(kt);if(t===void 0)throw new Error("useAuth must be used within an AuthifyerProvider");return t},mn=()=>{const{user:t,isLoading:e}=te();return{user:t,isLoading:e,isSignedIn:!!t}},yn=()=>{const{session:t,isLoading:e}=te();return{session:t,isLoading:e,isSignedIn:!!t}},bn=()=>{const{client:t}=te();return t},ze=({title:t,subtitle:e,children:r})=>y.jsx("div",{className:"authifyer-root",children:y.jsxs("div",{className:"authifyer-card",children:[y.jsxs("div",{className:"authifyer-card-header",children:[y.jsx("h2",{className:"authifyer-card-title",children:t}),e&&y.jsx("p",{className:"authifyer-card-subtitle",children:e})]}),y.jsx("div",{className:"authifyer-card-content",children:r}),y.jsxs("div",{className:"authifyer-footer",children:[y.jsx("span",{className:"authifyer-secured-text",children:"Secured by"}),y.jsxs("span",{className:"authifyer-brand",children:[y.jsx("svg",{className:"authifyer-logo-icon",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"})}),"Authifyer"]})]})]})}),gn=()=>{const{client:t,config:e}=te(),[r,n]=S.useState(""),[s,o]=S.useState(""),[i,c]=S.useState(""),[p,d]=S.useState(!1),u=(e==null?void 0:e.emailPasswordEnabled)??!0,m=(e==null?void 0:e.oauthProviders)??["google","github"],E=async R=>{R.preventDefault(),d(!0),c("");try{await t.signInWithEmail(r,s)}catch{c("Invalid credentials")}finally{d(!1)}};return y.jsxs(ze,{title:"Sign in",subtitle:"to continue to Authifyer",children:[i&&y.jsx("p",{className:"authifyer-error",children:i}),(m.includes("google")||m.includes("github"))&&y.jsxs("div",{className:"authifyer-form",children:[m.includes("google")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("google"),children:[y.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[y.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),y.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),y.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),y.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),"Continue with Google"]}),m.includes("github")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("github"),children:[y.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.3 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"})}),"Continue with GitHub"]})]}),(m.includes("google")||m.includes("github"))&&u&&y.jsx("div",{className:"authifyer-divider",children:"or"}),u&&y.jsxs("form",{onSubmit:E,className:"authifyer-form",children:[y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Email address"}),y.jsx("input",{type:"email",className:"authifyer-input",value:r,onChange:R=>n(R.target.value),required:!0})]}),y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Password"}),y.jsx("input",{type:"password",className:"authifyer-input",value:s,onChange:R=>o(R.target.value),required:!0})]}),y.jsx("button",{type:"submit",className:"authifyer-submit-btn",disabled:p,children:p?"Signing In...":"Continue"})]})]})},wn=()=>{const{client:t,config:e}=te(),[r,n]=S.useState(""),[s,o]=S.useState(""),[i,c]=S.useState(""),[p,d]=S.useState(!1),[u,m]=S.useState(!1),E=(e==null?void 0:e.emailPasswordEnabled)??!0,R=(e==null?void 0:e.oauthProviders)??["google","github"],f=async b=>{b.preventDefault(),d(!0),c("");try{await t.signUpWithEmail(r,s),m(!0)}catch{c("Registration failed. User might already exist.")}finally{d(!1)}};return u?y.jsx(ze,{title:"Welcome!",children:y.jsxs("div",{className:"authifyer-success",children:[y.jsx("svg",{className:"authifyer-success-icon",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:y.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),y.jsxs("div",{children:[y.jsx("h3",{className:"authifyer-success-title",children:"Success"}),y.jsx("p",{className:"authifyer-success-text",children:"Registration completed. Please verify your email."})]})]})}):y.jsxs(ze,{title:"Create your account",subtitle:"Welcome to Authifyer",children:[i&&y.jsx("p",{className:"authifyer-error",children:i}),(R.includes("google")||R.includes("github"))&&y.jsxs("div",{className:"authifyer-form",children:[R.includes("google")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("google"),children:[y.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[y.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),y.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),y.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),y.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),"Continue with Google"]}),R.includes("github")&&y.jsxs("button",{className:"authifyer-provider-btn",onClick:()=>t.signInWithOAuth("github"),children:[y.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.3 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"})}),"Continue with GitHub"]})]}),(R.includes("google")||R.includes("github"))&&E&&y.jsx("div",{className:"authifyer-divider",children:"or"}),E&&y.jsxs("form",{onSubmit:f,className:"authifyer-form",children:[y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Email address"}),y.jsx("input",{type:"email",className:"authifyer-input",value:r,onChange:b=>n(b.target.value),required:!0})]}),y.jsxs("div",{className:"authifyer-form-group",children:[y.jsx("label",{className:"authifyer-label",children:"Password"}),y.jsx("input",{type:"password",className:"authifyer-input",value:s,onChange:b=>o(b.target.value),required:!0})]}),y.jsx("button",{type:"submit",className:"authifyer-submit-btn",disabled:p,children:p?"Signing Up...":"Continue"})]})]})};N.AuthifyerProvider=pn,N.SignIn=gn,N.SignUp=wn,N.useAuth=te,N.useAuthifyer=bn,N.useSession=yn,N.useUser=mn,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "authifyer-sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "dist/authifyer-sdk.umd.js",
|
|
5
|
+
"module": "dist/authifyer-sdk.es.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"dev": "vite",
|
|
9
|
+
"build": "tsc && vite build",
|
|
10
|
+
"preview": "vite preview"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [],
|
|
13
|
+
"author": "",
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"description": "",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"axios": "^1.13.5",
|
|
18
|
+
"jwt-decode": "^4.0.0",
|
|
19
|
+
"react": "^19.2.4",
|
|
20
|
+
"react-dom": "^19.2.4",
|
|
21
|
+
"typescript": "^5.9.3"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/node": "^25.2.3",
|
|
25
|
+
"@types/react": "^19.2.14",
|
|
26
|
+
"@types/react-dom": "^19.2.3",
|
|
27
|
+
"@vitejs/plugin-react": "^4.7.0",
|
|
28
|
+
"vite": "^6.4.1"
|
|
29
|
+
}
|
|
30
|
+
}
|
package/src/core/api.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
|
|
3
|
+
// Default to the production Authifyer backend.
|
|
4
|
+
// Developers can override this via AuthifyerProvider's backendUrl prop if they are self-hosting.
|
|
5
|
+
const BASE_URL = 'https://api.authifyer.com'; // Replace this with the actual production backend URL
|
|
6
|
+
|
|
7
|
+
export const api = axios.create({
|
|
8
|
+
baseURL: BASE_URL,
|
|
9
|
+
withCredentials: true, // Kept for legacy compatibility if cookies are ever used
|
|
10
|
+
headers: {
|
|
11
|
+
'Content-Type': 'application/json',
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export const setAuthToken = (token: string | null) => {
|
|
16
|
+
if (token) {
|
|
17
|
+
api.defaults.headers.common['Authorization'] = `Bearer ${token}`;
|
|
18
|
+
} else {
|
|
19
|
+
delete api.defaults.headers.common['Authorization'];
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const REFRESH_TOKEN_KEY = 'authifyer_refresh_token';
|
|
24
|
+
|
|
25
|
+
export const setRefreshToken = (token: string | null) => {
|
|
26
|
+
try {
|
|
27
|
+
if (token) {
|
|
28
|
+
localStorage.setItem(REFRESH_TOKEN_KEY, token);
|
|
29
|
+
} else {
|
|
30
|
+
localStorage.removeItem(REFRESH_TOKEN_KEY);
|
|
31
|
+
}
|
|
32
|
+
} catch (e) {
|
|
33
|
+
console.warn('Authifyer: localStorage is not accessible. Session persistence may fail.', e);
|
|
34
|
+
if (typeof window !== 'undefined') {
|
|
35
|
+
window.dispatchEvent(new CustomEvent('auth:storage_error'));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const getRefreshToken = (): string | null => {
|
|
41
|
+
try {
|
|
42
|
+
return localStorage.getItem(REFRESH_TOKEN_KEY);
|
|
43
|
+
} catch (e) {
|
|
44
|
+
console.warn('Authifyer: localStorage is not accessible. Session persistence may fail.', e);
|
|
45
|
+
if (typeof window !== 'undefined') {
|
|
46
|
+
window.dispatchEvent(new CustomEvent('auth:storage_error'));
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { api, setAuthToken, setRefreshToken, getRefreshToken } from './api';
|
|
2
|
+
import { ProjectConfig, Session } from './types';
|
|
3
|
+
import { parseToken } from '@/utils/token';
|
|
4
|
+
|
|
5
|
+
export class AuthifyerClient {
|
|
6
|
+
private publishableKey: string;
|
|
7
|
+
private refreshTimer: NodeJS.Timeout | null = null;
|
|
8
|
+
|
|
9
|
+
// State
|
|
10
|
+
public session: Session | null = null;
|
|
11
|
+
public config: ProjectConfig | null = null;
|
|
12
|
+
public isLoading: boolean = true;
|
|
13
|
+
private listeners: ((client: AuthifyerClient) => void)[] = [];
|
|
14
|
+
|
|
15
|
+
constructor(publishableKey: string, options?: { backendUrl?: string }) {
|
|
16
|
+
this.publishableKey = publishableKey;
|
|
17
|
+
if (options?.backendUrl) {
|
|
18
|
+
api.defaults.baseURL = options.backendUrl;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// --- API Methods ---
|
|
23
|
+
|
|
24
|
+
public async load(): Promise<void> {
|
|
25
|
+
try {
|
|
26
|
+
this.isLoading = true;
|
|
27
|
+
this.notifyListeners();
|
|
28
|
+
|
|
29
|
+
// 1. Fetch Project Config
|
|
30
|
+
// The backend doesn't have a direct "get public config" endpoint just by key in the list I saw?
|
|
31
|
+
// Actually `ProjectController` has `getProject` but it needs AuthPrincipal.
|
|
32
|
+
// Wait, `OAuth2SuccessHandler` uses `projectRepo.findByPublishableKey`.
|
|
33
|
+
// I might need to infer config or add an endpoint.
|
|
34
|
+
// For now, I'll simulate config or fetch what I can.
|
|
35
|
+
// Let's assume we can try to refresh a session first.
|
|
36
|
+
|
|
37
|
+
await this.refreshSession();
|
|
38
|
+
|
|
39
|
+
// If we have a session, we can fetch project details?
|
|
40
|
+
// Or maybe we don't need full config yet, just the enabled providers.
|
|
41
|
+
// The requirement says "ui should change as per project settings".
|
|
42
|
+
// I might need to ask the user to add a public config endpoint or I can try to find one.
|
|
43
|
+
// Looking at `ProjectController`:
|
|
44
|
+
// `getProject(@AuthenticationPrincipal AuthPrincipal principal, @PathVariable String publicId)`
|
|
45
|
+
// This requires auth.
|
|
46
|
+
// I will implement a basic version and maybe we need to update the backend later.
|
|
47
|
+
// For now, I will hardcode enabled providers or try to get them from a public endpoint if it exists.
|
|
48
|
+
// Checks `SecurityConfig`: `/authifyer/global` is public? No, `serverApi` is limited.
|
|
49
|
+
|
|
50
|
+
// Workaround: I'll assume for now we just try to get the session.
|
|
51
|
+
|
|
52
|
+
} catch (error) {
|
|
53
|
+
console.error("Failed to load Authifyer client", error);
|
|
54
|
+
} finally {
|
|
55
|
+
this.isLoading = false;
|
|
56
|
+
this.notifyListeners();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// --- Auth Actions ---
|
|
61
|
+
|
|
62
|
+
public async signInWithEmail(email: string, password: string): Promise<void> {
|
|
63
|
+
try {
|
|
64
|
+
const response = await api.post('/authifyer/project/login/email', {
|
|
65
|
+
email,
|
|
66
|
+
password,
|
|
67
|
+
publicProjectId: this.publishableKey, // The user said "dont mind the publisc project id its the publishable key"
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
this.handleAuthResponse(response.data);
|
|
71
|
+
} catch (error) {
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
public async signUpWithEmail(email: string, password: string): Promise<void> {
|
|
77
|
+
try {
|
|
78
|
+
const response = await api.post('/authifyer/project/register/email', {
|
|
79
|
+
email,
|
|
80
|
+
password,
|
|
81
|
+
publicProjectId: this.publishableKey,
|
|
82
|
+
});
|
|
83
|
+
this.handleAuthResponse(response.data);
|
|
84
|
+
} catch (error) {
|
|
85
|
+
throw error;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public async signOut(): Promise<void> {
|
|
90
|
+
try {
|
|
91
|
+
await api.post('/authifyer/session/logout');
|
|
92
|
+
} catch (e) {
|
|
93
|
+
console.warn("Logout failed", e);
|
|
94
|
+
} finally {
|
|
95
|
+
this.clearSession();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
public signInWithOAuth(provider: 'google' | 'github') {
|
|
100
|
+
// Redirect to backend OAuth endpoint
|
|
101
|
+
// /oauth2/authorization/{provider}?publishable_key={key}&redirect_uri={current_url}
|
|
102
|
+
const redirectUri = window.location.origin;
|
|
103
|
+
const url = `${api.defaults.baseURL}/oauth2/authorization/${provider}?publishable_key=${this.publishableKey}&redirect_uri=${redirectUri}`;
|
|
104
|
+
window.location.href = url;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// --- Session Management ---
|
|
108
|
+
|
|
109
|
+
public async refreshSession(): Promise<void> {
|
|
110
|
+
try {
|
|
111
|
+
const currentRefreshToken = getRefreshToken();
|
|
112
|
+
|
|
113
|
+
// Retrieve new short-lived JWT using the refresh_token from local storage
|
|
114
|
+
const response = await api.post('/authifyer/jwt/refresh-jwt', {
|
|
115
|
+
refresh_token: currentRefreshToken || undefined
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
const { access_token, refresh_token } = response.data;
|
|
119
|
+
|
|
120
|
+
if (access_token) {
|
|
121
|
+
const tokenString = access_token.accessToken || access_token;
|
|
122
|
+
this.setSession(tokenString);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (refresh_token) {
|
|
126
|
+
setRefreshToken(refresh_token);
|
|
127
|
+
}
|
|
128
|
+
} catch (error) {
|
|
129
|
+
this.clearSession();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Rotates the underlying long-lived session.
|
|
135
|
+
* In a real app, this might be triggered if a specific error is caught
|
|
136
|
+
* or based on an internal timer if the session age is known.
|
|
137
|
+
*/
|
|
138
|
+
public async rotateSession(): Promise<void> {
|
|
139
|
+
try {
|
|
140
|
+
const currentRefreshToken = getRefreshToken();
|
|
141
|
+
await api.post('/authifyer/session/refresh', {
|
|
142
|
+
refresh_token: currentRefreshToken || undefined
|
|
143
|
+
});
|
|
144
|
+
await this.refreshSession(); // Refresh JWT immediately after session rotation
|
|
145
|
+
} catch (error) {
|
|
146
|
+
console.warn("Session rotation failed", error);
|
|
147
|
+
this.clearSession();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
private handleAuthResponse(data: any) {
|
|
152
|
+
// SessionDTO { subjectId, publicSessionId, accessToken, refreshToken, ... }
|
|
153
|
+
if (data.accessToken) {
|
|
154
|
+
this.setSession(data.accessToken);
|
|
155
|
+
}
|
|
156
|
+
if (data.refreshToken || data.refresh_token) {
|
|
157
|
+
setRefreshToken(data.refreshToken || data.refresh_token);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
private setSession(token: string) {
|
|
162
|
+
const session = parseToken(token);
|
|
163
|
+
if (session) {
|
|
164
|
+
this.session = session;
|
|
165
|
+
setAuthToken(token);
|
|
166
|
+
this.startRefreshTimer();
|
|
167
|
+
this.notifyListeners();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
private clearSession() {
|
|
172
|
+
this.session = null;
|
|
173
|
+
setAuthToken(null);
|
|
174
|
+
setRefreshToken(null);
|
|
175
|
+
this.stopRefreshTimer();
|
|
176
|
+
this.notifyListeners();
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// --- Timer ---
|
|
180
|
+
|
|
181
|
+
private startRefreshTimer() {
|
|
182
|
+
this.stopRefreshTimer();
|
|
183
|
+
// Refresh JWT every 4.5 minutes (270 seconds) to preempt 5-minute expiration
|
|
184
|
+
this.refreshTimer = setInterval(() => {
|
|
185
|
+
this.refreshSession();
|
|
186
|
+
}, 270 * 1000);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
private stopRefreshTimer() {
|
|
190
|
+
if (this.refreshTimer) {
|
|
191
|
+
clearInterval(this.refreshTimer);
|
|
192
|
+
this.refreshTimer = null;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// --- Listeners (Observer Pattern) ---
|
|
197
|
+
|
|
198
|
+
public subscribe(listener: (client: AuthifyerClient) => void) {
|
|
199
|
+
this.listeners.push(listener);
|
|
200
|
+
return () => {
|
|
201
|
+
this.listeners = this.listeners.filter(l => l !== listener);
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
private notifyListeners() {
|
|
206
|
+
this.listeners.forEach(l => l(this));
|
|
207
|
+
}
|
|
208
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface User {
|
|
2
|
+
authifyerId: string;
|
|
3
|
+
name: string;
|
|
4
|
+
email: string;
|
|
5
|
+
emailVerified: boolean;
|
|
6
|
+
isActive: boolean;
|
|
7
|
+
provider: string; // 'email', 'google', 'github'
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface Session {
|
|
11
|
+
token: string;
|
|
12
|
+
sessionId: string;
|
|
13
|
+
expireAt: number;
|
|
14
|
+
user: User;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ProjectConfig {
|
|
18
|
+
projectName: string;
|
|
19
|
+
emailPasswordEnabled: boolean;
|
|
20
|
+
oauthProviders: ('google' | 'github')[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface AuthState {
|
|
24
|
+
user: User | null;
|
|
25
|
+
session: Session | null;
|
|
26
|
+
isLoading: boolean;
|
|
27
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { AuthifyerProvider } from './react/AuthifyerProvider';
|
|
2
|
+
export { useAuth, useUser, useSession, useAuthifyer } from './react/hooks';
|
|
3
|
+
export { SignIn } from './react/components/SignIn';
|
|
4
|
+
export { SignUp } from './react/components/SignUp';
|
|
5
|
+
export type { User, Session, ProjectConfig } from './core/types';
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React, { useEffect, useState, useMemo } from 'react';
|
|
2
|
+
import { AuthifyerClient } from '@/core/client';
|
|
3
|
+
import { AuthContext } from './context';
|
|
4
|
+
import { User, Session, ProjectConfig } from '@/core/types';
|
|
5
|
+
|
|
6
|
+
interface AuthifyerProviderProps {
|
|
7
|
+
publishableKey?: string;
|
|
8
|
+
backendUrl?: string;
|
|
9
|
+
config?: ProjectConfig; // Optional override until backend supports public fetching
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const AuthifyerProvider: React.FC<AuthifyerProviderProps> = ({
|
|
14
|
+
publishableKey,
|
|
15
|
+
backendUrl,
|
|
16
|
+
config: initialConfig,
|
|
17
|
+
children
|
|
18
|
+
}) => {
|
|
19
|
+
// Memoize client so it's not recreated on every render
|
|
20
|
+
const client = useMemo(() => {
|
|
21
|
+
// Attempt to extract the key from common frontend ENVs if not explicitly passed
|
|
22
|
+
const envKey =
|
|
23
|
+
// @ts-ignore (Vite)
|
|
24
|
+
(typeof import.meta !== 'undefined' && import.meta.env && import.meta.env.VITE_AUTHIFYER_PUBLISHABLE_KEY) ||
|
|
25
|
+
// @ts-ignore (Next.js / CRA)
|
|
26
|
+
(typeof process !== 'undefined' && process.env && (process.env.NEXT_PUBLIC_AUTHIFYER_PUBLISHABLE_KEY || process.env.REACT_APP_AUTHIFYER_PUBLISHABLE_KEY));
|
|
27
|
+
|
|
28
|
+
const finalKey = publishableKey || envKey;
|
|
29
|
+
|
|
30
|
+
if (!finalKey) {
|
|
31
|
+
console.error("AuthifyerProvider requires a publishableKey either passed as a prop or set as an environment variable (e.g. VITE_AUTHIFYER_PUBLISHABLE_KEY, NEXT_PUBLIC_AUTHIFYER_PUBLISHABLE_KEY, REACT_APP_AUTHIFYER_PUBLISHABLE_KEY).");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const c = new AuthifyerClient(finalKey || '', { backendUrl });
|
|
35
|
+
if (initialConfig) {
|
|
36
|
+
c.config = initialConfig;
|
|
37
|
+
}
|
|
38
|
+
return c;
|
|
39
|
+
}, [publishableKey, backendUrl, initialConfig]);
|
|
40
|
+
|
|
41
|
+
const [user, setUser] = useState<User | null>(client.session?.user || null);
|
|
42
|
+
const [session, setSession] = useState<Session | null>(client.session);
|
|
43
|
+
const [config, setConfig] = useState<ProjectConfig | null>(client.config);
|
|
44
|
+
const [isLoading, setIsLoading] = useState<boolean>(client.isLoading);
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
// Subscribe to client updates
|
|
48
|
+
const unsubscribe = client.subscribe((updatedClient) => {
|
|
49
|
+
setUser(updatedClient.session?.user || null);
|
|
50
|
+
setSession(updatedClient.session);
|
|
51
|
+
// Only update config from client if we didn't force it via props
|
|
52
|
+
if (!initialConfig) {
|
|
53
|
+
setConfig(updatedClient.config);
|
|
54
|
+
}
|
|
55
|
+
setIsLoading(updatedClient.isLoading);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// Initial load
|
|
59
|
+
client.load();
|
|
60
|
+
|
|
61
|
+
return () => {
|
|
62
|
+
unsubscribe();
|
|
63
|
+
};
|
|
64
|
+
}, [client, initialConfig]);
|
|
65
|
+
|
|
66
|
+
const value = {
|
|
67
|
+
client,
|
|
68
|
+
user,
|
|
69
|
+
session,
|
|
70
|
+
config: initialConfig || config,
|
|
71
|
+
isLoading,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<AuthContext.Provider value={value}>
|
|
76
|
+
{children}
|
|
77
|
+
</AuthContext.Provider>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import './authifyerui.css';
|
|
3
|
+
|
|
4
|
+
interface AuthBoxProps {
|
|
5
|
+
title: string;
|
|
6
|
+
subtitle?: string;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const AuthBox: React.FC<AuthBoxProps> = ({ title, subtitle, children }) => {
|
|
11
|
+
return (
|
|
12
|
+
<div className="authifyer-root">
|
|
13
|
+
<div className="authifyer-card">
|
|
14
|
+
<div className="authifyer-card-header">
|
|
15
|
+
<h2 className="authifyer-card-title">{title}</h2>
|
|
16
|
+
{subtitle && <p className="authifyer-card-subtitle">{subtitle}</p>}
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<div className="authifyer-card-content">
|
|
20
|
+
{children}
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<div className="authifyer-footer">
|
|
24
|
+
<span className="authifyer-secured-text">Secured by</span>
|
|
25
|
+
<span className="authifyer-brand">
|
|
26
|
+
<svg className="authifyer-logo-icon" viewBox="0 0 24 24" fill="currentColor">
|
|
27
|
+
<path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5" />
|
|
28
|
+
</svg>
|
|
29
|
+
Authifyer
|
|
30
|
+
</span>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
};
|