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