@veripass/react-sdk 1.0.8 → 1.0.10
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/react-sdk.cjs.js +878 -46
- package/dist/react-sdk.cjs.js.map +1 -1
- package/dist/react-sdk.esm.js +879 -50
- package/dist/react-sdk.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/react-sdk.cjs.js
CHANGED
|
@@ -616,6 +616,13 @@ var AuthProvider = function AuthProvider(_ref) {
|
|
|
616
616
|
return JSON.parse(value);
|
|
617
617
|
};
|
|
618
618
|
|
|
619
|
+
// Effect to redirect if user is null
|
|
620
|
+
useEffect(function () {
|
|
621
|
+
if (user === null) {
|
|
622
|
+
window.location.replace('/auth/login');
|
|
623
|
+
}
|
|
624
|
+
}, [user]);
|
|
625
|
+
|
|
619
626
|
/**
|
|
620
627
|
* Memoized value containing the user data and authentication functions.
|
|
621
628
|
*
|
|
@@ -37163,6 +37170,28 @@ var unitlessKeys$1 = {
|
|
|
37163
37170
|
|
|
37164
37171
|
var f="undefined"!=typeof process&&void 0!==process.env&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",m="active",y="data-styled-version",v="6.1.8",g="/*!sc*/\n",S="undefined"!=typeof window&&"HTMLElement"in window,w=Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&""!==process.env.REACT_APP_SC_DISABLE_SPEEDY?"false"!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&process.env.REACT_APP_SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.SC_DISABLE_SPEEDY&&""!==process.env.SC_DISABLE_SPEEDY?"false"!==process.env.SC_DISABLE_SPEEDY&&process.env.SC_DISABLE_SPEEDY:"production"!==process.env.NODE_ENV),E=/invalid hook call/i,N=new Set,P=function(t,n){if("production"!==process.env.NODE_ENV){var o=n?' with the id of "'.concat(n,'"'):"",s="The component ".concat(t).concat(o," has been created dynamically.\n")+"You may see this warning because you've called styled inside another component.\nTo resolve this only create new StyledComponents outside of any render method and function component.",i=console.error;try{var a=!0;console.error=function(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];E.test(t)?(a=!1,N.delete(s)):i.apply(void 0,__spreadArray([t],n,!1));},React.useRef(),a&&!N.has(s)&&(console.warn(s),N.add(s));}catch(e){E.test(e.message)&&N.delete(s);}finally{console.error=i;}}},_=Object.freeze([]),C=Object.freeze({});function I(e,t,n){return void 0===n&&(n=C),e.theme!==n.theme&&e.theme||t||n.theme}var A=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),O=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,D=/(^-|-$)/g;function R(e){return e.replace(O,"-").replace(D,"")}var T=/(a)(d)/gi,k=52,j=function(e){return String.fromCharCode(e+(e>25?39:97))};function x(e){var t,n="";for(t=Math.abs(e);t>k;t=t/k|0)n=j(t%k)+n;return (j(t%k)+n).replace(T,"$1-$2")}var V,F=5381,M=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},$=function(e){return M(F,e)};function z(e){return x($(e)>>>0)}function B(e){return "production"!==process.env.NODE_ENV&&"string"==typeof e&&e||e.displayName||e.name||"Component"}function L(e){return "string"==typeof e&&("production"===process.env.NODE_ENV||e.charAt(0)===e.charAt(0).toLowerCase())}var G="function"==typeof Symbol&&Symbol.for,Y=G?Symbol.for("react.memo"):60115,W=G?Symbol.for("react.forward_ref"):60112,q={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},H={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},U={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},J=((V={})[W]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},V[Y]=U,V);function X(e){return ("type"in(t=e)&&t.type.$$typeof)===Y?U:"$$typeof"in e?J[e.$$typeof]:q;var t;}var Z=Object.defineProperty,K=Object.getOwnPropertyNames,Q=Object.getOwnPropertySymbols,ee=Object.getOwnPropertyDescriptor,te=Object.getPrototypeOf,ne=Object.prototype;function oe(e,t,n){if("string"!=typeof t){if(ne){var o=te(t);o&&o!==ne&&oe(e,o,n);}var r=K(t);Q&&(r=r.concat(Q(t)));for(var s=X(e),i=X(t),a=0;a<r.length;++a){var c=r[a];if(!(c in H||n&&n[c]||i&&c in i||s&&c in s)){var l=ee(t,c);try{Z(e,c,l);}catch(e){}}}}return e}function re(e){return "function"==typeof e}function se(e){return "object"==typeof e&&"styledComponentId"in e}function ie(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function ae(e,t){if(0===e.length)return "";for(var n=e[0],o=1;o<e.length;o++)n+=t?t+e[o]:e[o];return n}function ce(e){return null!==e&&"object"==typeof e&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function le(e,t,n){if(void 0===n&&(n=!1),!n&&!ce(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var o=0;o<t.length;o++)e[o]=le(e[o],t[o]);else if(ce(t))for(var o in t)e[o]=le(e[o],t[o]);return e}function ue(e,t){Object.defineProperty(e,"toString",{value:t});}var pe="production"!==process.env.NODE_ENV?{1:"Cannot create styled-component for component: %s.\n\n",2:"Can't collect styles once you've consumed a `ServerStyleSheet`'s styles! `ServerStyleSheet` is a one off instance for each server-side render cycle.\n\n- Are you trying to reuse it across renders?\n- Are you accidentally calling collectStyles twice?\n\n",3:"Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.\n\n",4:"The `StyleSheetManager` expects a valid target or sheet prop!\n\n- Does this error occur on the client and is your target falsy?\n- Does this error occur on the server and is the sheet falsy?\n\n",5:"The clone method cannot be used on the client!\n\n- Are you running in a client-like environment on the server?\n- Are you trying to run SSR on the client?\n\n",6:"Trying to insert a new style tag, but the given Node is unmounted!\n\n- Are you using a custom target that isn't mounted?\n- Does your document not have a valid head element?\n- Have you accidentally removed a style tag manually?\n\n",7:'ThemeProvider: Please return an object from your "theme" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n',8:'ThemeProvider: Please make your "theme" prop an object.\n\n',9:"Missing document `<head>`\n\n",10:"Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021\n\n",11:"_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.\n\n",12:"It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\`\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\n\n",13:"%s is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.\n\n",14:'ThemeProvider: "theme" prop is required.\n\n',15:"A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to `<StyleSheetManager stylisPlugins={[]}>`, please make sure each plugin is uniquely-named, e.g.\n\n```js\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\n```\n\n",16:"Reached the limit of how many styled components may be created at group %s.\nYou may only create up to 1,073,741,824 components. If you're creating components dynamically,\nas for instance in your render method then you may be running into this limitation.\n\n",17:"CSSStyleSheet could not be found on HTMLStyleElement.\nHas styled-components' style tag been unmounted or altered by another script?\n",18:"ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`"}:{};function de(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=e[0],o=[],r=1,s=e.length;r<s;r+=1)o.push(e[r]);return o.forEach(function(e){n=n.replace(/%[a-z]/,e);}),n}function he(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];return "production"===process.env.NODE_ENV?new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(t," for more information.").concat(n.length>0?" Args: ".concat(n.join(", ")):"")):new Error(de.apply(void 0,__spreadArray([pe[t]],n,!1)).trim())}var fe=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e;}return e.prototype.indexOfGroup=function(e){for(var t=0,n=0;n<e;n++)t+=this.groupSizes[n];return t},e.prototype.insertRules=function(e,t){if(e>=this.groupSizes.length){for(var n=this.groupSizes,o=n.length,r=o;e>=r;)if((r<<=1)<0)throw he(16,"".concat(e));this.groupSizes=new Uint32Array(r),this.groupSizes.set(n),this.length=r;for(var s=o;s<r;s++)this.groupSizes[s]=0;}for(var i=this.indexOfGroup(e+1),a=(s=0,t.length);s<a;s++)this.tag.insertRule(i,t[s])&&(this.groupSizes[e]++,i++);},e.prototype.clearGroup=function(e){if(e<this.length){var t=this.groupSizes[e],n=this.indexOfGroup(e),o=n+t;this.groupSizes[e]=0;for(var r=n;r<o;r++)this.tag.deleteRule(n);}},e.prototype.getGroup=function(e){var t="";if(e>=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],o=this.indexOfGroup(e),r=o+n,s=o;s<r;s++)t+="".concat(this.tag.getRule(s)).concat(g);return t},e}(),me=new Map,ye=new Map,ve=1,ge=function(e){if(me.has(e))return me.get(e);for(;ye.has(ve);)ve++;var t=ve++;if("production"!==process.env.NODE_ENV&&((0|t)<0||t>1073741824))throw he(16,"".concat(t));return me.set(e,t),ye.set(t,e),t},Se=function(e,t){ve=t+1,me.set(e,t),ye.set(t,e);},we="style[".concat(f,"][").concat(y,'="').concat(v,'"]'),be=new RegExp("^".concat(f,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),Ee=function(e,t,n){for(var o,r=n.split(","),s=0,i=r.length;s<i;s++)(o=r[s])&&e.registerName(t,o);},Ne=function(e,t){for(var n,o=(null!==(n=t.textContent)&&void 0!==n?n:"").split(g),r=[],s=0,i=o.length;s<i;s++){var a=o[s].trim();if(a){var c=a.match(be);if(c){var l=0|parseInt(c[1],10),u=c[2];0!==l&&(Se(u,l),Ee(e,u,c[3]),e.getTag().insertRules(l,r)),r.length=0;}else r.push(a);}}};function Pe(){return "undefined"!=typeof __webpack_nonce__?__webpack_nonce__:null}var _e=function(e){var t=document.head,n=e||t,o=document.createElement("style"),r=function(e){var t=Array.from(e.querySelectorAll("style[".concat(f,"]")));return t[t.length-1]}(n),s=void 0!==r?r.nextSibling:null;o.setAttribute(f,m),o.setAttribute(y,v);var i=Pe();return i&&o.setAttribute("nonce",i),n.insertBefore(o,s),o},Ce=function(){function e(e){this.element=_e(e),this.element.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,o=t.length;n<o;n++){var r=t[n];if(r.ownerNode===e)return r}throw he(17)}(this.element),this.length=0;}return e.prototype.insertRule=function(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(e){return !1}},e.prototype.deleteRule=function(e){this.sheet.deleteRule(e),this.length--;},e.prototype.getRule=function(e){var t=this.sheet.cssRules[e];return t&&t.cssText?t.cssText:""},e}(),Ie=function(){function e(e){this.element=_e(e),this.nodes=this.element.childNodes,this.length=0;}return e.prototype.insertRule=function(e,t){if(e<=this.length&&e>=0){var n=document.createTextNode(t);return this.element.insertBefore(n,this.nodes[e]||null),this.length++,!0}return !1},e.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--;},e.prototype.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},e}(),Ae=function(){function e(e){this.rules=[],this.length=0;}return e.prototype.insertRule=function(e,t){return e<=this.length&&(this.rules.splice(e,0,t),this.length++,!0)},e.prototype.deleteRule=function(e){this.rules.splice(e,1),this.length--;},e.prototype.getRule=function(e){return e<this.length?this.rules[e]:""},e}(),Oe=S,De={isServer:!S,useCSSOMInjection:!w},Re=function(){function e(e,n,o){void 0===e&&(e=C),void 0===n&&(n={});var r=this;this.options=__assign(__assign({},De),e),this.gs=n,this.names=new Map(o),this.server=!!e.isServer,!this.server&&S&&Oe&&(Oe=!1,function(e){for(var t=document.querySelectorAll(we),n=0,o=t.length;n<o;n++){var r=t[n];r&&r.getAttribute(f)!==m&&(Ne(e,r),r.parentNode&&r.parentNode.removeChild(r));}}(this)),ue(this,function(){return function(e){for(var t=e.getTag(),n=t.length,o="",r=function(n){var r=function(e){return ye.get(e)}(n);if(void 0===r)return "continue";var s=e.names.get(r),i=t.getGroup(n);if(void 0===s||0===i.length)return "continue";var a="".concat(f,".g").concat(n,'[id="').concat(r,'"]'),c="";void 0!==s&&s.forEach(function(e){e.length>0&&(c+="".concat(e,","));}),o+="".concat(i).concat(a,'{content:"').concat(c,'"}').concat(g);},s=0;s<n;s++)r(s);return o}(r)});}return e.registerId=function(e){return ge(e)},e.prototype.reconstructWithOptions=function(n,o){return void 0===o&&(o=!0),new e(__assign(__assign({},this.options),n),this.gs,o&&this.names||void 0)},e.prototype.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},e.prototype.getTag=function(){return this.tag||(this.tag=(e=function(e){var t=e.useCSSOMInjection,n=e.target;return e.isServer?new Ae(n):t?new Ce(n):new Ie(n)}(this.options),new fe(e)));var e;},e.prototype.hasNameForId=function(e,t){return this.names.has(e)&&this.names.get(e).has(t)},e.prototype.registerName=function(e,t){if(ge(e),this.names.has(e))this.names.get(e).add(t);else {var n=new Set;n.add(t),this.names.set(e,n);}},e.prototype.insertRules=function(e,t,n){this.registerName(e,t),this.getTag().insertRules(ge(e),n);},e.prototype.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear();},e.prototype.clearRules=function(e){this.getTag().clearGroup(ge(e)),this.clearNames(e);},e.prototype.clearTag=function(){this.tag=void 0;},e}(),Te=/&/g,ke=/^\s*\/\/.*$/gm;function je(e,t){return e.map(function(e){return "rule"===e.type&&(e.value="".concat(t," ").concat(e.value),e.value=e.value.replaceAll(",",",".concat(t," ")),e.props=e.props.map(function(e){return "".concat(t," ").concat(e)})),Array.isArray(e.children)&&"@keyframes"!==e.type&&(e.children=je(e.children,t)),e})}function xe(e){var t,n,o,r=void 0===e?C:e,s=r.options,i=void 0===s?C:s,a=r.plugins,c=void 0===a?_:a,l=function(e,o,r){return r.startsWith(n)&&r.endsWith(n)&&r.replaceAll(n,"").length>0?".".concat(t):e},u=c.slice();u.push(function(e){e.type===RULESET$1&&e.value.includes("&")&&(e.props[0]=e.props[0].replace(Te,n).replace(o,l));}),i.prefix&&u.push(prefixer$1),u.push(stringify$1);var p=function(e,r,s,a){void 0===r&&(r=""),void 0===s&&(s=""),void 0===a&&(a="&"),t=a,n=r,o=new RegExp("\\".concat(n,"\\b"),"g");var c=e.replace(ke,""),l=compile$1(s||r?"".concat(s," ").concat(r," { ").concat(c," }"):c);i.namespace&&(l=je(l,i.namespace));var p=[];return serialize$1(l,middleware$1(u.concat(rulesheet$1(function(e){return p.push(e)})))),p};return p.hash=c.length?c.reduce(function(e,t){return t.name||he(15),M(e,t.name)},F).toString():"",p}var Ve=new Re,Fe=xe(),Me=React.createContext({shouldForwardProp:void 0,styleSheet:Ve,stylis:Fe});Me.Consumer;React.createContext(void 0);function Be(){return React.useContext(Me)}var Ge=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=Fe);var o=n.name+t.hash;e.hasNameForId(n.id,o)||e.insertRules(n.id,o,t(n.rules,o,"@keyframes"));},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=t,ue(this,function(){throw he(12,String(n.name))});}return e.prototype.getName=function(e){return void 0===e&&(e=Fe),this.name+e.hash},e}(),Ye=function(e){return e>="A"&&e<="Z"};function We(e){for(var t="",n=0;n<e.length;n++){var o=e[n];if(1===n&&"-"===o&&"-"===e[0])return e;Ye(o)?t+="-"+o.toLowerCase():t+=o;}return t.startsWith("ms-")?"-"+t:t}var qe=function(e){return null==e||!1===e||""===e},He=function(t){var n,o,r=[];for(var s in t){var i=t[s];t.hasOwnProperty(s)&&!qe(i)&&(Array.isArray(i)&&i.isCss||re(i)?r.push("".concat(We(s),":"),i,";"):ce(i)?r.push.apply(r,__spreadArray(__spreadArray(["".concat(s," {")],He(i),!1),["}"],!1)):r.push("".concat(We(s),": ").concat((n=s,null==(o=i)||"boolean"==typeof o||""===o?"":"number"!=typeof o||0===o||n in unitlessKeys$1||n.startsWith("--")?String(o).trim():"".concat(o,"px")),";")));}return r};function Ue(e,t,n,o){if(qe(e))return [];if(se(e))return [".".concat(e.styledComponentId)];if(re(e)){if(!re(s=e)||s.prototype&&s.prototype.isReactComponent||!t)return [e];var r=e(t);return "production"===process.env.NODE_ENV||"object"!=typeof r||Array.isArray(r)||r instanceof Ge||ce(r)||null===r||console.error("".concat(B(e)," is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.")),Ue(r,t,n,o)}var s;return e instanceof Ge?n?(e.inject(n,o),[e.getName(o)]):[e]:ce(e)?He(e):Array.isArray(e)?Array.prototype.concat.apply(_,e.map(function(e){return Ue(e,t,n,o)})):[e.toString()]}function Je(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(re(n)&&!se(n))return !1}return !0}var Xe=$(v),Ze=function(){function e(e,t,n){this.rules=e,this.staticRulesId="",this.isStatic="production"===process.env.NODE_ENV&&(void 0===n||n.isStatic)&&Je(e),this.componentId=t,this.baseHash=M(Xe,t),this.baseStyle=n,Re.registerId(t);}return e.prototype.generateAndInjectStyles=function(e,t,n){var o=this.baseStyle?this.baseStyle.generateAndInjectStyles(e,t,n):"";if(this.isStatic&&!n.hash)if(this.staticRulesId&&t.hasNameForId(this.componentId,this.staticRulesId))o=ie(o,this.staticRulesId);else {var r=ae(Ue(this.rules,e,t,n)),s=x(M(this.baseHash,r)>>>0);if(!t.hasNameForId(this.componentId,s)){var i=n(r,".".concat(s),void 0,this.componentId);t.insertRules(this.componentId,s,i);}o=ie(o,s),this.staticRulesId=s;}else {for(var a=M(this.baseHash,n.hash),c="",l=0;l<this.rules.length;l++){var u=this.rules[l];if("string"==typeof u)c+=u,"production"!==process.env.NODE_ENV&&(a=M(a,u));else if(u){var p=ae(Ue(u,e,t,n));a=M(a,p+l),c+=p;}}if(c){var d=x(a>>>0);t.hasNameForId(this.componentId,d)||t.insertRules(this.componentId,d,n(c,".".concat(d),void 0,this.componentId)),o=ie(o,d);}}return o},e}(),Ke=React.createContext(void 0);Ke.Consumer;var nt={},ot=new Set;function rt(e,r,s){var i=se(e),a=e,c=!L(e),p=r.attrs,d=void 0===p?_:p,h=r.componentId,f=void 0===h?function(e,t){var n="string"!=typeof e?"sc":R(e);nt[n]=(nt[n]||0)+1;var o="".concat(n,"-").concat(z(v+n+nt[n]));return t?"".concat(t,"-").concat(o):o}(r.displayName,r.parentComponentId):h,m=r.displayName,y=void 0===m?function(e){return L(e)?"styled.".concat(e):"Styled(".concat(B(e),")")}(e):m,g=r.displayName&&r.componentId?"".concat(R(r.displayName),"-").concat(r.componentId):r.componentId||f,S=i&&a.attrs?a.attrs.concat(d).filter(Boolean):d,w=r.shouldForwardProp;if(i&&a.shouldForwardProp){var b=a.shouldForwardProp;if(r.shouldForwardProp){var E=r.shouldForwardProp;w=function(e,t){return b(e,t)&&E(e,t)};}else w=b;}var N=new Ze(s,g,i?a.componentStyle:void 0);function O(e,r){return function(e,r,s){var i=e.attrs,a=e.componentStyle,c=e.defaultProps,p=e.foldedComponentIds,d=e.styledComponentId,h=e.target,f=React.useContext(Ke),m=Be(),y=e.shouldForwardProp||m.shouldForwardProp;"production"!==process.env.NODE_ENV&&React.useDebugValue(d);var v=I(r,f,c)||C,g=function(e,n,o){for(var r,s=__assign(__assign({},n),{className:void 0,theme:o}),i=0;i<e.length;i+=1){var a=re(r=e[i])?r(s):r;for(var c in a)s[c]="className"===c?ie(s[c],a[c]):"style"===c?__assign(__assign({},s[c]),a[c]):a[c];}return n.className&&(s.className=ie(s.className,n.className)),s}(i,r,v),S=g.as||h,w={};for(var b in g)void 0===g[b]||"$"===b[0]||"as"===b||"theme"===b&&g.theme===v||("forwardedAs"===b?w.as=g.forwardedAs:y&&!y(b,S)||(w[b]=g[b],y||"development"!==process.env.NODE_ENV||isPropValid$1(b)||ot.has(b)||!A.has(S)||(ot.add(b),console.warn('styled-components: it looks like an unknown prop "'.concat(b,'" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));var E=function(e,t){var n=Be(),o=e.generateAndInjectStyles(t,n.styleSheet,n.stylis);return "production"!==process.env.NODE_ENV&&React.useDebugValue(o),o}(a,g);"production"!==process.env.NODE_ENV&&e.warnTooManyClasses&&e.warnTooManyClasses(E);var N=ie(p,d);return E&&(N+=" "+E),g.className&&(N+=" "+g.className),w[L(S)&&!A.has(S)?"class":"className"]=N,w.ref=s,React.createElement(S,w)}(D,e,r)}O.displayName=y;var D=React.forwardRef(O);return D.attrs=S,D.componentStyle=N,D.displayName=y,D.shouldForwardProp=w,D.foldedComponentIds=i?ie(a.foldedComponentIds,a.styledComponentId):"",D.styledComponentId=g,D.target=i?a.target:e,Object.defineProperty(D,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(e){this._foldedDefaultProps=i?function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var o=0,r=t;o<r.length;o++)le(e,r[o],!0);return e}({},a.defaultProps,e):e;}}),"production"!==process.env.NODE_ENV&&(P(y,g),D.warnTooManyClasses=function(e,t){var n={},o=!1;return function(r){if(!o&&(n[r]=!0,Object.keys(n).length>=200)){var s=t?' with the id of "'.concat(t,'"'):"";console.warn("Over ".concat(200," classes were generated for component ").concat(e).concat(s,".\n")+"Consider using the attrs method, together with a style object for frequently changed styles.\nExample:\n const Component = styled.div.attrs(props => ({\n style: {\n background: props.background,\n },\n }))`width: 100%;`\n\n <Component />"),o=!0,n={};}}}(y,g)),ue(D,function(){return ".".concat(D.styledComponentId)}),c&&oe(D,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),D}function st(e,t){for(var n=[e[0]],o=0,r=t.length;o<r;o+=1)n.push(t[o],e[o+1]);return n}var it=function(e){return Object.assign(e,{isCss:!0})};function at(t){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];if(re(t)||ce(t))return it(Ue(st(_,__spreadArray([t],n,!0))));var r=t;return 0===n.length&&1===r.length&&"string"==typeof r[0]?Ue(r):it(Ue(st(r,n)))}function ct(n,o,r){if(void 0===r&&(r=C),!o)throw he(1,o);var s=function(t){for(var s=[],i=1;i<arguments.length;i++)s[i-1]=arguments[i];return n(o,r,at.apply(void 0,__spreadArray([t],s,!1)))};return s.attrs=function(e){return ct(n,o,__assign(__assign({},r),{attrs:Array.prototype.concat(r.attrs,e).filter(Boolean)}))},s.withConfig=function(e){return ct(n,o,__assign(__assign({},r),e))},s}var lt=function(e){return ct(rt,e)},ut=lt;A.forEach(function(e){ut[e]=lt(e);});"production"!==process.env.NODE_ENV&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product&&console.warn("It looks like you've imported 'styled-components' on React Native.\nPerhaps you're looking to import 'styled-components/native'?\nRead more about this at https://www.styled-components.com/docs/basics#react-native");var vt="__sc-".concat(f,"__");"production"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV&&"undefined"!=typeof window&&(window[vt]||(window[vt]=0),1===window[vt]&&console.warn("It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.\n\nSee https://s-c.sh/2BAXzed for more info."),window[vt]+=1);
|
|
37165
37172
|
|
|
37173
|
+
var _templateObject$2;
|
|
37174
|
+
var StandardContainer$1 = ut.section(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteral(["\n margin: 0 auto;\n min-width: 400px;\n\n @media (min-width: 768px) {\n max-width: 66.6667%; /* 8/12 */\n }\n\n @media (min-width: 992px) {\n max-width: 50%; /* 6/12 */\n }\n\n @media (min-width: 1200px) {\n max-width: 41.6667%; /* 5/12 */\n }\n"])));
|
|
37175
|
+
var Card = function Card(_ref) {
|
|
37176
|
+
var children = _ref.children;
|
|
37177
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StandardContainer$1, null, /*#__PURE__*/React.createElement("section", {
|
|
37178
|
+
style: {
|
|
37179
|
+
border: '1px solid #f2f2f2',
|
|
37180
|
+
borderRadius: '8px',
|
|
37181
|
+
padding: '2.25rem',
|
|
37182
|
+
boxShadow: '0 .75rem 6rem rgba(56, 65, 74, 0.03)',
|
|
37183
|
+
background: '#FFFFFF'
|
|
37184
|
+
},
|
|
37185
|
+
className: "veripass"
|
|
37186
|
+
}, children)));
|
|
37187
|
+
};
|
|
37188
|
+
|
|
37189
|
+
var _templateObject$1;
|
|
37190
|
+
var StandardContainer = ut.section(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["\n margin: 0 auto;\n min-width: 400px;\n\n @media (min-width: 768px) {\n max-width: 66.6667%; /* 8/12 */\n }\n\n @media (min-width: 992px) {\n max-width: 50%; /* 6/12 */\n }\n\n @media (min-width: 1200px) {\n max-width: 41.6667%; /* 5/12 */\n }\n"])));
|
|
37191
|
+
|
|
37192
|
+
var _templateObject;
|
|
37193
|
+
var KarlaTypography = ut.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-family: 'Karla', 'Roboto', sans-serif !important;\n font-weight: 600;\n"])));
|
|
37194
|
+
|
|
37166
37195
|
const common = {
|
|
37167
37196
|
black: '#000',
|
|
37168
37197
|
white: '#fff'
|
|
@@ -62193,11 +62222,8 @@ var SecurityService = /*#__PURE__*/function (_BaseApi) {
|
|
|
62193
62222
|
}]);
|
|
62194
62223
|
}(BaseApi);
|
|
62195
62224
|
|
|
62196
|
-
var
|
|
62197
|
-
var
|
|
62198
|
-
var KarlaTypography$1 = ut.span(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteral(["\n font-family: 'Karla', 'Roboto', sans-serif !important;\n font-weight: 600;\n"])));
|
|
62199
|
-
var swal = withReactContent(Swal);
|
|
62200
|
-
var statusCodeMessages = {
|
|
62225
|
+
var swal$3 = withReactContent(Swal);
|
|
62226
|
+
var statusCodeMessages$3 = {
|
|
62201
62227
|
461: 'The data provided does not match any registered application',
|
|
62202
62228
|
462: 'Unauthorized user. After 3 failed attempts, your account will be locked for 24 hours.',
|
|
62203
62229
|
463: 'The user is not registered in this application, needs to register',
|
|
@@ -62205,11 +62231,11 @@ var statusCodeMessages = {
|
|
|
62205
62231
|
465: 'API key is missing or invalid',
|
|
62206
62232
|
401: 'Error authenticating'
|
|
62207
62233
|
};
|
|
62208
|
-
function signInStandard(_x) {
|
|
62209
|
-
return _signInStandard.apply(this, arguments);
|
|
62234
|
+
function signInStandard$2(_x) {
|
|
62235
|
+
return _signInStandard$2.apply(this, arguments);
|
|
62210
62236
|
}
|
|
62211
|
-
function _signInStandard() {
|
|
62212
|
-
_signInStandard = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
|
|
62237
|
+
function _signInStandard$2() {
|
|
62238
|
+
_signInStandard$2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
|
|
62213
62239
|
var payload, authProvider, redirectUrl, apiKey, debug, entityService, entityResponse;
|
|
62214
62240
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
62215
62241
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -62230,9 +62256,9 @@ function _signInStandard() {
|
|
|
62230
62256
|
break;
|
|
62231
62257
|
}
|
|
62232
62258
|
_context2.next = 8;
|
|
62233
|
-
return swal.fire({
|
|
62259
|
+
return swal$3.fire({
|
|
62234
62260
|
title: 'Sign-in error',
|
|
62235
|
-
text: statusCodeMessages[entityResponse.status] || 'An error occurred',
|
|
62261
|
+
text: statusCodeMessages$3[entityResponse.status] || 'An error occurred',
|
|
62236
62262
|
icon: 'error'
|
|
62237
62263
|
});
|
|
62238
62264
|
case 8:
|
|
@@ -62248,14 +62274,15 @@ function _signInStandard() {
|
|
|
62248
62274
|
}
|
|
62249
62275
|
}, _callee2);
|
|
62250
62276
|
}));
|
|
62251
|
-
return _signInStandard.apply(this, arguments);
|
|
62277
|
+
return _signInStandard$2.apply(this, arguments);
|
|
62252
62278
|
}
|
|
62253
62279
|
var VeripassStandardSignin = function VeripassStandardSignin(_ref2) {
|
|
62254
62280
|
var _window;
|
|
62255
|
-
var _ref2$
|
|
62256
|
-
|
|
62257
|
-
|
|
62258
|
-
|
|
62281
|
+
var _ref2$organization = _ref2.organization,
|
|
62282
|
+
organization = _ref2$organization === void 0 ? {
|
|
62283
|
+
logoSrc: '',
|
|
62284
|
+
slogan: ''
|
|
62285
|
+
} : _ref2$organization,
|
|
62259
62286
|
_ref2$redirectUrl = _ref2.redirectUrl,
|
|
62260
62287
|
redirectUrl = _ref2$redirectUrl === void 0 ? '' : _ref2$redirectUrl,
|
|
62261
62288
|
_ref2$debug = _ref2.debug,
|
|
@@ -62328,7 +62355,7 @@ var VeripassStandardSignin = function VeripassStandardSignin(_ref2) {
|
|
|
62328
62355
|
break;
|
|
62329
62356
|
}
|
|
62330
62357
|
_context.next = 6;
|
|
62331
|
-
return swal.fire({
|
|
62358
|
+
return swal$3.fire({
|
|
62332
62359
|
title: 'Error entering',
|
|
62333
62360
|
text: 'Please enter an email.',
|
|
62334
62361
|
icon: 'error'
|
|
@@ -62341,7 +62368,7 @@ var VeripassStandardSignin = function VeripassStandardSignin(_ref2) {
|
|
|
62341
62368
|
break;
|
|
62342
62369
|
}
|
|
62343
62370
|
_context.next = 10;
|
|
62344
|
-
return swal.fire({
|
|
62371
|
+
return swal$3.fire({
|
|
62345
62372
|
title: 'Error entering',
|
|
62346
62373
|
text: 'Please enter a password.',
|
|
62347
62374
|
icon: 'error'
|
|
@@ -62350,7 +62377,7 @@ var VeripassStandardSignin = function VeripassStandardSignin(_ref2) {
|
|
|
62350
62377
|
return _context.abrupt("return");
|
|
62351
62378
|
case 11:
|
|
62352
62379
|
_context.next = 13;
|
|
62353
|
-
return signInStandard({
|
|
62380
|
+
return signInStandard$2({
|
|
62354
62381
|
payload: {
|
|
62355
62382
|
email: email,
|
|
62356
62383
|
password: password
|
|
@@ -62387,16 +62414,14 @@ var VeripassStandardSignin = function VeripassStandardSignin(_ref2) {
|
|
|
62387
62414
|
React.useEffect(function () {
|
|
62388
62415
|
initializeComponent();
|
|
62389
62416
|
}, []);
|
|
62390
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(
|
|
62391
|
-
className: "veripass"
|
|
62392
|
-
}, /*#__PURE__*/React.createElement("header", {
|
|
62417
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StandardContainer, null, /*#__PURE__*/React.createElement("header", {
|
|
62393
62418
|
style: {
|
|
62394
62419
|
textAlign: 'center'
|
|
62395
62420
|
}
|
|
62396
62421
|
}, /*#__PURE__*/React.createElement("a", {
|
|
62397
62422
|
href: "/"
|
|
62398
62423
|
}, /*#__PURE__*/React.createElement("img", {
|
|
62399
|
-
src:
|
|
62424
|
+
src: organization === null || organization === void 0 ? void 0 : organization.logoSrc,
|
|
62400
62425
|
alt: "",
|
|
62401
62426
|
height: "75",
|
|
62402
62427
|
style: {
|
|
@@ -62411,20 +62436,12 @@ var VeripassStandardSignin = function VeripassStandardSignin(_ref2) {
|
|
|
62411
62436
|
color: '#98a6ad',
|
|
62412
62437
|
fontWeight: 300
|
|
62413
62438
|
}
|
|
62414
|
-
},
|
|
62415
|
-
style: {
|
|
62416
|
-
border: '1px solid #f2f2f2',
|
|
62417
|
-
borderRadius: '8px',
|
|
62418
|
-
padding: '2.25rem',
|
|
62419
|
-
boxShadow: '0 .75rem 6rem rgba(56, 65, 74, 0.03)',
|
|
62420
|
-
background: '#FFFFFF'
|
|
62421
|
-
}
|
|
62422
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
62439
|
+
}, organization === null || organization === void 0 ? void 0 : organization.slogan)), /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement("div", {
|
|
62423
62440
|
style: {
|
|
62424
62441
|
textAlign: 'center',
|
|
62425
62442
|
marginBottom: '32px'
|
|
62426
62443
|
}
|
|
62427
|
-
}, /*#__PURE__*/React.createElement(KarlaTypography
|
|
62444
|
+
}, /*#__PURE__*/React.createElement(KarlaTypography, {
|
|
62428
62445
|
style: {
|
|
62429
62446
|
color: '#343a40'
|
|
62430
62447
|
}
|
|
@@ -62540,9 +62557,6 @@ var VeripassStandardSignin = function VeripassStandardSignin(_ref2) {
|
|
|
62540
62557
|
}), isLoading ? 'Loading...' : 'Log in'))))));
|
|
62541
62558
|
};
|
|
62542
62559
|
|
|
62543
|
-
var _templateObject, _templateObject2;
|
|
62544
|
-
var StandarSigninContainer = ut.section(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin: 0 auto;\n min-width: 400px;\n\n @media (min-width: 768px) {\n max-width: 66.6667%; /* 8/12 */\n }\n\n @media (min-width: 992px) {\n max-width: 50%; /* 6/12 */\n }\n\n @media (min-width: 1200px) {\n max-width: 41.6667%; /* 5/12 */\n }\n"])));
|
|
62545
|
-
var KarlaTypography = ut.span(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n font-family: 'Karla', 'Roboto', sans-serif !important;\n font-weight: 600;\n"])));
|
|
62546
62560
|
var VeripassLogoutSuccess = function VeripassLogoutSuccess(_ref) {
|
|
62547
62561
|
var _ref$organization = _ref.organization,
|
|
62548
62562
|
organization = _ref$organization === void 0 ? {
|
|
@@ -62561,16 +62575,7 @@ var VeripassLogoutSuccess = function VeripassLogoutSuccess(_ref) {
|
|
|
62561
62575
|
React.useEffect(function () {
|
|
62562
62576
|
authProvider.logout();
|
|
62563
62577
|
}, []);
|
|
62564
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(
|
|
62565
|
-
style: {
|
|
62566
|
-
border: '1px solid #f2f2f2',
|
|
62567
|
-
borderRadius: '8px',
|
|
62568
|
-
padding: '2.25rem',
|
|
62569
|
-
boxShadow: '0 .75rem 6rem rgba(56, 65, 74, 0.03)',
|
|
62570
|
-
background: '#FFFFFF'
|
|
62571
|
-
},
|
|
62572
|
-
className: "veripass"
|
|
62573
|
-
}, /*#__PURE__*/React.createElement("header", {
|
|
62578
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StandardContainer, null, /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement("header", {
|
|
62574
62579
|
style: {
|
|
62575
62580
|
textAlign: 'center'
|
|
62576
62581
|
}
|
|
@@ -62656,10 +62661,837 @@ var VeripassLogoutSuccess = function VeripassLogoutSuccess(_ref) {
|
|
|
62656
62661
|
}, /*#__PURE__*/React.createElement("b", null, texts === null || texts === void 0 ? void 0 : texts.signinText)))))));
|
|
62657
62662
|
};
|
|
62658
62663
|
|
|
62664
|
+
var swal$2 = withReactContent(Swal);
|
|
62665
|
+
var statusCodeMessages$2 = {
|
|
62666
|
+
461: 'The data provided does not match any registered application',
|
|
62667
|
+
462: 'Unauthorized user. After 3 failed attempts, your account will be locked for 24 hours.',
|
|
62668
|
+
463: 'The user is not registered in this application, needs to register',
|
|
62669
|
+
464: 'Unauthorized. After 3 failed attempts, your account will be locked for 24 hours.',
|
|
62670
|
+
465: 'API key is missing or invalid',
|
|
62671
|
+
401: 'Error authenticating'
|
|
62672
|
+
};
|
|
62673
|
+
function signInStandard$1(_x) {
|
|
62674
|
+
return _signInStandard$1.apply(this, arguments);
|
|
62675
|
+
}
|
|
62676
|
+
function _signInStandard$1() {
|
|
62677
|
+
_signInStandard$1 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
|
|
62678
|
+
var payload, authProvider, redirectUrl, apiKey, debug, entityService, entityResponse;
|
|
62679
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
62680
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
62681
|
+
case 0:
|
|
62682
|
+
payload = _ref.payload, authProvider = _ref.authProvider, redirectUrl = _ref.redirectUrl, apiKey = _ref.apiKey, debug = _ref.debug;
|
|
62683
|
+
entityService = new SecurityService({
|
|
62684
|
+
apiKey: apiKey,
|
|
62685
|
+
settings: {
|
|
62686
|
+
debug: debug
|
|
62687
|
+
}
|
|
62688
|
+
});
|
|
62689
|
+
_context2.next = 4;
|
|
62690
|
+
return entityService.signInStandard(payload);
|
|
62691
|
+
case 4:
|
|
62692
|
+
entityResponse = _context2.sent;
|
|
62693
|
+
if (!(!entityResponse || !entityResponse.result)) {
|
|
62694
|
+
_context2.next = 9;
|
|
62695
|
+
break;
|
|
62696
|
+
}
|
|
62697
|
+
_context2.next = 8;
|
|
62698
|
+
return swal$2.fire({
|
|
62699
|
+
title: 'Sign-in error',
|
|
62700
|
+
text: statusCodeMessages$2[entityResponse.status] || 'An error occurred',
|
|
62701
|
+
icon: 'error'
|
|
62702
|
+
});
|
|
62703
|
+
case 8:
|
|
62704
|
+
return _context2.abrupt("return");
|
|
62705
|
+
case 9:
|
|
62706
|
+
authProvider.login({
|
|
62707
|
+
user: entityResponse.result || {},
|
|
62708
|
+
redirectUrl: redirectUrl
|
|
62709
|
+
});
|
|
62710
|
+
case 10:
|
|
62711
|
+
case "end":
|
|
62712
|
+
return _context2.stop();
|
|
62713
|
+
}
|
|
62714
|
+
}, _callee2);
|
|
62715
|
+
}));
|
|
62716
|
+
return _signInStandard$1.apply(this, arguments);
|
|
62717
|
+
}
|
|
62718
|
+
var VeripassStandardRecoverPassword = function VeripassStandardRecoverPassword(_ref2) {
|
|
62719
|
+
var _window;
|
|
62720
|
+
var _ref2$organization = _ref2.organization,
|
|
62721
|
+
organization = _ref2$organization === void 0 ? {
|
|
62722
|
+
logoSrc: '',
|
|
62723
|
+
slogan: ''
|
|
62724
|
+
} : _ref2$organization,
|
|
62725
|
+
_ref2$redirectUrl = _ref2.redirectUrl,
|
|
62726
|
+
redirectUrl = _ref2$redirectUrl === void 0 ? '' : _ref2$redirectUrl,
|
|
62727
|
+
_ref2$debug = _ref2.debug,
|
|
62728
|
+
debug = _ref2$debug === void 0 ? false : _ref2$debug,
|
|
62729
|
+
_ref2$apiKey = _ref2.apiKey,
|
|
62730
|
+
apiKey = _ref2$apiKey === void 0 ? '' : _ref2$apiKey;
|
|
62731
|
+
// Hooks
|
|
62732
|
+
var authProvider = useAuth();
|
|
62733
|
+
var searchParams = new URLSearchParams((_window = window) === null || _window === void 0 || (_window = _window.location) === null || _window === void 0 ? void 0 : _window.search);
|
|
62734
|
+
|
|
62735
|
+
// UI States
|
|
62736
|
+
var _useState = React.useState(false),
|
|
62737
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
62738
|
+
isLoading = _useState2[0],
|
|
62739
|
+
setIsLoading = _useState2[1];
|
|
62740
|
+
var _React$useState = React.useState(false),
|
|
62741
|
+
_React$useState2 = _slicedToArray(_React$useState, 2);
|
|
62742
|
+
_React$useState2[0];
|
|
62743
|
+
_React$useState2[1];
|
|
62744
|
+
|
|
62745
|
+
// Entity states
|
|
62746
|
+
var _useState3 = React.useState(''),
|
|
62747
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
62748
|
+
email = _useState4[0],
|
|
62749
|
+
setEmail = _useState4[1];
|
|
62750
|
+
var showError = function showError(_ref3) {
|
|
62751
|
+
var title = _ref3.title,
|
|
62752
|
+
message = _ref3.message;
|
|
62753
|
+
Swal.fire({
|
|
62754
|
+
title: title || 'Failed to sign-in',
|
|
62755
|
+
text: message || '',
|
|
62756
|
+
icon: 'error'
|
|
62757
|
+
}).then(function () {
|
|
62758
|
+
var _window2;
|
|
62759
|
+
searchParams["delete"]('error');
|
|
62760
|
+
window.location.replace("".concat((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.location) === null || _window2 === void 0 ? void 0 : _window2.pathname, "?").concat(searchParams.toString()));
|
|
62761
|
+
});
|
|
62762
|
+
};
|
|
62763
|
+
var setErrors = function setErrors() {
|
|
62764
|
+
var error = searchParams.get('error');
|
|
62765
|
+
switch (error) {
|
|
62766
|
+
case 'insufficient_permissions':
|
|
62767
|
+
showError({
|
|
62768
|
+
title: 'Insufficient permissions',
|
|
62769
|
+
message: 'You do not have sufficient permissions to enter.'
|
|
62770
|
+
});
|
|
62771
|
+
break;
|
|
62772
|
+
case 'access_denied':
|
|
62773
|
+
showError({
|
|
62774
|
+
title: 'Access denied',
|
|
62775
|
+
message: 'Your account does not have access to this application.'
|
|
62776
|
+
});
|
|
62777
|
+
break;
|
|
62778
|
+
}
|
|
62779
|
+
};
|
|
62780
|
+
var handleSubmit = /*#__PURE__*/function () {
|
|
62781
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
|
|
62782
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
62783
|
+
while (1) switch (_context.prev = _context.next) {
|
|
62784
|
+
case 0:
|
|
62785
|
+
_context.prev = 0;
|
|
62786
|
+
event.preventDefault();
|
|
62787
|
+
setIsLoading(true);
|
|
62788
|
+
if (email) {
|
|
62789
|
+
_context.next = 7;
|
|
62790
|
+
break;
|
|
62791
|
+
}
|
|
62792
|
+
_context.next = 6;
|
|
62793
|
+
return swal$2.fire({
|
|
62794
|
+
title: 'Error entering',
|
|
62795
|
+
text: 'Please enter an email.',
|
|
62796
|
+
icon: 'error'
|
|
62797
|
+
});
|
|
62798
|
+
case 6:
|
|
62799
|
+
return _context.abrupt("return");
|
|
62800
|
+
case 7:
|
|
62801
|
+
_context.next = 9;
|
|
62802
|
+
return signInStandard$1({
|
|
62803
|
+
payload: {
|
|
62804
|
+
email: email
|
|
62805
|
+
},
|
|
62806
|
+
authProvider: authProvider,
|
|
62807
|
+
redirectUrl: redirectUrl,
|
|
62808
|
+
apiKey: apiKey,
|
|
62809
|
+
debug: debug
|
|
62810
|
+
});
|
|
62811
|
+
case 9:
|
|
62812
|
+
_context.next = 14;
|
|
62813
|
+
break;
|
|
62814
|
+
case 11:
|
|
62815
|
+
_context.prev = 11;
|
|
62816
|
+
_context.t0 = _context["catch"](0);
|
|
62817
|
+
console.error(_context.t0);
|
|
62818
|
+
case 14:
|
|
62819
|
+
_context.prev = 14;
|
|
62820
|
+
setIsLoading(false);
|
|
62821
|
+
return _context.finish(14);
|
|
62822
|
+
case 17:
|
|
62823
|
+
case "end":
|
|
62824
|
+
return _context.stop();
|
|
62825
|
+
}
|
|
62826
|
+
}, _callee, null, [[0, 11, 14, 17]]);
|
|
62827
|
+
}));
|
|
62828
|
+
return function handleSubmit(_x2) {
|
|
62829
|
+
return _ref4.apply(this, arguments);
|
|
62830
|
+
};
|
|
62831
|
+
}();
|
|
62832
|
+
var initializeComponent = function initializeComponent() {
|
|
62833
|
+
setErrors();
|
|
62834
|
+
};
|
|
62835
|
+
React.useEffect(function () {
|
|
62836
|
+
initializeComponent();
|
|
62837
|
+
}, []);
|
|
62838
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StandardContainer, null, /*#__PURE__*/React.createElement("header", {
|
|
62839
|
+
style: {
|
|
62840
|
+
textAlign: 'center'
|
|
62841
|
+
}
|
|
62842
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
62843
|
+
href: "/"
|
|
62844
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
62845
|
+
src: organization === null || organization === void 0 ? void 0 : organization.logoSrc,
|
|
62846
|
+
alt: "",
|
|
62847
|
+
height: "75",
|
|
62848
|
+
style: {
|
|
62849
|
+
display: 'block',
|
|
62850
|
+
margin: '0 auto'
|
|
62851
|
+
}
|
|
62852
|
+
})), /*#__PURE__*/React.createElement(Typography$1, {
|
|
62853
|
+
variant: "body2",
|
|
62854
|
+
style: {
|
|
62855
|
+
marginTop: '16px',
|
|
62856
|
+
marginBottom: '24px',
|
|
62857
|
+
color: '#98a6ad',
|
|
62858
|
+
fontWeight: 300
|
|
62859
|
+
}
|
|
62860
|
+
}, organization === null || organization === void 0 ? void 0 : organization.slogan)), /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement("div", {
|
|
62861
|
+
style: {
|
|
62862
|
+
textAlign: 'center',
|
|
62863
|
+
marginBottom: '32px'
|
|
62864
|
+
}
|
|
62865
|
+
}, /*#__PURE__*/React.createElement(KarlaTypography, {
|
|
62866
|
+
style: {
|
|
62867
|
+
color: '#343a40'
|
|
62868
|
+
}
|
|
62869
|
+
}, "Recover password")), /*#__PURE__*/React.createElement("form", {
|
|
62870
|
+
onSubmit: handleSubmit,
|
|
62871
|
+
autoComplete: "off"
|
|
62872
|
+
}, /*#__PURE__*/React.createElement("section", {
|
|
62873
|
+
style: {
|
|
62874
|
+
marginBottom: '16px',
|
|
62875
|
+
margin: '10px 0'
|
|
62876
|
+
}
|
|
62877
|
+
}, /*#__PURE__*/React.createElement(TextField$1, {
|
|
62878
|
+
fullWidth: true,
|
|
62879
|
+
type: "email",
|
|
62880
|
+
id: "email-input",
|
|
62881
|
+
label: "Email address",
|
|
62882
|
+
value: email,
|
|
62883
|
+
placeholder: "Type your email",
|
|
62884
|
+
required: true,
|
|
62885
|
+
onChange: function onChange(e) {
|
|
62886
|
+
return setEmail(e.target.value);
|
|
62887
|
+
},
|
|
62888
|
+
autoComplete: "etrune-email",
|
|
62889
|
+
InputLabelProps: {
|
|
62890
|
+
shrink: true
|
|
62891
|
+
}
|
|
62892
|
+
})), /*#__PURE__*/React.createElement("footer", {
|
|
62893
|
+
style: {
|
|
62894
|
+
marginBottom: '16px',
|
|
62895
|
+
display: 'flex',
|
|
62896
|
+
justifyContent: 'center'
|
|
62897
|
+
}
|
|
62898
|
+
}, /*#__PURE__*/React.createElement(Button$1, {
|
|
62899
|
+
type: "submit",
|
|
62900
|
+
variant: "contained",
|
|
62901
|
+
disabled: isLoading,
|
|
62902
|
+
sx: {
|
|
62903
|
+
display: 'flex',
|
|
62904
|
+
alignItems: 'center',
|
|
62905
|
+
border: '2px solid #232931',
|
|
62906
|
+
backgroundColor: '#323a46',
|
|
62907
|
+
color: '#fff',
|
|
62908
|
+
'&:hover': {
|
|
62909
|
+
backgroundColor: '#3d4c61'
|
|
62910
|
+
},
|
|
62911
|
+
width: '100%'
|
|
62912
|
+
}
|
|
62913
|
+
}, isLoading && /*#__PURE__*/React.createElement(CircularProgress$1, {
|
|
62914
|
+
size: 20,
|
|
62915
|
+
style: {
|
|
62916
|
+
marginRight: '8px',
|
|
62917
|
+
color: '#fff'
|
|
62918
|
+
}
|
|
62919
|
+
}), isLoading ? 'Recovering...' : 'Recover'))))));
|
|
62920
|
+
};
|
|
62921
|
+
|
|
62922
|
+
var swal$1 = withReactContent(Swal);
|
|
62923
|
+
var statusCodeMessages$1 = {
|
|
62924
|
+
461: 'The data provided does not match any registered application',
|
|
62925
|
+
462: 'Unauthorized user. After 3 failed attempts, your account will be locked for 24 hours.',
|
|
62926
|
+
463: 'The user is not registered in this application, needs to register',
|
|
62927
|
+
464: 'Unauthorized. After 3 failed attempts, your account will be locked for 24 hours.',
|
|
62928
|
+
465: 'API key is missing or invalid',
|
|
62929
|
+
401: 'Error authenticating'
|
|
62930
|
+
};
|
|
62931
|
+
function signInStandard(_x) {
|
|
62932
|
+
return _signInStandard.apply(this, arguments);
|
|
62933
|
+
}
|
|
62934
|
+
function _signInStandard() {
|
|
62935
|
+
_signInStandard = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
|
|
62936
|
+
var payload, authProvider, redirectUrl, apiKey, debug, entityService, entityResponse;
|
|
62937
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
62938
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
62939
|
+
case 0:
|
|
62940
|
+
payload = _ref.payload, authProvider = _ref.authProvider, redirectUrl = _ref.redirectUrl, apiKey = _ref.apiKey, debug = _ref.debug;
|
|
62941
|
+
entityService = new SecurityService({
|
|
62942
|
+
apiKey: apiKey,
|
|
62943
|
+
settings: {
|
|
62944
|
+
debug: debug
|
|
62945
|
+
}
|
|
62946
|
+
});
|
|
62947
|
+
_context2.next = 4;
|
|
62948
|
+
return entityService.signInStandard(payload);
|
|
62949
|
+
case 4:
|
|
62950
|
+
entityResponse = _context2.sent;
|
|
62951
|
+
if (!(!entityResponse || !entityResponse.result)) {
|
|
62952
|
+
_context2.next = 9;
|
|
62953
|
+
break;
|
|
62954
|
+
}
|
|
62955
|
+
_context2.next = 8;
|
|
62956
|
+
return swal$1.fire({
|
|
62957
|
+
title: 'Sign-in error',
|
|
62958
|
+
text: statusCodeMessages$1[entityResponse.status] || 'An error occurred',
|
|
62959
|
+
icon: 'error'
|
|
62960
|
+
});
|
|
62961
|
+
case 8:
|
|
62962
|
+
return _context2.abrupt("return");
|
|
62963
|
+
case 9:
|
|
62964
|
+
authProvider.login({
|
|
62965
|
+
user: entityResponse.result || {},
|
|
62966
|
+
redirectUrl: redirectUrl
|
|
62967
|
+
});
|
|
62968
|
+
case 10:
|
|
62969
|
+
case "end":
|
|
62970
|
+
return _context2.stop();
|
|
62971
|
+
}
|
|
62972
|
+
}, _callee2);
|
|
62973
|
+
}));
|
|
62974
|
+
return _signInStandard.apply(this, arguments);
|
|
62975
|
+
}
|
|
62976
|
+
var VeripassNewPassword = function VeripassNewPassword(_ref2) {
|
|
62977
|
+
var _window;
|
|
62978
|
+
var _ref2$organization = _ref2.organization,
|
|
62979
|
+
organization = _ref2$organization === void 0 ? {
|
|
62980
|
+
logoSrc: '',
|
|
62981
|
+
slogan: ''
|
|
62982
|
+
} : _ref2$organization,
|
|
62983
|
+
_ref2$redirectUrl = _ref2.redirectUrl,
|
|
62984
|
+
redirectUrl = _ref2$redirectUrl === void 0 ? '' : _ref2$redirectUrl,
|
|
62985
|
+
_ref2$debug = _ref2.debug,
|
|
62986
|
+
debug = _ref2$debug === void 0 ? false : _ref2$debug,
|
|
62987
|
+
_ref2$apiKey = _ref2.apiKey,
|
|
62988
|
+
apiKey = _ref2$apiKey === void 0 ? '' : _ref2$apiKey;
|
|
62989
|
+
// Hooks
|
|
62990
|
+
var authProvider = useAuth();
|
|
62991
|
+
var searchParams = new URLSearchParams((_window = window) === null || _window === void 0 || (_window = _window.location) === null || _window === void 0 ? void 0 : _window.search);
|
|
62992
|
+
|
|
62993
|
+
// UI States
|
|
62994
|
+
var _useState = React.useState(false),
|
|
62995
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
62996
|
+
isLoading = _useState2[0],
|
|
62997
|
+
setIsLoading = _useState2[1];
|
|
62998
|
+
var _React$useState = React.useState(false),
|
|
62999
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
63000
|
+
showPassword = _React$useState2[0],
|
|
63001
|
+
setShowPassword = _React$useState2[1];
|
|
63002
|
+
|
|
63003
|
+
// Entity states
|
|
63004
|
+
var _useState3 = React.useState(''),
|
|
63005
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
63006
|
+
password = _useState4[0],
|
|
63007
|
+
setPassword = _useState4[1];
|
|
63008
|
+
var showError = function showError(_ref3) {
|
|
63009
|
+
var title = _ref3.title,
|
|
63010
|
+
message = _ref3.message;
|
|
63011
|
+
Swal.fire({
|
|
63012
|
+
title: title || 'Failed to sign-in',
|
|
63013
|
+
text: message || '',
|
|
63014
|
+
icon: 'error'
|
|
63015
|
+
}).then(function () {
|
|
63016
|
+
var _window2;
|
|
63017
|
+
searchParams["delete"]('error');
|
|
63018
|
+
window.location.replace("".concat((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.location) === null || _window2 === void 0 ? void 0 : _window2.pathname, "?").concat(searchParams.toString()));
|
|
63019
|
+
});
|
|
63020
|
+
};
|
|
63021
|
+
var setErrors = function setErrors() {
|
|
63022
|
+
var error = searchParams.get('error');
|
|
63023
|
+
switch (error) {
|
|
63024
|
+
case 'insufficient_permissions':
|
|
63025
|
+
showError({
|
|
63026
|
+
title: 'Insufficient permissions',
|
|
63027
|
+
message: 'You do not have sufficient permissions to enter.'
|
|
63028
|
+
});
|
|
63029
|
+
break;
|
|
63030
|
+
case 'access_denied':
|
|
63031
|
+
showError({
|
|
63032
|
+
title: 'Access denied',
|
|
63033
|
+
message: 'Your account does not have access to this application.'
|
|
63034
|
+
});
|
|
63035
|
+
break;
|
|
63036
|
+
}
|
|
63037
|
+
};
|
|
63038
|
+
var handleSubmit = /*#__PURE__*/function () {
|
|
63039
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
|
|
63040
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
63041
|
+
while (1) switch (_context.prev = _context.next) {
|
|
63042
|
+
case 0:
|
|
63043
|
+
_context.prev = 0;
|
|
63044
|
+
event.preventDefault();
|
|
63045
|
+
setIsLoading(true);
|
|
63046
|
+
if (password) {
|
|
63047
|
+
_context.next = 7;
|
|
63048
|
+
break;
|
|
63049
|
+
}
|
|
63050
|
+
_context.next = 6;
|
|
63051
|
+
return swal$1.fire({
|
|
63052
|
+
title: 'Error entering',
|
|
63053
|
+
text: 'Please enter a password.',
|
|
63054
|
+
icon: 'error'
|
|
63055
|
+
});
|
|
63056
|
+
case 6:
|
|
63057
|
+
return _context.abrupt("return");
|
|
63058
|
+
case 7:
|
|
63059
|
+
_context.next = 9;
|
|
63060
|
+
return signInStandard({
|
|
63061
|
+
payload: {
|
|
63062
|
+
password: password
|
|
63063
|
+
},
|
|
63064
|
+
authProvider: authProvider,
|
|
63065
|
+
redirectUrl: redirectUrl,
|
|
63066
|
+
apiKey: apiKey,
|
|
63067
|
+
debug: debug
|
|
63068
|
+
});
|
|
63069
|
+
case 9:
|
|
63070
|
+
_context.next = 14;
|
|
63071
|
+
break;
|
|
63072
|
+
case 11:
|
|
63073
|
+
_context.prev = 11;
|
|
63074
|
+
_context.t0 = _context["catch"](0);
|
|
63075
|
+
console.error(_context.t0);
|
|
63076
|
+
case 14:
|
|
63077
|
+
_context.prev = 14;
|
|
63078
|
+
setIsLoading(false);
|
|
63079
|
+
return _context.finish(14);
|
|
63080
|
+
case 17:
|
|
63081
|
+
case "end":
|
|
63082
|
+
return _context.stop();
|
|
63083
|
+
}
|
|
63084
|
+
}, _callee, null, [[0, 11, 14, 17]]);
|
|
63085
|
+
}));
|
|
63086
|
+
return function handleSubmit(_x2) {
|
|
63087
|
+
return _ref4.apply(this, arguments);
|
|
63088
|
+
};
|
|
63089
|
+
}();
|
|
63090
|
+
var initializeComponent = function initializeComponent() {
|
|
63091
|
+
setErrors();
|
|
63092
|
+
};
|
|
63093
|
+
React.useEffect(function () {
|
|
63094
|
+
initializeComponent();
|
|
63095
|
+
}, []);
|
|
63096
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StandardContainer, null, /*#__PURE__*/React.createElement("header", {
|
|
63097
|
+
style: {
|
|
63098
|
+
textAlign: 'center'
|
|
63099
|
+
}
|
|
63100
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
63101
|
+
href: "/"
|
|
63102
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
63103
|
+
src: organization === null || organization === void 0 ? void 0 : organization.logoSrc,
|
|
63104
|
+
alt: "",
|
|
63105
|
+
height: "75",
|
|
63106
|
+
style: {
|
|
63107
|
+
display: 'block',
|
|
63108
|
+
margin: '0 auto'
|
|
63109
|
+
}
|
|
63110
|
+
})), /*#__PURE__*/React.createElement(Typography$1, {
|
|
63111
|
+
variant: "body2",
|
|
63112
|
+
style: {
|
|
63113
|
+
marginTop: '16px',
|
|
63114
|
+
marginBottom: '24px',
|
|
63115
|
+
color: '#98a6ad',
|
|
63116
|
+
fontWeight: 300
|
|
63117
|
+
}
|
|
63118
|
+
}, organization === null || organization === void 0 ? void 0 : organization.slogan)), /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement("div", {
|
|
63119
|
+
style: {
|
|
63120
|
+
textAlign: 'center',
|
|
63121
|
+
marginBottom: '32px'
|
|
63122
|
+
}
|
|
63123
|
+
}, /*#__PURE__*/React.createElement(KarlaTypography, {
|
|
63124
|
+
style: {
|
|
63125
|
+
color: '#343a40'
|
|
63126
|
+
}
|
|
63127
|
+
}, "New password")), /*#__PURE__*/React.createElement("form", {
|
|
63128
|
+
onSubmit: handleSubmit,
|
|
63129
|
+
autoComplete: "off"
|
|
63130
|
+
}, /*#__PURE__*/React.createElement("section", {
|
|
63131
|
+
style: {
|
|
63132
|
+
marginBottom: '16px'
|
|
63133
|
+
}
|
|
63134
|
+
}, /*#__PURE__*/React.createElement(TextField$1, {
|
|
63135
|
+
fullWidth: true,
|
|
63136
|
+
label: "Password",
|
|
63137
|
+
type: showPassword ? 'text' : 'password',
|
|
63138
|
+
value: password,
|
|
63139
|
+
onChange: function onChange(event) {
|
|
63140
|
+
return setPassword(event.target.value);
|
|
63141
|
+
},
|
|
63142
|
+
InputProps: {
|
|
63143
|
+
endAdornment: /*#__PURE__*/React.createElement(InputAdornment$1, {
|
|
63144
|
+
position: "end"
|
|
63145
|
+
}, /*#__PURE__*/React.createElement(IconButton$1, {
|
|
63146
|
+
"aria-label": "toggle password visibility",
|
|
63147
|
+
onClick: function onClick() {
|
|
63148
|
+
return setShowPassword(function (show) {
|
|
63149
|
+
return !show;
|
|
63150
|
+
});
|
|
63151
|
+
},
|
|
63152
|
+
onMouseDown: function onMouseDown(event) {
|
|
63153
|
+
event.preventDefault();
|
|
63154
|
+
},
|
|
63155
|
+
edge: "end"
|
|
63156
|
+
}, showPassword ? /*#__PURE__*/React.createElement(VisibilityIcon, null) : /*#__PURE__*/React.createElement(VisibilityOffIcon, null)))
|
|
63157
|
+
},
|
|
63158
|
+
InputLabelProps: {
|
|
63159
|
+
shrink: true
|
|
63160
|
+
}
|
|
63161
|
+
})), /*#__PURE__*/React.createElement("footer", {
|
|
63162
|
+
style: {
|
|
63163
|
+
marginBottom: '16px',
|
|
63164
|
+
display: 'flex',
|
|
63165
|
+
justifyContent: 'center'
|
|
63166
|
+
}
|
|
63167
|
+
}, /*#__PURE__*/React.createElement(Button$1, {
|
|
63168
|
+
type: "submit",
|
|
63169
|
+
variant: "contained",
|
|
63170
|
+
disabled: isLoading,
|
|
63171
|
+
sx: {
|
|
63172
|
+
display: 'flex',
|
|
63173
|
+
alignItems: 'center',
|
|
63174
|
+
border: '2px solid #232931',
|
|
63175
|
+
backgroundColor: '#323a46',
|
|
63176
|
+
color: '#fff',
|
|
63177
|
+
'&:hover': {
|
|
63178
|
+
backgroundColor: '#3d4c61'
|
|
63179
|
+
},
|
|
63180
|
+
width: '100%'
|
|
63181
|
+
}
|
|
63182
|
+
}, isLoading && /*#__PURE__*/React.createElement(CircularProgress$1, {
|
|
63183
|
+
size: 20,
|
|
63184
|
+
style: {
|
|
63185
|
+
marginRight: '8px',
|
|
63186
|
+
color: '#fff'
|
|
63187
|
+
}
|
|
63188
|
+
}), isLoading ? 'Changing...' : 'Change password'))))));
|
|
63189
|
+
};
|
|
63190
|
+
|
|
63191
|
+
var swal = withReactContent(Swal);
|
|
63192
|
+
var statusCodeMessages = {
|
|
63193
|
+
461: 'The data provided does not match any registered application',
|
|
63194
|
+
462: 'Unauthorized user. After 3 failed attempts, your account will be locked for 24 hours.',
|
|
63195
|
+
463: 'The user is not registered in this application, needs to register',
|
|
63196
|
+
464: 'Unauthorized. After 3 failed attempts, your account will be locked for 24 hours.',
|
|
63197
|
+
465: 'API key is missing or invalid',
|
|
63198
|
+
401: 'Error authenticating'
|
|
63199
|
+
};
|
|
63200
|
+
function unlockStandard(_x) {
|
|
63201
|
+
return _unlockStandard.apply(this, arguments);
|
|
63202
|
+
}
|
|
63203
|
+
function _unlockStandard() {
|
|
63204
|
+
_unlockStandard = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
|
|
63205
|
+
var payload, authProvider, redirectUrl, apiKey, debug, entityService, entityResponse;
|
|
63206
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
63207
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
63208
|
+
case 0:
|
|
63209
|
+
payload = _ref.payload, authProvider = _ref.authProvider, redirectUrl = _ref.redirectUrl, apiKey = _ref.apiKey, debug = _ref.debug;
|
|
63210
|
+
entityService = new SecurityService({
|
|
63211
|
+
apiKey: apiKey,
|
|
63212
|
+
settings: {
|
|
63213
|
+
debug: debug
|
|
63214
|
+
}
|
|
63215
|
+
});
|
|
63216
|
+
_context2.next = 4;
|
|
63217
|
+
return entityService.signInStandard(payload);
|
|
63218
|
+
case 4:
|
|
63219
|
+
entityResponse = _context2.sent;
|
|
63220
|
+
if (!(!entityResponse || !entityResponse.result)) {
|
|
63221
|
+
_context2.next = 9;
|
|
63222
|
+
break;
|
|
63223
|
+
}
|
|
63224
|
+
_context2.next = 8;
|
|
63225
|
+
return swal.fire({
|
|
63226
|
+
title: 'Sign-in error',
|
|
63227
|
+
text: statusCodeMessages[entityResponse.status] || 'An error occurred',
|
|
63228
|
+
icon: 'error'
|
|
63229
|
+
});
|
|
63230
|
+
case 8:
|
|
63231
|
+
return _context2.abrupt("return");
|
|
63232
|
+
case 9:
|
|
63233
|
+
authProvider.login({
|
|
63234
|
+
user: entityResponse.result || {},
|
|
63235
|
+
redirectUrl: redirectUrl
|
|
63236
|
+
});
|
|
63237
|
+
case 10:
|
|
63238
|
+
case "end":
|
|
63239
|
+
return _context2.stop();
|
|
63240
|
+
}
|
|
63241
|
+
}, _callee2);
|
|
63242
|
+
}));
|
|
63243
|
+
return _unlockStandard.apply(this, arguments);
|
|
63244
|
+
}
|
|
63245
|
+
var VeripassStandardUnlock = function VeripassStandardUnlock(_ref2) {
|
|
63246
|
+
var _window;
|
|
63247
|
+
var _ref2$organization = _ref2.organization,
|
|
63248
|
+
organization = _ref2$organization === void 0 ? {
|
|
63249
|
+
logoSrc: '',
|
|
63250
|
+
slogan: ''
|
|
63251
|
+
} : _ref2$organization,
|
|
63252
|
+
_ref2$redirectUrl = _ref2.redirectUrl,
|
|
63253
|
+
redirectUrl = _ref2$redirectUrl === void 0 ? '' : _ref2$redirectUrl,
|
|
63254
|
+
_ref2$debug = _ref2.debug,
|
|
63255
|
+
debug = _ref2$debug === void 0 ? false : _ref2$debug,
|
|
63256
|
+
_ref2$apiKey = _ref2.apiKey,
|
|
63257
|
+
apiKey = _ref2$apiKey === void 0 ? '' : _ref2$apiKey;
|
|
63258
|
+
// Hooks
|
|
63259
|
+
var authProvider = useAuth();
|
|
63260
|
+
var searchParams = new URLSearchParams((_window = window) === null || _window === void 0 || (_window = _window.location) === null || _window === void 0 ? void 0 : _window.search);
|
|
63261
|
+
|
|
63262
|
+
// UI States
|
|
63263
|
+
var _useState = React.useState(false),
|
|
63264
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
63265
|
+
isLoading = _useState2[0],
|
|
63266
|
+
setIsLoading = _useState2[1];
|
|
63267
|
+
var _React$useState = React.useState(false),
|
|
63268
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
63269
|
+
showPassword = _React$useState2[0],
|
|
63270
|
+
setShowPassword = _React$useState2[1];
|
|
63271
|
+
|
|
63272
|
+
// Entity states
|
|
63273
|
+
var _useState3 = React.useState(''),
|
|
63274
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
63275
|
+
password = _useState4[0],
|
|
63276
|
+
setPassword = _useState4[1];
|
|
63277
|
+
var showError = function showError(_ref3) {
|
|
63278
|
+
var title = _ref3.title,
|
|
63279
|
+
message = _ref3.message;
|
|
63280
|
+
Swal.fire({
|
|
63281
|
+
title: title || 'Failed to sign-in',
|
|
63282
|
+
text: message || '',
|
|
63283
|
+
icon: 'error'
|
|
63284
|
+
}).then(function () {
|
|
63285
|
+
var _window2;
|
|
63286
|
+
searchParams["delete"]('error');
|
|
63287
|
+
window.location.replace("".concat((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.location) === null || _window2 === void 0 ? void 0 : _window2.pathname, "?").concat(searchParams.toString()));
|
|
63288
|
+
});
|
|
63289
|
+
};
|
|
63290
|
+
var setErrors = function setErrors() {
|
|
63291
|
+
var error = searchParams.get('error');
|
|
63292
|
+
switch (error) {
|
|
63293
|
+
case 'insufficient_permissions':
|
|
63294
|
+
showError({
|
|
63295
|
+
title: 'Insufficient permissions',
|
|
63296
|
+
message: 'You do not have sufficient permissions to enter.'
|
|
63297
|
+
});
|
|
63298
|
+
break;
|
|
63299
|
+
case 'access_denied':
|
|
63300
|
+
showError({
|
|
63301
|
+
title: 'Access denied',
|
|
63302
|
+
message: 'Your account does not have access to this application.'
|
|
63303
|
+
});
|
|
63304
|
+
break;
|
|
63305
|
+
}
|
|
63306
|
+
};
|
|
63307
|
+
var handleSubmit = /*#__PURE__*/function () {
|
|
63308
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
|
|
63309
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
63310
|
+
while (1) switch (_context.prev = _context.next) {
|
|
63311
|
+
case 0:
|
|
63312
|
+
_context.prev = 0;
|
|
63313
|
+
event.preventDefault();
|
|
63314
|
+
setIsLoading(true);
|
|
63315
|
+
if (password) {
|
|
63316
|
+
_context.next = 7;
|
|
63317
|
+
break;
|
|
63318
|
+
}
|
|
63319
|
+
_context.next = 6;
|
|
63320
|
+
return swal.fire({
|
|
63321
|
+
title: 'Error entering',
|
|
63322
|
+
text: 'Please enter a password.',
|
|
63323
|
+
icon: 'error'
|
|
63324
|
+
});
|
|
63325
|
+
case 6:
|
|
63326
|
+
return _context.abrupt("return");
|
|
63327
|
+
case 7:
|
|
63328
|
+
_context.next = 9;
|
|
63329
|
+
return unlockStandard({
|
|
63330
|
+
payload: {
|
|
63331
|
+
password: password
|
|
63332
|
+
},
|
|
63333
|
+
authProvider: authProvider,
|
|
63334
|
+
redirectUrl: redirectUrl,
|
|
63335
|
+
apiKey: apiKey,
|
|
63336
|
+
debug: debug
|
|
63337
|
+
});
|
|
63338
|
+
case 9:
|
|
63339
|
+
_context.next = 14;
|
|
63340
|
+
break;
|
|
63341
|
+
case 11:
|
|
63342
|
+
_context.prev = 11;
|
|
63343
|
+
_context.t0 = _context["catch"](0);
|
|
63344
|
+
console.error(_context.t0);
|
|
63345
|
+
case 14:
|
|
63346
|
+
_context.prev = 14;
|
|
63347
|
+
setIsLoading(false);
|
|
63348
|
+
return _context.finish(14);
|
|
63349
|
+
case 17:
|
|
63350
|
+
case "end":
|
|
63351
|
+
return _context.stop();
|
|
63352
|
+
}
|
|
63353
|
+
}, _callee, null, [[0, 11, 14, 17]]);
|
|
63354
|
+
}));
|
|
63355
|
+
return function handleSubmit(_x2) {
|
|
63356
|
+
return _ref4.apply(this, arguments);
|
|
63357
|
+
};
|
|
63358
|
+
}();
|
|
63359
|
+
var initializeComponent = function initializeComponent() {
|
|
63360
|
+
setErrors();
|
|
63361
|
+
};
|
|
63362
|
+
React.useEffect(function () {
|
|
63363
|
+
initializeComponent();
|
|
63364
|
+
}, []);
|
|
63365
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StandardContainer, null, /*#__PURE__*/React.createElement("header", {
|
|
63366
|
+
style: {
|
|
63367
|
+
textAlign: 'center'
|
|
63368
|
+
}
|
|
63369
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
63370
|
+
href: "/"
|
|
63371
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
63372
|
+
src: organization === null || organization === void 0 ? void 0 : organization.logoSrc,
|
|
63373
|
+
alt: "",
|
|
63374
|
+
height: "75",
|
|
63375
|
+
style: {
|
|
63376
|
+
display: 'block',
|
|
63377
|
+
margin: '0 auto'
|
|
63378
|
+
}
|
|
63379
|
+
})), /*#__PURE__*/React.createElement(Typography$1, {
|
|
63380
|
+
variant: "body2",
|
|
63381
|
+
style: {
|
|
63382
|
+
marginTop: '16px',
|
|
63383
|
+
marginBottom: '24px',
|
|
63384
|
+
color: '#98a6ad',
|
|
63385
|
+
fontWeight: 300
|
|
63386
|
+
}
|
|
63387
|
+
}, organization === null || organization === void 0 ? void 0 : organization.slogan)), /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement("div", {
|
|
63388
|
+
style: {
|
|
63389
|
+
textAlign: 'center',
|
|
63390
|
+
marginBottom: '32px'
|
|
63391
|
+
}
|
|
63392
|
+
}, /*#__PURE__*/React.createElement(KarlaTypography, {
|
|
63393
|
+
style: {
|
|
63394
|
+
color: '#343a40'
|
|
63395
|
+
}
|
|
63396
|
+
}, "Welcome again")), /*#__PURE__*/React.createElement("form", {
|
|
63397
|
+
onSubmit: handleSubmit,
|
|
63398
|
+
autoComplete: "off"
|
|
63399
|
+
}, /*#__PURE__*/React.createElement("section", {
|
|
63400
|
+
style: {
|
|
63401
|
+
marginBottom: '16px'
|
|
63402
|
+
}
|
|
63403
|
+
}, /*#__PURE__*/React.createElement(TextField$1, {
|
|
63404
|
+
fullWidth: true,
|
|
63405
|
+
label: "Password",
|
|
63406
|
+
type: showPassword ? 'text' : 'password',
|
|
63407
|
+
value: password,
|
|
63408
|
+
onChange: function onChange(event) {
|
|
63409
|
+
return setPassword(event.target.value);
|
|
63410
|
+
},
|
|
63411
|
+
InputProps: {
|
|
63412
|
+
endAdornment: /*#__PURE__*/React.createElement(InputAdornment$1, {
|
|
63413
|
+
position: "end"
|
|
63414
|
+
}, /*#__PURE__*/React.createElement(IconButton$1, {
|
|
63415
|
+
"aria-label": "toggle password visibility",
|
|
63416
|
+
onClick: function onClick() {
|
|
63417
|
+
return setShowPassword(function (show) {
|
|
63418
|
+
return !show;
|
|
63419
|
+
});
|
|
63420
|
+
},
|
|
63421
|
+
onMouseDown: function onMouseDown(event) {
|
|
63422
|
+
event.preventDefault();
|
|
63423
|
+
},
|
|
63424
|
+
edge: "end"
|
|
63425
|
+
}, showPassword ? /*#__PURE__*/React.createElement(VisibilityIcon, null) : /*#__PURE__*/React.createElement(VisibilityOffIcon, null)))
|
|
63426
|
+
},
|
|
63427
|
+
InputLabelProps: {
|
|
63428
|
+
shrink: true
|
|
63429
|
+
}
|
|
63430
|
+
})), /*#__PURE__*/React.createElement("section", {
|
|
63431
|
+
style: {
|
|
63432
|
+
marginBottom: '16px',
|
|
63433
|
+
width: '100%'
|
|
63434
|
+
}
|
|
63435
|
+
}, /*#__PURE__*/React.createElement(Link$1, {
|
|
63436
|
+
href: "recover-password",
|
|
63437
|
+
underline: "hover",
|
|
63438
|
+
style: {
|
|
63439
|
+
marginLeft: '8px',
|
|
63440
|
+
color: 'gray',
|
|
63441
|
+
width: '100%',
|
|
63442
|
+
display: 'flex',
|
|
63443
|
+
justifyContent: 'flex-end',
|
|
63444
|
+
textDecoration: 'none'
|
|
63445
|
+
}
|
|
63446
|
+
}, /*#__PURE__*/React.createElement(LockIcon, {
|
|
63447
|
+
style: {
|
|
63448
|
+
marginRight: '5px',
|
|
63449
|
+
color: '#98a6ad',
|
|
63450
|
+
fontSize: '18px'
|
|
63451
|
+
}
|
|
63452
|
+
}), /*#__PURE__*/React.createElement(Typography$1, {
|
|
63453
|
+
variant: "body2",
|
|
63454
|
+
style: {
|
|
63455
|
+
color: '#98a6ad',
|
|
63456
|
+
fontWeight: '400'
|
|
63457
|
+
}
|
|
63458
|
+
}, "Forgot password?"))), /*#__PURE__*/React.createElement("footer", {
|
|
63459
|
+
style: {
|
|
63460
|
+
marginBottom: '16px',
|
|
63461
|
+
display: 'flex',
|
|
63462
|
+
justifyContent: 'center'
|
|
63463
|
+
}
|
|
63464
|
+
}, /*#__PURE__*/React.createElement(Button$1, {
|
|
63465
|
+
type: "submit",
|
|
63466
|
+
variant: "contained",
|
|
63467
|
+
disabled: isLoading,
|
|
63468
|
+
sx: {
|
|
63469
|
+
display: 'flex',
|
|
63470
|
+
alignItems: 'center',
|
|
63471
|
+
border: '2px solid #232931',
|
|
63472
|
+
backgroundColor: '#323a46',
|
|
63473
|
+
color: '#fff',
|
|
63474
|
+
'&:hover': {
|
|
63475
|
+
backgroundColor: '#3d4c61'
|
|
63476
|
+
},
|
|
63477
|
+
width: '100%'
|
|
63478
|
+
}
|
|
63479
|
+
}, isLoading && /*#__PURE__*/React.createElement(CircularProgress$1, {
|
|
63480
|
+
size: 20,
|
|
63481
|
+
style: {
|
|
63482
|
+
marginRight: '8px',
|
|
63483
|
+
color: '#fff'
|
|
63484
|
+
}
|
|
63485
|
+
}), isLoading ? 'Unlocking...' : 'Unlock'))))));
|
|
63486
|
+
};
|
|
63487
|
+
|
|
62659
63488
|
exports.AuthContext = AuthContext;
|
|
62660
63489
|
exports.AuthProvider = AuthProvider;
|
|
62661
63490
|
exports.VeripassLogoutSuccess = VeripassLogoutSuccess;
|
|
63491
|
+
exports.VeripassNewPassword = VeripassNewPassword;
|
|
63492
|
+
exports.VeripassStandardRecoverPassword = VeripassStandardRecoverPassword;
|
|
62662
63493
|
exports.VeripassStandardSignin = VeripassStandardSignin;
|
|
63494
|
+
exports.VeripassStandardUnlock = VeripassStandardUnlock;
|
|
62663
63495
|
exports.useAuth = useAuth;
|
|
62664
63496
|
exports.useLocalStorage = useLocalStorage;
|
|
62665
63497
|
//# sourceMappingURL=react-sdk.cjs.js.map
|