@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.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, { useState, createContext, useMemo, useContext, useRef, useDebugValue, createElement, forwardRef, Children, isValidElement, cloneElement, useEffect } from 'react';
|
|
2
|
+
import React__default, { useState, createContext, useMemo, useContext, useRef, useDebugValue, createElement, forwardRef, Children, isValidElement, cloneElement, useEffect as useEffect$1 } from 'react';
|
|
3
3
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
4
|
|
|
5
5
|
function _arrayLikeToArray(r, a) {
|
|
@@ -596,6 +596,13 @@ var AuthProvider = function AuthProvider(_ref) {
|
|
|
596
596
|
return JSON.parse(value);
|
|
597
597
|
};
|
|
598
598
|
|
|
599
|
+
// Effect to redirect if user is null
|
|
600
|
+
useEffect(function () {
|
|
601
|
+
if (user === null) {
|
|
602
|
+
window.location.replace('/auth/login');
|
|
603
|
+
}
|
|
604
|
+
}, [user]);
|
|
605
|
+
|
|
599
606
|
/**
|
|
600
607
|
* Memoized value containing the user data and authentication functions.
|
|
601
608
|
*
|
|
@@ -37143,6 +37150,28 @@ var unitlessKeys$1 = {
|
|
|
37143
37150
|
|
|
37144
37151
|
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));},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__default.createContext({shouldForwardProp:void 0,styleSheet:Ve,stylis:Fe});Me.Consumer;React__default.createContext(void 0);function Be(){return 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__default.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__default.useContext(Ke),m=Be(),y=e.shouldForwardProp||m.shouldForwardProp;"production"!==process.env.NODE_ENV&&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&&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,createElement(S,w)}(D,e,r)}O.displayName=y;var D=React__default.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);
|
|
37145
37152
|
|
|
37153
|
+
var _templateObject$2;
|
|
37154
|
+
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"])));
|
|
37155
|
+
var Card = function Card(_ref) {
|
|
37156
|
+
var children = _ref.children;
|
|
37157
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(StandardContainer$1, null, /*#__PURE__*/React__default.createElement("section", {
|
|
37158
|
+
style: {
|
|
37159
|
+
border: '1px solid #f2f2f2',
|
|
37160
|
+
borderRadius: '8px',
|
|
37161
|
+
padding: '2.25rem',
|
|
37162
|
+
boxShadow: '0 .75rem 6rem rgba(56, 65, 74, 0.03)',
|
|
37163
|
+
background: '#FFFFFF'
|
|
37164
|
+
},
|
|
37165
|
+
className: "veripass"
|
|
37166
|
+
}, children)));
|
|
37167
|
+
};
|
|
37168
|
+
|
|
37169
|
+
var _templateObject$1;
|
|
37170
|
+
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"])));
|
|
37171
|
+
|
|
37172
|
+
var _templateObject;
|
|
37173
|
+
var KarlaTypography = ut.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-family: 'Karla', 'Roboto', sans-serif !important;\n font-weight: 600;\n"])));
|
|
37174
|
+
|
|
37146
37175
|
const common = {
|
|
37147
37176
|
black: '#000',
|
|
37148
37177
|
white: '#fff'
|
|
@@ -62173,11 +62202,8 @@ var SecurityService = /*#__PURE__*/function (_BaseApi) {
|
|
|
62173
62202
|
}]);
|
|
62174
62203
|
}(BaseApi);
|
|
62175
62204
|
|
|
62176
|
-
var
|
|
62177
|
-
var
|
|
62178
|
-
var KarlaTypography$1 = ut.span(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteral(["\n font-family: 'Karla', 'Roboto', sans-serif !important;\n font-weight: 600;\n"])));
|
|
62179
|
-
var swal = withReactContent(Swal);
|
|
62180
|
-
var statusCodeMessages = {
|
|
62205
|
+
var swal$3 = withReactContent(Swal);
|
|
62206
|
+
var statusCodeMessages$3 = {
|
|
62181
62207
|
461: 'The data provided does not match any registered application',
|
|
62182
62208
|
462: 'Unauthorized user. After 3 failed attempts, your account will be locked for 24 hours.',
|
|
62183
62209
|
463: 'The user is not registered in this application, needs to register',
|
|
@@ -62185,11 +62211,11 @@ var statusCodeMessages = {
|
|
|
62185
62211
|
465: 'API key is missing or invalid',
|
|
62186
62212
|
401: 'Error authenticating'
|
|
62187
62213
|
};
|
|
62188
|
-
function signInStandard(_x) {
|
|
62189
|
-
return _signInStandard.apply(this, arguments);
|
|
62214
|
+
function signInStandard$2(_x) {
|
|
62215
|
+
return _signInStandard$2.apply(this, arguments);
|
|
62190
62216
|
}
|
|
62191
|
-
function _signInStandard() {
|
|
62192
|
-
_signInStandard = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
|
|
62217
|
+
function _signInStandard$2() {
|
|
62218
|
+
_signInStandard$2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
|
|
62193
62219
|
var payload, authProvider, redirectUrl, apiKey, debug, entityService, entityResponse;
|
|
62194
62220
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
62195
62221
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -62210,9 +62236,9 @@ function _signInStandard() {
|
|
|
62210
62236
|
break;
|
|
62211
62237
|
}
|
|
62212
62238
|
_context2.next = 8;
|
|
62213
|
-
return swal.fire({
|
|
62239
|
+
return swal$3.fire({
|
|
62214
62240
|
title: 'Sign-in error',
|
|
62215
|
-
text: statusCodeMessages[entityResponse.status] || 'An error occurred',
|
|
62241
|
+
text: statusCodeMessages$3[entityResponse.status] || 'An error occurred',
|
|
62216
62242
|
icon: 'error'
|
|
62217
62243
|
});
|
|
62218
62244
|
case 8:
|
|
@@ -62228,14 +62254,15 @@ function _signInStandard() {
|
|
|
62228
62254
|
}
|
|
62229
62255
|
}, _callee2);
|
|
62230
62256
|
}));
|
|
62231
|
-
return _signInStandard.apply(this, arguments);
|
|
62257
|
+
return _signInStandard$2.apply(this, arguments);
|
|
62232
62258
|
}
|
|
62233
62259
|
var VeripassStandardSignin = function VeripassStandardSignin(_ref2) {
|
|
62234
62260
|
var _window;
|
|
62235
|
-
var _ref2$
|
|
62236
|
-
|
|
62237
|
-
|
|
62238
|
-
|
|
62261
|
+
var _ref2$organization = _ref2.organization,
|
|
62262
|
+
organization = _ref2$organization === void 0 ? {
|
|
62263
|
+
logoSrc: '',
|
|
62264
|
+
slogan: ''
|
|
62265
|
+
} : _ref2$organization,
|
|
62239
62266
|
_ref2$redirectUrl = _ref2.redirectUrl,
|
|
62240
62267
|
redirectUrl = _ref2$redirectUrl === void 0 ? '' : _ref2$redirectUrl,
|
|
62241
62268
|
_ref2$debug = _ref2.debug,
|
|
@@ -62308,7 +62335,7 @@ var VeripassStandardSignin = function VeripassStandardSignin(_ref2) {
|
|
|
62308
62335
|
break;
|
|
62309
62336
|
}
|
|
62310
62337
|
_context.next = 6;
|
|
62311
|
-
return swal.fire({
|
|
62338
|
+
return swal$3.fire({
|
|
62312
62339
|
title: 'Error entering',
|
|
62313
62340
|
text: 'Please enter an email.',
|
|
62314
62341
|
icon: 'error'
|
|
@@ -62321,7 +62348,7 @@ var VeripassStandardSignin = function VeripassStandardSignin(_ref2) {
|
|
|
62321
62348
|
break;
|
|
62322
62349
|
}
|
|
62323
62350
|
_context.next = 10;
|
|
62324
|
-
return swal.fire({
|
|
62351
|
+
return swal$3.fire({
|
|
62325
62352
|
title: 'Error entering',
|
|
62326
62353
|
text: 'Please enter a password.',
|
|
62327
62354
|
icon: 'error'
|
|
@@ -62330,7 +62357,7 @@ var VeripassStandardSignin = function VeripassStandardSignin(_ref2) {
|
|
|
62330
62357
|
return _context.abrupt("return");
|
|
62331
62358
|
case 11:
|
|
62332
62359
|
_context.next = 13;
|
|
62333
|
-
return signInStandard({
|
|
62360
|
+
return signInStandard$2({
|
|
62334
62361
|
payload: {
|
|
62335
62362
|
email: email,
|
|
62336
62363
|
password: password
|
|
@@ -62364,19 +62391,17 @@ var VeripassStandardSignin = function VeripassStandardSignin(_ref2) {
|
|
|
62364
62391
|
var initializeComponent = function initializeComponent() {
|
|
62365
62392
|
setErrors();
|
|
62366
62393
|
};
|
|
62367
|
-
useEffect(function () {
|
|
62394
|
+
useEffect$1(function () {
|
|
62368
62395
|
initializeComponent();
|
|
62369
62396
|
}, []);
|
|
62370
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(
|
|
62371
|
-
className: "veripass"
|
|
62372
|
-
}, /*#__PURE__*/React__default.createElement("header", {
|
|
62397
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(StandardContainer, null, /*#__PURE__*/React__default.createElement("header", {
|
|
62373
62398
|
style: {
|
|
62374
62399
|
textAlign: 'center'
|
|
62375
62400
|
}
|
|
62376
62401
|
}, /*#__PURE__*/React__default.createElement("a", {
|
|
62377
62402
|
href: "/"
|
|
62378
62403
|
}, /*#__PURE__*/React__default.createElement("img", {
|
|
62379
|
-
src:
|
|
62404
|
+
src: organization === null || organization === void 0 ? void 0 : organization.logoSrc,
|
|
62380
62405
|
alt: "",
|
|
62381
62406
|
height: "75",
|
|
62382
62407
|
style: {
|
|
@@ -62391,20 +62416,12 @@ var VeripassStandardSignin = function VeripassStandardSignin(_ref2) {
|
|
|
62391
62416
|
color: '#98a6ad',
|
|
62392
62417
|
fontWeight: 300
|
|
62393
62418
|
}
|
|
62394
|
-
},
|
|
62395
|
-
style: {
|
|
62396
|
-
border: '1px solid #f2f2f2',
|
|
62397
|
-
borderRadius: '8px',
|
|
62398
|
-
padding: '2.25rem',
|
|
62399
|
-
boxShadow: '0 .75rem 6rem rgba(56, 65, 74, 0.03)',
|
|
62400
|
-
background: '#FFFFFF'
|
|
62401
|
-
}
|
|
62402
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
62419
|
+
}, organization === null || organization === void 0 ? void 0 : organization.slogan)), /*#__PURE__*/React__default.createElement(Card, null, /*#__PURE__*/React__default.createElement("div", {
|
|
62403
62420
|
style: {
|
|
62404
62421
|
textAlign: 'center',
|
|
62405
62422
|
marginBottom: '32px'
|
|
62406
62423
|
}
|
|
62407
|
-
}, /*#__PURE__*/React__default.createElement(KarlaTypography
|
|
62424
|
+
}, /*#__PURE__*/React__default.createElement(KarlaTypography, {
|
|
62408
62425
|
style: {
|
|
62409
62426
|
color: '#343a40'
|
|
62410
62427
|
}
|
|
@@ -62520,9 +62537,6 @@ var VeripassStandardSignin = function VeripassStandardSignin(_ref2) {
|
|
|
62520
62537
|
}), isLoading ? 'Loading...' : 'Log in'))))));
|
|
62521
62538
|
};
|
|
62522
62539
|
|
|
62523
|
-
var _templateObject, _templateObject2;
|
|
62524
|
-
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"])));
|
|
62525
|
-
var KarlaTypography = ut.span(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n font-family: 'Karla', 'Roboto', sans-serif !important;\n font-weight: 600;\n"])));
|
|
62526
62540
|
var VeripassLogoutSuccess = function VeripassLogoutSuccess(_ref) {
|
|
62527
62541
|
var _ref$organization = _ref.organization,
|
|
62528
62542
|
organization = _ref$organization === void 0 ? {
|
|
@@ -62538,19 +62552,10 @@ var VeripassLogoutSuccess = function VeripassLogoutSuccess(_ref) {
|
|
|
62538
62552
|
signinText: 'Sign in'
|
|
62539
62553
|
} : _ref$texts;
|
|
62540
62554
|
var authProvider = useAuth();
|
|
62541
|
-
useEffect(function () {
|
|
62555
|
+
useEffect$1(function () {
|
|
62542
62556
|
authProvider.logout();
|
|
62543
62557
|
}, []);
|
|
62544
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(
|
|
62545
|
-
style: {
|
|
62546
|
-
border: '1px solid #f2f2f2',
|
|
62547
|
-
borderRadius: '8px',
|
|
62548
|
-
padding: '2.25rem',
|
|
62549
|
-
boxShadow: '0 .75rem 6rem rgba(56, 65, 74, 0.03)',
|
|
62550
|
-
background: '#FFFFFF'
|
|
62551
|
-
},
|
|
62552
|
-
className: "veripass"
|
|
62553
|
-
}, /*#__PURE__*/React__default.createElement("header", {
|
|
62558
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(StandardContainer, null, /*#__PURE__*/React__default.createElement(Card, null, /*#__PURE__*/React__default.createElement("header", {
|
|
62554
62559
|
style: {
|
|
62555
62560
|
textAlign: 'center'
|
|
62556
62561
|
}
|
|
@@ -62636,5 +62641,829 @@ var VeripassLogoutSuccess = function VeripassLogoutSuccess(_ref) {
|
|
|
62636
62641
|
}, /*#__PURE__*/React__default.createElement("b", null, texts === null || texts === void 0 ? void 0 : texts.signinText)))))));
|
|
62637
62642
|
};
|
|
62638
62643
|
|
|
62639
|
-
|
|
62644
|
+
var swal$2 = withReactContent(Swal);
|
|
62645
|
+
var statusCodeMessages$2 = {
|
|
62646
|
+
461: 'The data provided does not match any registered application',
|
|
62647
|
+
462: 'Unauthorized user. After 3 failed attempts, your account will be locked for 24 hours.',
|
|
62648
|
+
463: 'The user is not registered in this application, needs to register',
|
|
62649
|
+
464: 'Unauthorized. After 3 failed attempts, your account will be locked for 24 hours.',
|
|
62650
|
+
465: 'API key is missing or invalid',
|
|
62651
|
+
401: 'Error authenticating'
|
|
62652
|
+
};
|
|
62653
|
+
function signInStandard$1(_x) {
|
|
62654
|
+
return _signInStandard$1.apply(this, arguments);
|
|
62655
|
+
}
|
|
62656
|
+
function _signInStandard$1() {
|
|
62657
|
+
_signInStandard$1 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
|
|
62658
|
+
var payload, authProvider, redirectUrl, apiKey, debug, entityService, entityResponse;
|
|
62659
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
62660
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
62661
|
+
case 0:
|
|
62662
|
+
payload = _ref.payload, authProvider = _ref.authProvider, redirectUrl = _ref.redirectUrl, apiKey = _ref.apiKey, debug = _ref.debug;
|
|
62663
|
+
entityService = new SecurityService({
|
|
62664
|
+
apiKey: apiKey,
|
|
62665
|
+
settings: {
|
|
62666
|
+
debug: debug
|
|
62667
|
+
}
|
|
62668
|
+
});
|
|
62669
|
+
_context2.next = 4;
|
|
62670
|
+
return entityService.signInStandard(payload);
|
|
62671
|
+
case 4:
|
|
62672
|
+
entityResponse = _context2.sent;
|
|
62673
|
+
if (!(!entityResponse || !entityResponse.result)) {
|
|
62674
|
+
_context2.next = 9;
|
|
62675
|
+
break;
|
|
62676
|
+
}
|
|
62677
|
+
_context2.next = 8;
|
|
62678
|
+
return swal$2.fire({
|
|
62679
|
+
title: 'Sign-in error',
|
|
62680
|
+
text: statusCodeMessages$2[entityResponse.status] || 'An error occurred',
|
|
62681
|
+
icon: 'error'
|
|
62682
|
+
});
|
|
62683
|
+
case 8:
|
|
62684
|
+
return _context2.abrupt("return");
|
|
62685
|
+
case 9:
|
|
62686
|
+
authProvider.login({
|
|
62687
|
+
user: entityResponse.result || {},
|
|
62688
|
+
redirectUrl: redirectUrl
|
|
62689
|
+
});
|
|
62690
|
+
case 10:
|
|
62691
|
+
case "end":
|
|
62692
|
+
return _context2.stop();
|
|
62693
|
+
}
|
|
62694
|
+
}, _callee2);
|
|
62695
|
+
}));
|
|
62696
|
+
return _signInStandard$1.apply(this, arguments);
|
|
62697
|
+
}
|
|
62698
|
+
var VeripassStandardRecoverPassword = function VeripassStandardRecoverPassword(_ref2) {
|
|
62699
|
+
var _window;
|
|
62700
|
+
var _ref2$organization = _ref2.organization,
|
|
62701
|
+
organization = _ref2$organization === void 0 ? {
|
|
62702
|
+
logoSrc: '',
|
|
62703
|
+
slogan: ''
|
|
62704
|
+
} : _ref2$organization,
|
|
62705
|
+
_ref2$redirectUrl = _ref2.redirectUrl,
|
|
62706
|
+
redirectUrl = _ref2$redirectUrl === void 0 ? '' : _ref2$redirectUrl,
|
|
62707
|
+
_ref2$debug = _ref2.debug,
|
|
62708
|
+
debug = _ref2$debug === void 0 ? false : _ref2$debug,
|
|
62709
|
+
_ref2$apiKey = _ref2.apiKey,
|
|
62710
|
+
apiKey = _ref2$apiKey === void 0 ? '' : _ref2$apiKey;
|
|
62711
|
+
// Hooks
|
|
62712
|
+
var authProvider = useAuth();
|
|
62713
|
+
var searchParams = new URLSearchParams((_window = window) === null || _window === void 0 || (_window = _window.location) === null || _window === void 0 ? void 0 : _window.search);
|
|
62714
|
+
|
|
62715
|
+
// UI States
|
|
62716
|
+
var _useState = useState(false),
|
|
62717
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
62718
|
+
isLoading = _useState2[0],
|
|
62719
|
+
setIsLoading = _useState2[1];
|
|
62720
|
+
var _React$useState = React__default.useState(false),
|
|
62721
|
+
_React$useState2 = _slicedToArray(_React$useState, 2);
|
|
62722
|
+
_React$useState2[0];
|
|
62723
|
+
_React$useState2[1];
|
|
62724
|
+
|
|
62725
|
+
// Entity states
|
|
62726
|
+
var _useState3 = useState(''),
|
|
62727
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
62728
|
+
email = _useState4[0],
|
|
62729
|
+
setEmail = _useState4[1];
|
|
62730
|
+
var showError = function showError(_ref3) {
|
|
62731
|
+
var title = _ref3.title,
|
|
62732
|
+
message = _ref3.message;
|
|
62733
|
+
Swal.fire({
|
|
62734
|
+
title: title || 'Failed to sign-in',
|
|
62735
|
+
text: message || '',
|
|
62736
|
+
icon: 'error'
|
|
62737
|
+
}).then(function () {
|
|
62738
|
+
var _window2;
|
|
62739
|
+
searchParams["delete"]('error');
|
|
62740
|
+
window.location.replace("".concat((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.location) === null || _window2 === void 0 ? void 0 : _window2.pathname, "?").concat(searchParams.toString()));
|
|
62741
|
+
});
|
|
62742
|
+
};
|
|
62743
|
+
var setErrors = function setErrors() {
|
|
62744
|
+
var error = searchParams.get('error');
|
|
62745
|
+
switch (error) {
|
|
62746
|
+
case 'insufficient_permissions':
|
|
62747
|
+
showError({
|
|
62748
|
+
title: 'Insufficient permissions',
|
|
62749
|
+
message: 'You do not have sufficient permissions to enter.'
|
|
62750
|
+
});
|
|
62751
|
+
break;
|
|
62752
|
+
case 'access_denied':
|
|
62753
|
+
showError({
|
|
62754
|
+
title: 'Access denied',
|
|
62755
|
+
message: 'Your account does not have access to this application.'
|
|
62756
|
+
});
|
|
62757
|
+
break;
|
|
62758
|
+
}
|
|
62759
|
+
};
|
|
62760
|
+
var handleSubmit = /*#__PURE__*/function () {
|
|
62761
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
|
|
62762
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
62763
|
+
while (1) switch (_context.prev = _context.next) {
|
|
62764
|
+
case 0:
|
|
62765
|
+
_context.prev = 0;
|
|
62766
|
+
event.preventDefault();
|
|
62767
|
+
setIsLoading(true);
|
|
62768
|
+
if (email) {
|
|
62769
|
+
_context.next = 7;
|
|
62770
|
+
break;
|
|
62771
|
+
}
|
|
62772
|
+
_context.next = 6;
|
|
62773
|
+
return swal$2.fire({
|
|
62774
|
+
title: 'Error entering',
|
|
62775
|
+
text: 'Please enter an email.',
|
|
62776
|
+
icon: 'error'
|
|
62777
|
+
});
|
|
62778
|
+
case 6:
|
|
62779
|
+
return _context.abrupt("return");
|
|
62780
|
+
case 7:
|
|
62781
|
+
_context.next = 9;
|
|
62782
|
+
return signInStandard$1({
|
|
62783
|
+
payload: {
|
|
62784
|
+
email: email
|
|
62785
|
+
},
|
|
62786
|
+
authProvider: authProvider,
|
|
62787
|
+
redirectUrl: redirectUrl,
|
|
62788
|
+
apiKey: apiKey,
|
|
62789
|
+
debug: debug
|
|
62790
|
+
});
|
|
62791
|
+
case 9:
|
|
62792
|
+
_context.next = 14;
|
|
62793
|
+
break;
|
|
62794
|
+
case 11:
|
|
62795
|
+
_context.prev = 11;
|
|
62796
|
+
_context.t0 = _context["catch"](0);
|
|
62797
|
+
console.error(_context.t0);
|
|
62798
|
+
case 14:
|
|
62799
|
+
_context.prev = 14;
|
|
62800
|
+
setIsLoading(false);
|
|
62801
|
+
return _context.finish(14);
|
|
62802
|
+
case 17:
|
|
62803
|
+
case "end":
|
|
62804
|
+
return _context.stop();
|
|
62805
|
+
}
|
|
62806
|
+
}, _callee, null, [[0, 11, 14, 17]]);
|
|
62807
|
+
}));
|
|
62808
|
+
return function handleSubmit(_x2) {
|
|
62809
|
+
return _ref4.apply(this, arguments);
|
|
62810
|
+
};
|
|
62811
|
+
}();
|
|
62812
|
+
var initializeComponent = function initializeComponent() {
|
|
62813
|
+
setErrors();
|
|
62814
|
+
};
|
|
62815
|
+
useEffect$1(function () {
|
|
62816
|
+
initializeComponent();
|
|
62817
|
+
}, []);
|
|
62818
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(StandardContainer, null, /*#__PURE__*/React__default.createElement("header", {
|
|
62819
|
+
style: {
|
|
62820
|
+
textAlign: 'center'
|
|
62821
|
+
}
|
|
62822
|
+
}, /*#__PURE__*/React__default.createElement("a", {
|
|
62823
|
+
href: "/"
|
|
62824
|
+
}, /*#__PURE__*/React__default.createElement("img", {
|
|
62825
|
+
src: organization === null || organization === void 0 ? void 0 : organization.logoSrc,
|
|
62826
|
+
alt: "",
|
|
62827
|
+
height: "75",
|
|
62828
|
+
style: {
|
|
62829
|
+
display: 'block',
|
|
62830
|
+
margin: '0 auto'
|
|
62831
|
+
}
|
|
62832
|
+
})), /*#__PURE__*/React__default.createElement(Typography$1, {
|
|
62833
|
+
variant: "body2",
|
|
62834
|
+
style: {
|
|
62835
|
+
marginTop: '16px',
|
|
62836
|
+
marginBottom: '24px',
|
|
62837
|
+
color: '#98a6ad',
|
|
62838
|
+
fontWeight: 300
|
|
62839
|
+
}
|
|
62840
|
+
}, organization === null || organization === void 0 ? void 0 : organization.slogan)), /*#__PURE__*/React__default.createElement(Card, null, /*#__PURE__*/React__default.createElement("div", {
|
|
62841
|
+
style: {
|
|
62842
|
+
textAlign: 'center',
|
|
62843
|
+
marginBottom: '32px'
|
|
62844
|
+
}
|
|
62845
|
+
}, /*#__PURE__*/React__default.createElement(KarlaTypography, {
|
|
62846
|
+
style: {
|
|
62847
|
+
color: '#343a40'
|
|
62848
|
+
}
|
|
62849
|
+
}, "Recover password")), /*#__PURE__*/React__default.createElement("form", {
|
|
62850
|
+
onSubmit: handleSubmit,
|
|
62851
|
+
autoComplete: "off"
|
|
62852
|
+
}, /*#__PURE__*/React__default.createElement("section", {
|
|
62853
|
+
style: {
|
|
62854
|
+
marginBottom: '16px',
|
|
62855
|
+
margin: '10px 0'
|
|
62856
|
+
}
|
|
62857
|
+
}, /*#__PURE__*/React__default.createElement(TextField$1, {
|
|
62858
|
+
fullWidth: true,
|
|
62859
|
+
type: "email",
|
|
62860
|
+
id: "email-input",
|
|
62861
|
+
label: "Email address",
|
|
62862
|
+
value: email,
|
|
62863
|
+
placeholder: "Type your email",
|
|
62864
|
+
required: true,
|
|
62865
|
+
onChange: function onChange(e) {
|
|
62866
|
+
return setEmail(e.target.value);
|
|
62867
|
+
},
|
|
62868
|
+
autoComplete: "etrune-email",
|
|
62869
|
+
InputLabelProps: {
|
|
62870
|
+
shrink: true
|
|
62871
|
+
}
|
|
62872
|
+
})), /*#__PURE__*/React__default.createElement("footer", {
|
|
62873
|
+
style: {
|
|
62874
|
+
marginBottom: '16px',
|
|
62875
|
+
display: 'flex',
|
|
62876
|
+
justifyContent: 'center'
|
|
62877
|
+
}
|
|
62878
|
+
}, /*#__PURE__*/React__default.createElement(Button$1, {
|
|
62879
|
+
type: "submit",
|
|
62880
|
+
variant: "contained",
|
|
62881
|
+
disabled: isLoading,
|
|
62882
|
+
sx: {
|
|
62883
|
+
display: 'flex',
|
|
62884
|
+
alignItems: 'center',
|
|
62885
|
+
border: '2px solid #232931',
|
|
62886
|
+
backgroundColor: '#323a46',
|
|
62887
|
+
color: '#fff',
|
|
62888
|
+
'&:hover': {
|
|
62889
|
+
backgroundColor: '#3d4c61'
|
|
62890
|
+
},
|
|
62891
|
+
width: '100%'
|
|
62892
|
+
}
|
|
62893
|
+
}, isLoading && /*#__PURE__*/React__default.createElement(CircularProgress$1, {
|
|
62894
|
+
size: 20,
|
|
62895
|
+
style: {
|
|
62896
|
+
marginRight: '8px',
|
|
62897
|
+
color: '#fff'
|
|
62898
|
+
}
|
|
62899
|
+
}), isLoading ? 'Recovering...' : 'Recover'))))));
|
|
62900
|
+
};
|
|
62901
|
+
|
|
62902
|
+
var swal$1 = withReactContent(Swal);
|
|
62903
|
+
var statusCodeMessages$1 = {
|
|
62904
|
+
461: 'The data provided does not match any registered application',
|
|
62905
|
+
462: 'Unauthorized user. After 3 failed attempts, your account will be locked for 24 hours.',
|
|
62906
|
+
463: 'The user is not registered in this application, needs to register',
|
|
62907
|
+
464: 'Unauthorized. After 3 failed attempts, your account will be locked for 24 hours.',
|
|
62908
|
+
465: 'API key is missing or invalid',
|
|
62909
|
+
401: 'Error authenticating'
|
|
62910
|
+
};
|
|
62911
|
+
function signInStandard(_x) {
|
|
62912
|
+
return _signInStandard.apply(this, arguments);
|
|
62913
|
+
}
|
|
62914
|
+
function _signInStandard() {
|
|
62915
|
+
_signInStandard = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
|
|
62916
|
+
var payload, authProvider, redirectUrl, apiKey, debug, entityService, entityResponse;
|
|
62917
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
62918
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
62919
|
+
case 0:
|
|
62920
|
+
payload = _ref.payload, authProvider = _ref.authProvider, redirectUrl = _ref.redirectUrl, apiKey = _ref.apiKey, debug = _ref.debug;
|
|
62921
|
+
entityService = new SecurityService({
|
|
62922
|
+
apiKey: apiKey,
|
|
62923
|
+
settings: {
|
|
62924
|
+
debug: debug
|
|
62925
|
+
}
|
|
62926
|
+
});
|
|
62927
|
+
_context2.next = 4;
|
|
62928
|
+
return entityService.signInStandard(payload);
|
|
62929
|
+
case 4:
|
|
62930
|
+
entityResponse = _context2.sent;
|
|
62931
|
+
if (!(!entityResponse || !entityResponse.result)) {
|
|
62932
|
+
_context2.next = 9;
|
|
62933
|
+
break;
|
|
62934
|
+
}
|
|
62935
|
+
_context2.next = 8;
|
|
62936
|
+
return swal$1.fire({
|
|
62937
|
+
title: 'Sign-in error',
|
|
62938
|
+
text: statusCodeMessages$1[entityResponse.status] || 'An error occurred',
|
|
62939
|
+
icon: 'error'
|
|
62940
|
+
});
|
|
62941
|
+
case 8:
|
|
62942
|
+
return _context2.abrupt("return");
|
|
62943
|
+
case 9:
|
|
62944
|
+
authProvider.login({
|
|
62945
|
+
user: entityResponse.result || {},
|
|
62946
|
+
redirectUrl: redirectUrl
|
|
62947
|
+
});
|
|
62948
|
+
case 10:
|
|
62949
|
+
case "end":
|
|
62950
|
+
return _context2.stop();
|
|
62951
|
+
}
|
|
62952
|
+
}, _callee2);
|
|
62953
|
+
}));
|
|
62954
|
+
return _signInStandard.apply(this, arguments);
|
|
62955
|
+
}
|
|
62956
|
+
var VeripassNewPassword = function VeripassNewPassword(_ref2) {
|
|
62957
|
+
var _window;
|
|
62958
|
+
var _ref2$organization = _ref2.organization,
|
|
62959
|
+
organization = _ref2$organization === void 0 ? {
|
|
62960
|
+
logoSrc: '',
|
|
62961
|
+
slogan: ''
|
|
62962
|
+
} : _ref2$organization,
|
|
62963
|
+
_ref2$redirectUrl = _ref2.redirectUrl,
|
|
62964
|
+
redirectUrl = _ref2$redirectUrl === void 0 ? '' : _ref2$redirectUrl,
|
|
62965
|
+
_ref2$debug = _ref2.debug,
|
|
62966
|
+
debug = _ref2$debug === void 0 ? false : _ref2$debug,
|
|
62967
|
+
_ref2$apiKey = _ref2.apiKey,
|
|
62968
|
+
apiKey = _ref2$apiKey === void 0 ? '' : _ref2$apiKey;
|
|
62969
|
+
// Hooks
|
|
62970
|
+
var authProvider = useAuth();
|
|
62971
|
+
var searchParams = new URLSearchParams((_window = window) === null || _window === void 0 || (_window = _window.location) === null || _window === void 0 ? void 0 : _window.search);
|
|
62972
|
+
|
|
62973
|
+
// UI States
|
|
62974
|
+
var _useState = useState(false),
|
|
62975
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
62976
|
+
isLoading = _useState2[0],
|
|
62977
|
+
setIsLoading = _useState2[1];
|
|
62978
|
+
var _React$useState = React__default.useState(false),
|
|
62979
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
62980
|
+
showPassword = _React$useState2[0],
|
|
62981
|
+
setShowPassword = _React$useState2[1];
|
|
62982
|
+
|
|
62983
|
+
// Entity states
|
|
62984
|
+
var _useState3 = useState(''),
|
|
62985
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
62986
|
+
password = _useState4[0],
|
|
62987
|
+
setPassword = _useState4[1];
|
|
62988
|
+
var showError = function showError(_ref3) {
|
|
62989
|
+
var title = _ref3.title,
|
|
62990
|
+
message = _ref3.message;
|
|
62991
|
+
Swal.fire({
|
|
62992
|
+
title: title || 'Failed to sign-in',
|
|
62993
|
+
text: message || '',
|
|
62994
|
+
icon: 'error'
|
|
62995
|
+
}).then(function () {
|
|
62996
|
+
var _window2;
|
|
62997
|
+
searchParams["delete"]('error');
|
|
62998
|
+
window.location.replace("".concat((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.location) === null || _window2 === void 0 ? void 0 : _window2.pathname, "?").concat(searchParams.toString()));
|
|
62999
|
+
});
|
|
63000
|
+
};
|
|
63001
|
+
var setErrors = function setErrors() {
|
|
63002
|
+
var error = searchParams.get('error');
|
|
63003
|
+
switch (error) {
|
|
63004
|
+
case 'insufficient_permissions':
|
|
63005
|
+
showError({
|
|
63006
|
+
title: 'Insufficient permissions',
|
|
63007
|
+
message: 'You do not have sufficient permissions to enter.'
|
|
63008
|
+
});
|
|
63009
|
+
break;
|
|
63010
|
+
case 'access_denied':
|
|
63011
|
+
showError({
|
|
63012
|
+
title: 'Access denied',
|
|
63013
|
+
message: 'Your account does not have access to this application.'
|
|
63014
|
+
});
|
|
63015
|
+
break;
|
|
63016
|
+
}
|
|
63017
|
+
};
|
|
63018
|
+
var handleSubmit = /*#__PURE__*/function () {
|
|
63019
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
|
|
63020
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
63021
|
+
while (1) switch (_context.prev = _context.next) {
|
|
63022
|
+
case 0:
|
|
63023
|
+
_context.prev = 0;
|
|
63024
|
+
event.preventDefault();
|
|
63025
|
+
setIsLoading(true);
|
|
63026
|
+
if (password) {
|
|
63027
|
+
_context.next = 7;
|
|
63028
|
+
break;
|
|
63029
|
+
}
|
|
63030
|
+
_context.next = 6;
|
|
63031
|
+
return swal$1.fire({
|
|
63032
|
+
title: 'Error entering',
|
|
63033
|
+
text: 'Please enter a password.',
|
|
63034
|
+
icon: 'error'
|
|
63035
|
+
});
|
|
63036
|
+
case 6:
|
|
63037
|
+
return _context.abrupt("return");
|
|
63038
|
+
case 7:
|
|
63039
|
+
_context.next = 9;
|
|
63040
|
+
return signInStandard({
|
|
63041
|
+
payload: {
|
|
63042
|
+
password: password
|
|
63043
|
+
},
|
|
63044
|
+
authProvider: authProvider,
|
|
63045
|
+
redirectUrl: redirectUrl,
|
|
63046
|
+
apiKey: apiKey,
|
|
63047
|
+
debug: debug
|
|
63048
|
+
});
|
|
63049
|
+
case 9:
|
|
63050
|
+
_context.next = 14;
|
|
63051
|
+
break;
|
|
63052
|
+
case 11:
|
|
63053
|
+
_context.prev = 11;
|
|
63054
|
+
_context.t0 = _context["catch"](0);
|
|
63055
|
+
console.error(_context.t0);
|
|
63056
|
+
case 14:
|
|
63057
|
+
_context.prev = 14;
|
|
63058
|
+
setIsLoading(false);
|
|
63059
|
+
return _context.finish(14);
|
|
63060
|
+
case 17:
|
|
63061
|
+
case "end":
|
|
63062
|
+
return _context.stop();
|
|
63063
|
+
}
|
|
63064
|
+
}, _callee, null, [[0, 11, 14, 17]]);
|
|
63065
|
+
}));
|
|
63066
|
+
return function handleSubmit(_x2) {
|
|
63067
|
+
return _ref4.apply(this, arguments);
|
|
63068
|
+
};
|
|
63069
|
+
}();
|
|
63070
|
+
var initializeComponent = function initializeComponent() {
|
|
63071
|
+
setErrors();
|
|
63072
|
+
};
|
|
63073
|
+
useEffect$1(function () {
|
|
63074
|
+
initializeComponent();
|
|
63075
|
+
}, []);
|
|
63076
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(StandardContainer, null, /*#__PURE__*/React__default.createElement("header", {
|
|
63077
|
+
style: {
|
|
63078
|
+
textAlign: 'center'
|
|
63079
|
+
}
|
|
63080
|
+
}, /*#__PURE__*/React__default.createElement("a", {
|
|
63081
|
+
href: "/"
|
|
63082
|
+
}, /*#__PURE__*/React__default.createElement("img", {
|
|
63083
|
+
src: organization === null || organization === void 0 ? void 0 : organization.logoSrc,
|
|
63084
|
+
alt: "",
|
|
63085
|
+
height: "75",
|
|
63086
|
+
style: {
|
|
63087
|
+
display: 'block',
|
|
63088
|
+
margin: '0 auto'
|
|
63089
|
+
}
|
|
63090
|
+
})), /*#__PURE__*/React__default.createElement(Typography$1, {
|
|
63091
|
+
variant: "body2",
|
|
63092
|
+
style: {
|
|
63093
|
+
marginTop: '16px',
|
|
63094
|
+
marginBottom: '24px',
|
|
63095
|
+
color: '#98a6ad',
|
|
63096
|
+
fontWeight: 300
|
|
63097
|
+
}
|
|
63098
|
+
}, organization === null || organization === void 0 ? void 0 : organization.slogan)), /*#__PURE__*/React__default.createElement(Card, null, /*#__PURE__*/React__default.createElement("div", {
|
|
63099
|
+
style: {
|
|
63100
|
+
textAlign: 'center',
|
|
63101
|
+
marginBottom: '32px'
|
|
63102
|
+
}
|
|
63103
|
+
}, /*#__PURE__*/React__default.createElement(KarlaTypography, {
|
|
63104
|
+
style: {
|
|
63105
|
+
color: '#343a40'
|
|
63106
|
+
}
|
|
63107
|
+
}, "New password")), /*#__PURE__*/React__default.createElement("form", {
|
|
63108
|
+
onSubmit: handleSubmit,
|
|
63109
|
+
autoComplete: "off"
|
|
63110
|
+
}, /*#__PURE__*/React__default.createElement("section", {
|
|
63111
|
+
style: {
|
|
63112
|
+
marginBottom: '16px'
|
|
63113
|
+
}
|
|
63114
|
+
}, /*#__PURE__*/React__default.createElement(TextField$1, {
|
|
63115
|
+
fullWidth: true,
|
|
63116
|
+
label: "Password",
|
|
63117
|
+
type: showPassword ? 'text' : 'password',
|
|
63118
|
+
value: password,
|
|
63119
|
+
onChange: function onChange(event) {
|
|
63120
|
+
return setPassword(event.target.value);
|
|
63121
|
+
},
|
|
63122
|
+
InputProps: {
|
|
63123
|
+
endAdornment: /*#__PURE__*/React__default.createElement(InputAdornment$1, {
|
|
63124
|
+
position: "end"
|
|
63125
|
+
}, /*#__PURE__*/React__default.createElement(IconButton$1, {
|
|
63126
|
+
"aria-label": "toggle password visibility",
|
|
63127
|
+
onClick: function onClick() {
|
|
63128
|
+
return setShowPassword(function (show) {
|
|
63129
|
+
return !show;
|
|
63130
|
+
});
|
|
63131
|
+
},
|
|
63132
|
+
onMouseDown: function onMouseDown(event) {
|
|
63133
|
+
event.preventDefault();
|
|
63134
|
+
},
|
|
63135
|
+
edge: "end"
|
|
63136
|
+
}, showPassword ? /*#__PURE__*/React__default.createElement(VisibilityIcon, null) : /*#__PURE__*/React__default.createElement(VisibilityOffIcon, null)))
|
|
63137
|
+
},
|
|
63138
|
+
InputLabelProps: {
|
|
63139
|
+
shrink: true
|
|
63140
|
+
}
|
|
63141
|
+
})), /*#__PURE__*/React__default.createElement("footer", {
|
|
63142
|
+
style: {
|
|
63143
|
+
marginBottom: '16px',
|
|
63144
|
+
display: 'flex',
|
|
63145
|
+
justifyContent: 'center'
|
|
63146
|
+
}
|
|
63147
|
+
}, /*#__PURE__*/React__default.createElement(Button$1, {
|
|
63148
|
+
type: "submit",
|
|
63149
|
+
variant: "contained",
|
|
63150
|
+
disabled: isLoading,
|
|
63151
|
+
sx: {
|
|
63152
|
+
display: 'flex',
|
|
63153
|
+
alignItems: 'center',
|
|
63154
|
+
border: '2px solid #232931',
|
|
63155
|
+
backgroundColor: '#323a46',
|
|
63156
|
+
color: '#fff',
|
|
63157
|
+
'&:hover': {
|
|
63158
|
+
backgroundColor: '#3d4c61'
|
|
63159
|
+
},
|
|
63160
|
+
width: '100%'
|
|
63161
|
+
}
|
|
63162
|
+
}, isLoading && /*#__PURE__*/React__default.createElement(CircularProgress$1, {
|
|
63163
|
+
size: 20,
|
|
63164
|
+
style: {
|
|
63165
|
+
marginRight: '8px',
|
|
63166
|
+
color: '#fff'
|
|
63167
|
+
}
|
|
63168
|
+
}), isLoading ? 'Changing...' : 'Change password'))))));
|
|
63169
|
+
};
|
|
63170
|
+
|
|
63171
|
+
var swal = withReactContent(Swal);
|
|
63172
|
+
var statusCodeMessages = {
|
|
63173
|
+
461: 'The data provided does not match any registered application',
|
|
63174
|
+
462: 'Unauthorized user. After 3 failed attempts, your account will be locked for 24 hours.',
|
|
63175
|
+
463: 'The user is not registered in this application, needs to register',
|
|
63176
|
+
464: 'Unauthorized. After 3 failed attempts, your account will be locked for 24 hours.',
|
|
63177
|
+
465: 'API key is missing or invalid',
|
|
63178
|
+
401: 'Error authenticating'
|
|
63179
|
+
};
|
|
63180
|
+
function unlockStandard(_x) {
|
|
63181
|
+
return _unlockStandard.apply(this, arguments);
|
|
63182
|
+
}
|
|
63183
|
+
function _unlockStandard() {
|
|
63184
|
+
_unlockStandard = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
|
|
63185
|
+
var payload, authProvider, redirectUrl, apiKey, debug, entityService, entityResponse;
|
|
63186
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
63187
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
63188
|
+
case 0:
|
|
63189
|
+
payload = _ref.payload, authProvider = _ref.authProvider, redirectUrl = _ref.redirectUrl, apiKey = _ref.apiKey, debug = _ref.debug;
|
|
63190
|
+
entityService = new SecurityService({
|
|
63191
|
+
apiKey: apiKey,
|
|
63192
|
+
settings: {
|
|
63193
|
+
debug: debug
|
|
63194
|
+
}
|
|
63195
|
+
});
|
|
63196
|
+
_context2.next = 4;
|
|
63197
|
+
return entityService.signInStandard(payload);
|
|
63198
|
+
case 4:
|
|
63199
|
+
entityResponse = _context2.sent;
|
|
63200
|
+
if (!(!entityResponse || !entityResponse.result)) {
|
|
63201
|
+
_context2.next = 9;
|
|
63202
|
+
break;
|
|
63203
|
+
}
|
|
63204
|
+
_context2.next = 8;
|
|
63205
|
+
return swal.fire({
|
|
63206
|
+
title: 'Sign-in error',
|
|
63207
|
+
text: statusCodeMessages[entityResponse.status] || 'An error occurred',
|
|
63208
|
+
icon: 'error'
|
|
63209
|
+
});
|
|
63210
|
+
case 8:
|
|
63211
|
+
return _context2.abrupt("return");
|
|
63212
|
+
case 9:
|
|
63213
|
+
authProvider.login({
|
|
63214
|
+
user: entityResponse.result || {},
|
|
63215
|
+
redirectUrl: redirectUrl
|
|
63216
|
+
});
|
|
63217
|
+
case 10:
|
|
63218
|
+
case "end":
|
|
63219
|
+
return _context2.stop();
|
|
63220
|
+
}
|
|
63221
|
+
}, _callee2);
|
|
63222
|
+
}));
|
|
63223
|
+
return _unlockStandard.apply(this, arguments);
|
|
63224
|
+
}
|
|
63225
|
+
var VeripassStandardUnlock = function VeripassStandardUnlock(_ref2) {
|
|
63226
|
+
var _window;
|
|
63227
|
+
var _ref2$organization = _ref2.organization,
|
|
63228
|
+
organization = _ref2$organization === void 0 ? {
|
|
63229
|
+
logoSrc: '',
|
|
63230
|
+
slogan: ''
|
|
63231
|
+
} : _ref2$organization,
|
|
63232
|
+
_ref2$redirectUrl = _ref2.redirectUrl,
|
|
63233
|
+
redirectUrl = _ref2$redirectUrl === void 0 ? '' : _ref2$redirectUrl,
|
|
63234
|
+
_ref2$debug = _ref2.debug,
|
|
63235
|
+
debug = _ref2$debug === void 0 ? false : _ref2$debug,
|
|
63236
|
+
_ref2$apiKey = _ref2.apiKey,
|
|
63237
|
+
apiKey = _ref2$apiKey === void 0 ? '' : _ref2$apiKey;
|
|
63238
|
+
// Hooks
|
|
63239
|
+
var authProvider = useAuth();
|
|
63240
|
+
var searchParams = new URLSearchParams((_window = window) === null || _window === void 0 || (_window = _window.location) === null || _window === void 0 ? void 0 : _window.search);
|
|
63241
|
+
|
|
63242
|
+
// UI States
|
|
63243
|
+
var _useState = useState(false),
|
|
63244
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
63245
|
+
isLoading = _useState2[0],
|
|
63246
|
+
setIsLoading = _useState2[1];
|
|
63247
|
+
var _React$useState = React__default.useState(false),
|
|
63248
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
63249
|
+
showPassword = _React$useState2[0],
|
|
63250
|
+
setShowPassword = _React$useState2[1];
|
|
63251
|
+
|
|
63252
|
+
// Entity states
|
|
63253
|
+
var _useState3 = useState(''),
|
|
63254
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
63255
|
+
password = _useState4[0],
|
|
63256
|
+
setPassword = _useState4[1];
|
|
63257
|
+
var showError = function showError(_ref3) {
|
|
63258
|
+
var title = _ref3.title,
|
|
63259
|
+
message = _ref3.message;
|
|
63260
|
+
Swal.fire({
|
|
63261
|
+
title: title || 'Failed to sign-in',
|
|
63262
|
+
text: message || '',
|
|
63263
|
+
icon: 'error'
|
|
63264
|
+
}).then(function () {
|
|
63265
|
+
var _window2;
|
|
63266
|
+
searchParams["delete"]('error');
|
|
63267
|
+
window.location.replace("".concat((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.location) === null || _window2 === void 0 ? void 0 : _window2.pathname, "?").concat(searchParams.toString()));
|
|
63268
|
+
});
|
|
63269
|
+
};
|
|
63270
|
+
var setErrors = function setErrors() {
|
|
63271
|
+
var error = searchParams.get('error');
|
|
63272
|
+
switch (error) {
|
|
63273
|
+
case 'insufficient_permissions':
|
|
63274
|
+
showError({
|
|
63275
|
+
title: 'Insufficient permissions',
|
|
63276
|
+
message: 'You do not have sufficient permissions to enter.'
|
|
63277
|
+
});
|
|
63278
|
+
break;
|
|
63279
|
+
case 'access_denied':
|
|
63280
|
+
showError({
|
|
63281
|
+
title: 'Access denied',
|
|
63282
|
+
message: 'Your account does not have access to this application.'
|
|
63283
|
+
});
|
|
63284
|
+
break;
|
|
63285
|
+
}
|
|
63286
|
+
};
|
|
63287
|
+
var handleSubmit = /*#__PURE__*/function () {
|
|
63288
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
|
|
63289
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
63290
|
+
while (1) switch (_context.prev = _context.next) {
|
|
63291
|
+
case 0:
|
|
63292
|
+
_context.prev = 0;
|
|
63293
|
+
event.preventDefault();
|
|
63294
|
+
setIsLoading(true);
|
|
63295
|
+
if (password) {
|
|
63296
|
+
_context.next = 7;
|
|
63297
|
+
break;
|
|
63298
|
+
}
|
|
63299
|
+
_context.next = 6;
|
|
63300
|
+
return swal.fire({
|
|
63301
|
+
title: 'Error entering',
|
|
63302
|
+
text: 'Please enter a password.',
|
|
63303
|
+
icon: 'error'
|
|
63304
|
+
});
|
|
63305
|
+
case 6:
|
|
63306
|
+
return _context.abrupt("return");
|
|
63307
|
+
case 7:
|
|
63308
|
+
_context.next = 9;
|
|
63309
|
+
return unlockStandard({
|
|
63310
|
+
payload: {
|
|
63311
|
+
password: password
|
|
63312
|
+
},
|
|
63313
|
+
authProvider: authProvider,
|
|
63314
|
+
redirectUrl: redirectUrl,
|
|
63315
|
+
apiKey: apiKey,
|
|
63316
|
+
debug: debug
|
|
63317
|
+
});
|
|
63318
|
+
case 9:
|
|
63319
|
+
_context.next = 14;
|
|
63320
|
+
break;
|
|
63321
|
+
case 11:
|
|
63322
|
+
_context.prev = 11;
|
|
63323
|
+
_context.t0 = _context["catch"](0);
|
|
63324
|
+
console.error(_context.t0);
|
|
63325
|
+
case 14:
|
|
63326
|
+
_context.prev = 14;
|
|
63327
|
+
setIsLoading(false);
|
|
63328
|
+
return _context.finish(14);
|
|
63329
|
+
case 17:
|
|
63330
|
+
case "end":
|
|
63331
|
+
return _context.stop();
|
|
63332
|
+
}
|
|
63333
|
+
}, _callee, null, [[0, 11, 14, 17]]);
|
|
63334
|
+
}));
|
|
63335
|
+
return function handleSubmit(_x2) {
|
|
63336
|
+
return _ref4.apply(this, arguments);
|
|
63337
|
+
};
|
|
63338
|
+
}();
|
|
63339
|
+
var initializeComponent = function initializeComponent() {
|
|
63340
|
+
setErrors();
|
|
63341
|
+
};
|
|
63342
|
+
useEffect$1(function () {
|
|
63343
|
+
initializeComponent();
|
|
63344
|
+
}, []);
|
|
63345
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(StandardContainer, null, /*#__PURE__*/React__default.createElement("header", {
|
|
63346
|
+
style: {
|
|
63347
|
+
textAlign: 'center'
|
|
63348
|
+
}
|
|
63349
|
+
}, /*#__PURE__*/React__default.createElement("a", {
|
|
63350
|
+
href: "/"
|
|
63351
|
+
}, /*#__PURE__*/React__default.createElement("img", {
|
|
63352
|
+
src: organization === null || organization === void 0 ? void 0 : organization.logoSrc,
|
|
63353
|
+
alt: "",
|
|
63354
|
+
height: "75",
|
|
63355
|
+
style: {
|
|
63356
|
+
display: 'block',
|
|
63357
|
+
margin: '0 auto'
|
|
63358
|
+
}
|
|
63359
|
+
})), /*#__PURE__*/React__default.createElement(Typography$1, {
|
|
63360
|
+
variant: "body2",
|
|
63361
|
+
style: {
|
|
63362
|
+
marginTop: '16px',
|
|
63363
|
+
marginBottom: '24px',
|
|
63364
|
+
color: '#98a6ad',
|
|
63365
|
+
fontWeight: 300
|
|
63366
|
+
}
|
|
63367
|
+
}, organization === null || organization === void 0 ? void 0 : organization.slogan)), /*#__PURE__*/React__default.createElement(Card, null, /*#__PURE__*/React__default.createElement("div", {
|
|
63368
|
+
style: {
|
|
63369
|
+
textAlign: 'center',
|
|
63370
|
+
marginBottom: '32px'
|
|
63371
|
+
}
|
|
63372
|
+
}, /*#__PURE__*/React__default.createElement(KarlaTypography, {
|
|
63373
|
+
style: {
|
|
63374
|
+
color: '#343a40'
|
|
63375
|
+
}
|
|
63376
|
+
}, "Welcome again")), /*#__PURE__*/React__default.createElement("form", {
|
|
63377
|
+
onSubmit: handleSubmit,
|
|
63378
|
+
autoComplete: "off"
|
|
63379
|
+
}, /*#__PURE__*/React__default.createElement("section", {
|
|
63380
|
+
style: {
|
|
63381
|
+
marginBottom: '16px'
|
|
63382
|
+
}
|
|
63383
|
+
}, /*#__PURE__*/React__default.createElement(TextField$1, {
|
|
63384
|
+
fullWidth: true,
|
|
63385
|
+
label: "Password",
|
|
63386
|
+
type: showPassword ? 'text' : 'password',
|
|
63387
|
+
value: password,
|
|
63388
|
+
onChange: function onChange(event) {
|
|
63389
|
+
return setPassword(event.target.value);
|
|
63390
|
+
},
|
|
63391
|
+
InputProps: {
|
|
63392
|
+
endAdornment: /*#__PURE__*/React__default.createElement(InputAdornment$1, {
|
|
63393
|
+
position: "end"
|
|
63394
|
+
}, /*#__PURE__*/React__default.createElement(IconButton$1, {
|
|
63395
|
+
"aria-label": "toggle password visibility",
|
|
63396
|
+
onClick: function onClick() {
|
|
63397
|
+
return setShowPassword(function (show) {
|
|
63398
|
+
return !show;
|
|
63399
|
+
});
|
|
63400
|
+
},
|
|
63401
|
+
onMouseDown: function onMouseDown(event) {
|
|
63402
|
+
event.preventDefault();
|
|
63403
|
+
},
|
|
63404
|
+
edge: "end"
|
|
63405
|
+
}, showPassword ? /*#__PURE__*/React__default.createElement(VisibilityIcon, null) : /*#__PURE__*/React__default.createElement(VisibilityOffIcon, null)))
|
|
63406
|
+
},
|
|
63407
|
+
InputLabelProps: {
|
|
63408
|
+
shrink: true
|
|
63409
|
+
}
|
|
63410
|
+
})), /*#__PURE__*/React__default.createElement("section", {
|
|
63411
|
+
style: {
|
|
63412
|
+
marginBottom: '16px',
|
|
63413
|
+
width: '100%'
|
|
63414
|
+
}
|
|
63415
|
+
}, /*#__PURE__*/React__default.createElement(Link$1, {
|
|
63416
|
+
href: "recover-password",
|
|
63417
|
+
underline: "hover",
|
|
63418
|
+
style: {
|
|
63419
|
+
marginLeft: '8px',
|
|
63420
|
+
color: 'gray',
|
|
63421
|
+
width: '100%',
|
|
63422
|
+
display: 'flex',
|
|
63423
|
+
justifyContent: 'flex-end',
|
|
63424
|
+
textDecoration: 'none'
|
|
63425
|
+
}
|
|
63426
|
+
}, /*#__PURE__*/React__default.createElement(LockIcon, {
|
|
63427
|
+
style: {
|
|
63428
|
+
marginRight: '5px',
|
|
63429
|
+
color: '#98a6ad',
|
|
63430
|
+
fontSize: '18px'
|
|
63431
|
+
}
|
|
63432
|
+
}), /*#__PURE__*/React__default.createElement(Typography$1, {
|
|
63433
|
+
variant: "body2",
|
|
63434
|
+
style: {
|
|
63435
|
+
color: '#98a6ad',
|
|
63436
|
+
fontWeight: '400'
|
|
63437
|
+
}
|
|
63438
|
+
}, "Forgot password?"))), /*#__PURE__*/React__default.createElement("footer", {
|
|
63439
|
+
style: {
|
|
63440
|
+
marginBottom: '16px',
|
|
63441
|
+
display: 'flex',
|
|
63442
|
+
justifyContent: 'center'
|
|
63443
|
+
}
|
|
63444
|
+
}, /*#__PURE__*/React__default.createElement(Button$1, {
|
|
63445
|
+
type: "submit",
|
|
63446
|
+
variant: "contained",
|
|
63447
|
+
disabled: isLoading,
|
|
63448
|
+
sx: {
|
|
63449
|
+
display: 'flex',
|
|
63450
|
+
alignItems: 'center',
|
|
63451
|
+
border: '2px solid #232931',
|
|
63452
|
+
backgroundColor: '#323a46',
|
|
63453
|
+
color: '#fff',
|
|
63454
|
+
'&:hover': {
|
|
63455
|
+
backgroundColor: '#3d4c61'
|
|
63456
|
+
},
|
|
63457
|
+
width: '100%'
|
|
63458
|
+
}
|
|
63459
|
+
}, isLoading && /*#__PURE__*/React__default.createElement(CircularProgress$1, {
|
|
63460
|
+
size: 20,
|
|
63461
|
+
style: {
|
|
63462
|
+
marginRight: '8px',
|
|
63463
|
+
color: '#fff'
|
|
63464
|
+
}
|
|
63465
|
+
}), isLoading ? 'Unlocking...' : 'Unlock'))))));
|
|
63466
|
+
};
|
|
63467
|
+
|
|
63468
|
+
export { AuthContext, AuthProvider, VeripassLogoutSuccess, VeripassNewPassword, VeripassStandardRecoverPassword, VeripassStandardSignin, VeripassStandardUnlock, useAuth, useLocalStorage };
|
|
62640
63469
|
//# sourceMappingURL=react-sdk.esm.js.map
|