@crystaldesign/diva-core 24.15.0-beta.17 → 24.15.0-beta.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { i as styleInject, u as useDivaCoreContext } from './index-f26449eb.js';
1
+ import { i as styleInject, u as useDivaCoreContext } from './index-ed10cea7.js';
2
2
  import { useState, useEffect, useCallback } from 'react';
3
3
  import { observer } from 'mobx-react-lite';
4
4
  import Button from '@mui/material/Button';
@@ -1,4 +1,4 @@
1
- import { u as useDivaCoreContext, B as Button, s as socialButton, g as google, m as microsoft, a as getLogger, e as error, b as separator, I as Input, r as resetInput, l as link, c as success, d as auth, f as loginBox, h as logoContainer } from './index-f26449eb.js';
1
+ import { u as useDivaCoreContext, B as Button, s as socialButton, g as google, m as microsoft, a as getLogger, e as error, b as separator, I as Input, r as resetInput, l as link, c as success, d as auth, f as loginBox, h as logoContainer } from './index-ed10cea7.js';
2
2
  import { useState, useRef, useEffect, useMemo } from 'react';
3
3
  import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
4
4
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
@@ -140,10 +140,10 @@ function Login() {
140
140
  if (checkInvitation) {
141
141
  if (checkInvitation.isNewUser) {
142
142
  authorizationStore.close();
143
- authorizationStore.showRegister(undefined, email, true);
143
+ authorizationStore.showRegister(undefined, email, checkInvitation.useotp ? true : false);
144
144
  }
145
145
  setInvitationFound(true);
146
- setUseOtp(true);
146
+ if (checkInvitation.useotp) setUseOtp(true);
147
147
  }
148
148
  case 6:
149
149
  _context.next = 8;
@@ -769,7 +769,7 @@ function Register() {
769
769
  case 0:
770
770
  _context.prev = 0;
771
771
  _context.next = 3;
772
- return flowResult(authorizationStore.register(email, password, firstname, familyname, (_authorizationStore$s2 = authorizationStore.state) === null || _authorizationStore$s2 === void 0 ? void 0 : _authorizationStore$s2.invitationId, otp));
772
+ return flowResult(authorizationStore.register(email, password, firstname, familyname, (_authorizationStore$s2 = authorizationStore.state) === null || _authorizationStore$s2 === void 0 ? void 0 : _authorizationStore$s2.invitationId, useOtp ? otp : undefined));
773
773
  case 3:
774
774
  setEmail('');
775
775
  setPassword('');
@@ -44,7 +44,7 @@ import { actions } from '@storybook/addon-actions';
44
44
  import * as Styles from '@mui/styles';
45
45
 
46
46
  (function() {
47
- const env = {"STAGE":"production","VERSION":"24.15.0-beta.17"};
47
+ const env = {"STAGE":"production","VERSION":"24.15.0-beta.19"};
48
48
  try {
49
49
  if (process) {
50
50
  process.env = Object.assign({}, process.env);
@@ -9448,7 +9448,7 @@ var SideMenu$1 = observer(SideMenu);
9448
9448
  function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9449
9449
  function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9450
9450
  var LazyModals$1 = /*#__PURE__*/React.lazy(function () {
9451
- return import('./ModalsWrapper-befe7061.js');
9451
+ return import('./ModalsWrapper-dcceef4e.js');
9452
9452
  });
9453
9453
  function Fullscreen() {
9454
9454
  var _useDivaCoreContext = useDivaCoreContext(),
@@ -9896,10 +9896,10 @@ function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymb
9896
9896
  function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9897
9897
  var LOG$2 = getLogger('Framework', 'Root');
9898
9898
  var LazyAuth = /*#__PURE__*/React.lazy(function () {
9899
- return import('./index-36598381.js');
9899
+ return import('./index-c34b258b.js');
9900
9900
  });
9901
9901
  var LazyModals = /*#__PURE__*/React.lazy(function () {
9902
- return import('./ModalsWrapper-befe7061.js');
9902
+ return import('./ModalsWrapper-dcceef4e.js');
9903
9903
  });
9904
9904
  function ContentComponent() {
9905
9905
  var context = useDivaCoreContext();
@@ -1,4 +1,4 @@
1
- export { k as AnalyticsHandler, A as AuthorizationHandler, o as ClientArticleHandler, C as Content, p as DivaMockProvider, H as HelpButton, O as ONE_DAY_UNIX, n as OrganizationHandler, P as ProductHandler, R as RequestStatus, S as SupportHandler, D as default, a as getLogger, q as storyBookCoreMock, j as useDivaCore } from './index-f26449eb.js';
1
+ export { k as AnalyticsHandler, A as AuthorizationHandler, o as ClientArticleHandler, C as Content, p as DivaMockProvider, H as HelpButton, O as ONE_DAY_UNIX, n as OrganizationHandler, P as ProductHandler, R as RequestStatus, S as SupportHandler, D as default, a as getLogger, q as storyBookCoreMock, j as useDivaCore } from './index-ed10cea7.js';
2
2
  export { DivaError, default as DivaUtils } from '@crystaldesign/diva-utils';
3
3
  export { Trans, useTranslation } from 'react-i18next';
4
4
  export * from '@crystaldesign/basket-model';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/elements/Auth/Register/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAexC,iBAAS,QAAQ,sBAgGhB;;;;AAED,wBAAkC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/elements/Auth/Register/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAexC,iBAAS,QAAQ,sBAyGhB;;;;AAED,wBAAkC"}
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see 797.diva-core.umd.min.js.LICENSE.txt */
2
- "use strict";(self.webpackChunkCrystaldesignDivaCore=self.webpackChunkCrystaldesignDivaCore||[]).push([[797],{9797:(e,t,n)=>{n.r(t),n.d(t,{default:()=>Z});var r=n(7363),a=n(4727),o=n(4658),s=n(4988),i=n(747),l=n.n(i),u=n(523),c=n(9420),d=n(501),h=n(8623),v=n(3096),g=n(7995),p=n(789),w=n(5515),x=n.n(w),j=n(7514);function OpenId(){var e,t,n,r=(0,a.KH)(),o=r.configurationStore,s=r.authorizationStore,i=(0,p.$G)().t,l=null===(e=s.state)||void 0===e?void 0:e.loginMethods;return(0,j.jsxs)(j.Fragment,{children:[(null==l?void 0:l.google)&&(0,j.jsxs)(g.Z,{className:x()(u.FI,u.lk),onClick:function onClick(){var e;return s.openOAuthLogin("google",s.state.organizationId,null===(e=s.state)||void 0===e?void 0:e.invitationId)},children:[(0,j.jsx)("div",{}),i("auth.login.google")]}),(null==l?void 0:l.microsoft)&&(0,j.jsxs)(g.Z,{className:x()(u.FI,u.Eg),onClick:function onClick(){var e;return s.openOAuthLogin("microsoft",s.state.organizationId,null===(e=s.state)||void 0===e?void 0:e.invitationId)},children:[(0,j.jsx)("div",{}),i("auth.login.microsoft")]}),(null==l?void 0:l.generic)&&(0,j.jsxs)(g.Z,{className:u.FI,style:{backgroundColor:null!==(t=l.generic.backgroundColor)&&void 0!==t?t:o.theme.palette.secondary.main,color:null!==(n=l.generic.color)&&void 0!==n?n:o.theme.palette.secondary.contrastText},onClick:function onClick(){var e;return s.openOAuthLogin("genericOpenId",s.state.organizationId,null===(e=s.state)||void 0===e?void 0:e.invitationId)},children:[(0,j.jsx)("div",{style:l.generic.logo?{backgroundImage:"url(".concat(l.generic.logo,")")}:{}}),i("auth.login.generic")]})]})}var f=n(4680),m=(0,f.jl)("Framework","Login");const y=(0,c.Pi)((function Login(){var e,t,n,i,c=(0,a.KH)(),w=c.authorizationStore,x=c.authorizationHandler,f=(0,r.useState)("enter"),y=(0,s.Z)(f,2),M=y[0],k=y[1],C=(0,r.useState)(null!==(e=null===(t=w.state)||void 0===t?void 0:t.email)&&void 0!==e?e:""),L=(0,s.Z)(C,2),N=L[0],S=L[1],E=(0,r.useState)(""),I=(0,s.Z)(E,2),Z=I[0],z=I[1],D=(0,r.useState)(""),b=(0,s.Z)(D,2),A=b[0],P=b[1],T=(0,r.useState)(!1),O=(0,s.Z)(T,2),_=O[0],F=O[1],U=(0,r.useState)(w.state.invitationId),R=(0,s.Z)(U,2),G=R[0],K=R[1],H=(0,r.useState)("LOGIN"==(null===(n=w.state)||void 0===n?void 0:n.type)?w.state.error:void 0),$=(0,s.Z)(H,2),Q=$[0],V=$[1],W=(0,p.$G)().t,Y=function(){var e=(0,o.Z)(l().mark((function _callee(){var e,t;return l().wrap((function _callee$(n){for(;;)switch(n.prev=n.next){case 0:if(n.prev=0,G){n.next=6;break}return n.next=4,x.getInvitationValue("id",N);case 4:(e=n.sent)&&(e.isNewUser&&(w.close(),w.showRegister(void 0,N,!0)),K(!0),F(!0));case 6:return n.next=8,x.fetchLoginProvider({email:N});case 8:"standard"==(t=n.sent).provider?k("login"):w.openOAuthLogin(t.provider,w.state.organizationId,w.state.invitationId),n.next=16;break;case 12:n.prev=12,n.t0=n.catch(0),m.error(new d.GE("Error while fetching login provider",{cause:n.t0})),V("auth.error.password");case 16:case"end":return n.stop()}}),_callee,null,[[0,12]])})));return function onContinue(){return e.apply(this,arguments)}}(),B=function(){var e=(0,o.Z)(l().mark((function _callee2(){return l().wrap((function _callee2$(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,h.fl)(w.login(N,Z,!1,w.state.organizationId,w.state.invitationId,A));case 3:S(""),z(""),V(void 0),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(0),m.error(new d.GE("Error while logging in",{cause:e.t0})),V(G?"auth.error.passwordotp":"auth.error.password");case 12:case"end":return e.stop()}}),_callee2,null,[[0,8]])})));return function onLogin(){return e.apply(this,arguments)}}(),q=function(){var e=(0,o.Z)(l().mark((function _callee3(){return l().wrap((function _callee3$(e){for(;;)switch(e.prev=e.next){case 0:w.showRequestNewPassword(N);case 1:case"end":return e.stop()}}),_callee3)})));return function resetPassword(){return e.apply(this,arguments)}}(),J="enter"==M&&0==N.length||"enter"!=M&&0==Z.length;_&&!J&&(J=0==A.length);var X=null===(i=w.state)||void 0===i?void 0:i.loginMethods;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("h1",{children:W("auth.title.login")}),(0,j.jsx)("p",{children:W("auth.text.login","")}),!!Q&&(0,j.jsxs)("div",{className:u.vU,children:[(0,j.jsx)("span",{}),(0,j.jsx)("div",{id:"loginerrortext",children:W(Q)})]}),(0,j.jsx)(OpenId,{}),((null==X?void 0:X.generic)||(null==X?void 0:X.google)||(null==X?void 0:X.microsoft))&&X.standard&&(0,j.jsx)("div",{className:u.kr,children:"or"}),(null==X?void 0:X.standard)&&(0,j.jsxs)(j.Fragment,{children:["enter"==M&&(0,j.jsxs)("form",{children:[(0,j.jsx)(v.Z,{id:"username",value:N,autoComplete:"username",autoFocus:!0,placeholder:W("auth.input.email"),onChange:function onChange(e){return S(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&Y()}}),(0,j.jsx)(v.Z,{value:Z,id:"password",type:"password",autoComplete:"current-password",hidden:!0,autoFocus:!0,placeholder:W("auth.input.password"),onChange:function onChange(e){return z(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&B()}})]}),"login"==M&&(0,j.jsxs)("form",{children:[_&&(0,j.jsx)(v.Z,{value:A,type:"text",autoFocus:!0,placeholder:W("auth.input.otp"),onChange:function onChange(e){return P(e.target.value)}}),(0,j.jsx)("label",{className:u.TL,onClick:function reset(){k("enter"),S(""),z(""),V(void 0)},children:(0,j.jsx)(v.Z,{value:N,readOnly:!0,placeholder:W("auth.input.email")})}),(0,j.jsx)(v.Z,{value:Z,type:"password",id:"password",autoFocus:!0,placeholder:W("auth.input.password"),onChange:function onChange(e){return z(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&B()}}),(0,j.jsx)("div",{className:u.p4,style:{textAlign:"right"},onClick:q,children:W("auth.button.forgotpassword")})]}),(0,j.jsx)(g.Z,{id:"submit",disabled:J,onClick:"enter"==M?Y:B,children:W("enter"==M?"auth.button.continue":"auth.button.login")})]})]})}));var M=(0,f.jl)("Framework","RequestNewPassword");function RequestNewPassword(e){var t=e.initEmail,n=(0,a.KH)(),i=n.authorizationStore,c=n.apiHandler,h=n.loadingAndErrorStore,w=(0,r.useState)(t),x=(0,s.Z)(w,2),f=x[0],m=x[1],y=(0,r.useState)(!1),k=(0,s.Z)(y,2),C=k[0],L=k[1],N=(0,r.useState)(),S=(0,s.Z)(N,2),E=S[0],I=S[1],Z=(0,r.useState)(),z=(0,s.Z)(Z,2),D=z[0],b=z[1],A=(0,p.$G)().t,P=function(){var e=(0,o.Z)(l().mark((function _callee(){return l().wrap((function _callee$(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,b(!0),h.toggleLoading("SendPassword"),e.next=5,c.sendPasswordRecoveryMail({email:f});case 5:b(!1),h.toggleLoading("SendPassword"),L(!0),I(void 0),e.next=17;break;case 11:e.prev=11,e.t0=e.catch(0),M.error(new d.GE("Error while sending password recovery mail",{cause:e.t0})),I("auth.error.resetpassword"),b(!1),h.toggleLoading("SendPassword");case 17:case"end":return e.stop()}}),_callee,null,[[0,11]])})));return function resetPassword(){return e.apply(this,arguments)}}();return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("h1",{children:A("auth.title.resetpassword")}),(0,j.jsx)("p",{children:A("auth.info.resetdescription")}),!!E&&(0,j.jsxs)("div",{className:u.vU,children:[(0,j.jsx)("span",{}),(0,j.jsx)("div",{children:A(E)})]}),C&&(0,j.jsxs)("div",{className:u.Vp,children:[(0,j.jsx)("span",{}),(0,j.jsx)("div",{children:A("auth.info.resetpassword")})]}),!C&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(v.Z,{value:f,autoFocus:!0,placeholder:A("auth.input.email"),onChange:function onChange(e){return m(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&P()}}),(0,j.jsx)(g.Z,{disabled:0==f.length,onClick:P,children:A("auth.button.resetpassword")})]}),C&&(0,j.jsx)(g.Z,{disabled:D,onClick:function toLogin(){i.close(),i.showLogin()},children:A("auth.button.login")})]})}function Errormessage(e){var t=e.hasError,n=e.authErrorsg,r=(0,p.$G)().t;return(0,j.jsxs)("div",{className:u.vU,children:[(0,j.jsx)("span",{}),"INVALID"==t&&(0,j.jsx)("div",{children:r("auth.error.verifypassword")}),"SERVER"==t&&(0,j.jsx)("div",{children:n})]})}var k=(0,f.jl)("Framework","cfhange-password");function ChangePassword(e){var t,n=e.token,i=(0,a.KH)(),c=i.configurationStore,h=i.authorizationStore,w=i.apiHandler,x=(i.loadingAndErrorStore,(0,r.useState)("")),f=(0,s.Z)(x,2),m=f[0],y=f[1],M=(0,r.useState)(""),C=(0,s.Z)(M,2),L=C[0],N=C[1],S=(0,r.useState)(!1),E=(0,s.Z)(S,2),I=E[0],Z=E[1],z=(0,r.useState)(),D=(0,s.Z)(z,2),b=D[0],A=D[1],P=(0,r.useState)(""),T=(0,s.Z)(P,2),O=T[0],_=T[1],F=(0,r.useRef)(null),U=(0,p.$G)().t;(0,r.useEffect)((function(){m===L&&A(void 0)}),[m,L]);var R=function(){var e=(0,o.Z)(l().mark((function _callee(){return l().wrap((function _callee$(e){for(;;)switch(e.prev=e.next){case 0:if(_(U("auth.error.verifypasswordserver")),!(m.length<8||m!==L)){e.next=4;break}return A("INVALID"),e.abrupt("return");case 4:return e.prev=4,e.next=7,w.resetPassword({password:m,token:n});case 7:Z(!0),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(4),G(e.t0);case 13:case"end":return e.stop()}}),_callee,null,[[4,10]])})));return function resetPassword(){return e.apply(this,arguments)}}(),G=function handleError(e){if(e instanceof d.GE){if("AUTH_0003"===e.name)_(U("auth.error.verifypasswordtokenerror",{errormsg:U("auth.error.tokenexpired")}));else _(U("auth.error.verifypasswordserver",e.message));k.error(e)}k.error(new d.GE("Error while resetting password",{cause:e})),A("SERVER")};return"SERVER"===b?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Errormessage,{hasError:b,authErrorsg:O}),(0,j.jsx)(g.Z,{onClick:function onClickRequestNewPassword(){h.showRequestNewPassword("")},children:U("auth.button.resetpassword")})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("h1",{children:U("auth.title.verifypassword")}),I&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("div",{className:u.Vp,children:[(0,j.jsx)("span",{}),(0,j.jsx)("div",{children:U("auth.info.verifypassword")})]}),(null===(t=c.authentication.resetPassword)||void 0===t?void 0:t.returnToLogin)&&(0,j.jsx)(g.Z,{onClick:function goToLogin(){h.close(),h.showLogin()},children:U("auth.button.login")})]}),!I&&(0,j.jsxs)(j.Fragment,{children:[b&&(0,j.jsx)(Errormessage,{hasError:b,authErrorsg:O}),(0,j.jsxs)("form",{children:[(0,j.jsx)(v.Z,{value:m,autoFocus:!0,placeholder:U("auth.input.password"),type:"password",autoComplete:"new-password",onChange:function onChange(e){return y(e.target.value)},onKeyPress:function onKeyPress(e){var t;return"Enter"==e.key&&(null===(t=F.current)||void 0===t?void 0:t.focus())}}),(0,j.jsx)(v.Z,{ref:F,value:L,placeholder:U("auth.input.verifypassword"),type:"password",autoComplete:"new-password",onChange:function onChange(e){return N(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&R()}})]}),(0,j.jsx)(g.Z,{disabled:!m||!L,onClick:R,children:U("auth.button.save")})]})]})}var C=n(5486);function WelcomeScreen(e){var t=e.isNewUser,n=e.invitationId,i=e.invitationOrgId,c=(0,a.KH)(),d=c.authorizationStore,h=c.authorizationHandler,v=(0,r.useState)(""),w=(0,s.Z)(v,2),x=w[0],f=w[1],m=(0,p.$G)().t,y=function(){var e=(0,o.Z)(l().mark((function _callee(){var e;return l().wrap((function _callee$(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,checkInvitation();case 2:(e=t.sent)&&(d.close(),d.showLogin(void 0,void 0,i,n,e));case 4:case"end":return t.stop()}}),_callee)})));return function toLogin(){return e.apply(this,arguments)}}(),M=function(){var e=(0,o.Z)(l().mark((function _callee2(){var e;return l().wrap((function _callee2$(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,checkInvitation();case 2:(e=t.sent)&&(d.close(),d.showRegister(n,e));case 4:case"end":return t.stop()}}),_callee2)})));return function toRegister(){return e.apply(this,arguments)}}();function checkInvitation(){return _checkInvitation.apply(this,arguments)}function _checkInvitation(){return _checkInvitation=(0,o.Z)(l().mark((function _callee3(){var e,t,n;return l().wrap((function _callee3$(r){for(;;)switch(r.prev=r.next){case 0:return t=null===(e=d.state)||void 0===e?void 0:e.invitationId,r.next=3,h.getInvitationValue("email",t);case 3:if(!(n=r.sent)){r.next=8;break}return r.abrupt("return",n.email);case 8:return f("Invitation not found"),r.abrupt("return",void 0);case 10:case"end":return r.stop()}}),_callee3)}))),_checkInvitation.apply(this,arguments)}return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("h1",{children:m("auth.title.welcome")}),(0,j.jsx)("p",{children:m("auth.info.welcomedescription")}),x&&(0,j.jsxs)("div",{className:u.vU,children:[(0,j.jsx)("span",{}),(0,j.jsx)("div",{children:m(x)})]}),t&&!x&&(0,j.jsx)(g.Z,{onClick:M,children:m("auth.title.register")}),!t&&!x&&(0,j.jsx)(g.Z,{onClick:y,children:m("auth.button.login")})]})}var L=n(5282),N=n(5113),S=(0,f.jl)("Framework","Register");const E=(0,c.Pi)((function Register(){var e,t,n,i,c,w,x=(0,a.KH)(),f=x.authorizationStore,m=x.configurationStore,y=(0,p.$G)().t,M=(0,r.useState)(null!==(e=null===(t=f.state)||void 0===t?void 0:t.email)&&void 0!==e?e:""),k=(0,s.Z)(M,2),C=k[0],E=k[1],I=(0,r.useState)(""),Z=(0,s.Z)(I,2),z=Z[0],D=Z[1],b=(0,r.useState)(""),A=(0,s.Z)(b,2),P=A[0],T=A[1],O=(0,r.useState)(""),_=(0,s.Z)(O,2),F=_[0],U=_[1],R=(0,r.useState)(""),G=(0,s.Z)(R,2),K=G[0],H=G[1],$=(0,r.useState)(""),Q=(0,s.Z)($,2),V=Q[0],W=Q[1],Y=(0,r.useState)(""),B=(0,s.Z)(Y,2),q=B[0],J=B[1],X=(0,r.useState)(!1),ee=(0,s.Z)(X,2),te=ee[0],ne=ee[1],re=function(){var e=(0,o.Z)(l().mark((function _callee(){var e;return l().wrap((function _callee$(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,(0,h.fl)(f.register(C,z,K,F,null===(e=f.state)||void 0===e?void 0:e.invitationId,q));case 3:E(""),D(""),T(""),H(""),U(""),t.next=14;break;case 10:t.prev=10,t.t0=t.catch(0),W("auth.error.invitationotp"),S.error(new d.GE("Error while registering",{cause:t.t0}));case 14:case"end":return t.stop()}}),_callee,null,[[0,10]])})));return function onRegister(){return e.apply(this,arguments)}}(),ae=null===(n=f.state)||void 0===n?void 0:n.useOtp,oe=function validPassword(){return ae?null!=q&&""!==q&&z==P&&""!=z&&null!=z&&te:z==P&&""!=z&&null!=z&&te},se=null===(i=f.state)||void 0===i?void 0:i.loginMethods;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("h1",{children:y("auth.title.register")}),(0,j.jsx)("p",{children:y("auth.text.register","")}),!!V&&(0,j.jsxs)("div",{className:u.vU,children:[(0,j.jsx)("span",{}),(0,j.jsx)("div",{children:y(V)})]}),(0,j.jsx)(OpenId,{}),((null==se?void 0:se.generic)||(null==se?void 0:se.google)||(null==se?void 0:se.microsoft))&&se.standard&&(0,j.jsx)("div",{className:u.kr,children:"or"}),(null==se?void 0:se.standard)&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("form",{children:[ae&&(0,j.jsx)(v.Z,{type:"text",value:q,placeholder:y("auth.input.otp"),onChange:function onChange(e){return J(e.target.value)}}),(0,j.jsx)(v.Z,{value:K,autoFocus:!0,placeholder:y("backoffice.form.userdetails.items.name"),onChange:function onChange(e){return H(e.target.value)}}),(0,j.jsx)(v.Z,{value:F,autoFocus:!0,placeholder:y("backoffice.form.userdetails.items.familyName"),onChange:function onChange(e){return U(e.target.value)}}),(0,j.jsx)(v.Z,{value:C,autoComplete:"email",autoFocus:!0,placeholder:y("auth.input.email"),disabled:!0}),(0,j.jsx)(v.Z,{value:z,type:"password",autoFocus:!0,placeholder:y("auth.input.password"),onChange:function onChange(e){return D(e.target.value)}}),(0,j.jsx)(v.Z,{value:P,type:"password",autoFocus:!0,placeholder:y("auth.input.repeatpassword"),onChange:function onChange(e){return T(e.target.value)}}),(0,j.jsxs)("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[(0,j.jsx)(N.Z,{name:"checkAGB",checked:te,onClick:function onClick(){return ne(!te)}}),(0,j.jsxs)("div",{style:{display:"flex",flexDirection:"column",fontSize:9},children:[(0,j.jsx)("span",{children:y("auth.acceptprivacyandagb")}),(0,j.jsxs)("span",{children:[(0,j.jsx)("a",{target:"_blank",href:null!==(c=m.navigation.tosUrl)&&void 0!==c?c:"https://www.diva-portal.de/agb",children:y("auth.GeneralTerms")}),", ",(0,j.jsx)("a",{target:"_blank",href:null!==(w=m.navigation.privacyUrl)&&void 0!==w?w:"https://www.diva-portal.de/datenschutz",children:y("auth.privacypolicy")})]})]})]}),(0,j.jsx)(L.Z,{style:{color:"#FF8C00",marginTop:10,fontSize:14},hidden:oe(),children:y("auth.input.passwordsnotmatch")})]}),(0,j.jsx)(g.Z,{disabled:!oe(),onClick:oe()?re:void 0,children:y("auth.input.login")})]})]})}));var I=(0,c.Pi)((function(){var e,t=(0,a.KH)().authorizationStore;switch(null===(e=t.state)||void 0===e?void 0:e.type){case"LOGIN":return(0,j.jsx)(y,{});case"REQUEST_NEW_PASSWORD":return(0,j.jsx)(RequestNewPassword,{initEmail:t.state.email});case"CHANGE_PASSWORD":return(0,j.jsx)(ChangePassword,{token:t.state.token});case"WELCOME":return(0,j.jsx)(WelcomeScreen,{isNewUser:t.state.isNewUser,invitationId:t.state.invitationId,invitationOrgId:t.state.invitationOrgId});case"REGISTER":return(0,j.jsx)(E,{});case"INVITATION_EXPIRED":return(0,j.jsx)("h1",{children:"Abgelaufen"});default:return(0,j.jsx)(j.Fragment,{})}}));const Z=(0,c.Pi)((function Auth(){var e,t,n,o=(0,a.KH)(),s=o.authorizationStore,i=o.configurationStore,l=o.dataStore,c=(o.authorizationHandler,(0,r.useMemo)((function(){var e,t,n,r="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciICB2aWV3Qm94PSIwIDAgMTAwMCAyOTMuNjUiPjxwYXRoIGQ9Ik0yNTAuODksMTQ3LjNjLTMuMTgtNzQtMzAuNC0xNDMuMTgtMTQxLjczLTE0My4xOEwwLDQuMjZBMzA3Ljg2LDMwNy44NiwwLDAsMSwyNi4xMiw2MC43aDc0LjJjNTIuODYsMCw3NiwyNS42OCw3OC42MSw4NS4yOSwyLjY2LDYxLjgxLTE4LjI5LDg3LjkyLTcxLjE1LDg3LjkySDc5LjJsLTQ2LjcxLjUyYTI4Ny4yOSwyODcuMjksMCwwLDEtMjAsNTMuODhoMTA5YzExMS4zMiwwLDEzMi42Ny02NywxMjkuNDgtMTQxTTMwNi44NCwyODloNzEuMjNWMGEzMDAuMDcsMzAwLjA3LDAsMCwxLTcxLjIzLDI1LjkyWm0zMTguOC42Mkw3MjYuNTkuODVhMzAwLDMwMCwwLDAsMS04My42NSwzMi4yNEw1NzcuMTEsMjI0LDUxMS4yOSwzMy4wOUEzMDAsMzAwLDAsMCwxLDQyNy42NC44NWwxMDEsMjg4Ljc2Wm0zNzQuMzYsNEw4OTkuMDUsNC45MUg4MDJMNzc1LjE0LDgxLjc0LDcwMS4wNSwyOTMuNjVBMzAwLjMyLDMwMC4zMiwwLDAsMSw3ODUsMjYxLjM1bDYuNzktMjEsMTkuMTQtNTcuNTRMODUwLjUyLDYybDQwLjA3LDEyMC44NSwxOC43LDU3LjU0LDcsMjFBMzAwLjIsMzAwLjIsMCwwLDEsMTAwMCwyOTMuNjUiIGZpbGw9IiNiM2IzYjMiLz48L3N2Zz4=";if(null!==(e=l.organization)&&void 0!==e&&e.logoUrl)r=null===(n=l.organization)||void 0===n?void 0:n.logoUrl;else if(null!==(t=i.navigation)&&void 0!==t&&t.logoUrl){var a;r=null===(a=i.navigation)||void 0===a?void 0:a.logoUrl}return r}),[null===(e=i.navigation)||void 0===e?void 0:e.logoUrl,null===(t=l.organization)||void 0===t?void 0:t.logoUrl]));return null==s.state?(0,j.jsx)(j.Fragment,{}):(0,j.jsxs)("div",{className:u.I8,children:[(0,j.jsxs)("div",{className:u.NB,children:[(0,j.jsx)("div",{className:u.tn,style:{height:null!==(n=i.configuration.loginLogoHeight)&&void 0!==n?n:50,backgroundImage:"url(".concat(c,")")}}),(0,j.jsx)(I,{})]}),i.authentication.contentBox&&(0,j.jsx)("div",{style:{width:"calc(100% - 400px)",height:"100%",position:"relative",overflow:"hidden"},children:(0,j.jsx)(C.p,{settings:{contentBoxProps:(0,h.ZN)(i.authentication.contentBox.props)}})})]})}))}}]);
2
+ "use strict";(self.webpackChunkCrystaldesignDivaCore=self.webpackChunkCrystaldesignDivaCore||[]).push([[797],{9797:(e,t,n)=>{n.r(t),n.d(t,{default:()=>Z});var r=n(7363),a=n(4727),o=n(4658),s=n(4988),i=n(747),l=n.n(i),u=n(523),c=n(9420),d=n(501),h=n(8623),v=n(3096),g=n(7995),p=n(789),w=n(5515),x=n.n(w),j=n(7514);function OpenId(){var e,t,n,r=(0,a.KH)(),o=r.configurationStore,s=r.authorizationStore,i=(0,p.$G)().t,l=null===(e=s.state)||void 0===e?void 0:e.loginMethods;return(0,j.jsxs)(j.Fragment,{children:[(null==l?void 0:l.google)&&(0,j.jsxs)(g.Z,{className:x()(u.FI,u.lk),onClick:function onClick(){var e;return s.openOAuthLogin("google",s.state.organizationId,null===(e=s.state)||void 0===e?void 0:e.invitationId)},children:[(0,j.jsx)("div",{}),i("auth.login.google")]}),(null==l?void 0:l.microsoft)&&(0,j.jsxs)(g.Z,{className:x()(u.FI,u.Eg),onClick:function onClick(){var e;return s.openOAuthLogin("microsoft",s.state.organizationId,null===(e=s.state)||void 0===e?void 0:e.invitationId)},children:[(0,j.jsx)("div",{}),i("auth.login.microsoft")]}),(null==l?void 0:l.generic)&&(0,j.jsxs)(g.Z,{className:u.FI,style:{backgroundColor:null!==(t=l.generic.backgroundColor)&&void 0!==t?t:o.theme.palette.secondary.main,color:null!==(n=l.generic.color)&&void 0!==n?n:o.theme.palette.secondary.contrastText},onClick:function onClick(){var e;return s.openOAuthLogin("genericOpenId",s.state.organizationId,null===(e=s.state)||void 0===e?void 0:e.invitationId)},children:[(0,j.jsx)("div",{style:l.generic.logo?{backgroundImage:"url(".concat(l.generic.logo,")")}:{}}),i("auth.login.generic")]})]})}var f=n(4680),m=(0,f.jl)("Framework","Login");const y=(0,c.Pi)((function Login(){var e,t,n,i,c=(0,a.KH)(),w=c.authorizationStore,x=c.authorizationHandler,f=(0,r.useState)("enter"),y=(0,s.Z)(f,2),M=y[0],k=y[1],C=(0,r.useState)(null!==(e=null===(t=w.state)||void 0===t?void 0:t.email)&&void 0!==e?e:""),L=(0,s.Z)(C,2),N=L[0],S=L[1],E=(0,r.useState)(""),I=(0,s.Z)(E,2),Z=I[0],z=I[1],D=(0,r.useState)(""),b=(0,s.Z)(D,2),A=b[0],P=b[1],T=(0,r.useState)(!1),O=(0,s.Z)(T,2),_=O[0],F=O[1],U=(0,r.useState)(w.state.invitationId),R=(0,s.Z)(U,2),G=R[0],K=R[1],H=(0,r.useState)("LOGIN"==(null===(n=w.state)||void 0===n?void 0:n.type)?w.state.error:void 0),$=(0,s.Z)(H,2),Q=$[0],V=$[1],W=(0,p.$G)().t,Y=function(){var e=(0,o.Z)(l().mark((function _callee(){var e,t;return l().wrap((function _callee$(n){for(;;)switch(n.prev=n.next){case 0:if(n.prev=0,G){n.next=6;break}return n.next=4,x.getInvitationValue("id",N);case 4:(e=n.sent)&&(e.isNewUser&&(w.close(),w.showRegister(void 0,N,!!e.useotp)),K(!0),e.useotp&&F(!0));case 6:return n.next=8,x.fetchLoginProvider({email:N});case 8:"standard"==(t=n.sent).provider?k("login"):w.openOAuthLogin(t.provider,w.state.organizationId,w.state.invitationId),n.next=16;break;case 12:n.prev=12,n.t0=n.catch(0),m.error(new d.GE("Error while fetching login provider",{cause:n.t0})),V("auth.error.password");case 16:case"end":return n.stop()}}),_callee,null,[[0,12]])})));return function onContinue(){return e.apply(this,arguments)}}(),B=function(){var e=(0,o.Z)(l().mark((function _callee2(){return l().wrap((function _callee2$(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,h.fl)(w.login(N,Z,!1,w.state.organizationId,w.state.invitationId,A));case 3:S(""),z(""),V(void 0),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(0),m.error(new d.GE("Error while logging in",{cause:e.t0})),V(G?"auth.error.passwordotp":"auth.error.password");case 12:case"end":return e.stop()}}),_callee2,null,[[0,8]])})));return function onLogin(){return e.apply(this,arguments)}}(),q=function(){var e=(0,o.Z)(l().mark((function _callee3(){return l().wrap((function _callee3$(e){for(;;)switch(e.prev=e.next){case 0:w.showRequestNewPassword(N);case 1:case"end":return e.stop()}}),_callee3)})));return function resetPassword(){return e.apply(this,arguments)}}(),J="enter"==M&&0==N.length||"enter"!=M&&0==Z.length;_&&!J&&(J=0==A.length);var X=null===(i=w.state)||void 0===i?void 0:i.loginMethods;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("h1",{children:W("auth.title.login")}),(0,j.jsx)("p",{children:W("auth.text.login","")}),!!Q&&(0,j.jsxs)("div",{className:u.vU,children:[(0,j.jsx)("span",{}),(0,j.jsx)("div",{id:"loginerrortext",children:W(Q)})]}),(0,j.jsx)(OpenId,{}),((null==X?void 0:X.generic)||(null==X?void 0:X.google)||(null==X?void 0:X.microsoft))&&X.standard&&(0,j.jsx)("div",{className:u.kr,children:"or"}),(null==X?void 0:X.standard)&&(0,j.jsxs)(j.Fragment,{children:["enter"==M&&(0,j.jsxs)("form",{children:[(0,j.jsx)(v.Z,{id:"username",value:N,autoComplete:"username",autoFocus:!0,placeholder:W("auth.input.email"),onChange:function onChange(e){return S(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&Y()}}),(0,j.jsx)(v.Z,{value:Z,id:"password",type:"password",autoComplete:"current-password",hidden:!0,autoFocus:!0,placeholder:W("auth.input.password"),onChange:function onChange(e){return z(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&B()}})]}),"login"==M&&(0,j.jsxs)("form",{children:[_&&(0,j.jsx)(v.Z,{value:A,type:"text",autoFocus:!0,placeholder:W("auth.input.otp"),onChange:function onChange(e){return P(e.target.value)}}),(0,j.jsx)("label",{className:u.TL,onClick:function reset(){k("enter"),S(""),z(""),V(void 0)},children:(0,j.jsx)(v.Z,{value:N,readOnly:!0,placeholder:W("auth.input.email")})}),(0,j.jsx)(v.Z,{value:Z,type:"password",id:"password",autoFocus:!0,placeholder:W("auth.input.password"),onChange:function onChange(e){return z(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&B()}}),(0,j.jsx)("div",{className:u.p4,style:{textAlign:"right"},onClick:q,children:W("auth.button.forgotpassword")})]}),(0,j.jsx)(g.Z,{id:"submit",disabled:J,onClick:"enter"==M?Y:B,children:W("enter"==M?"auth.button.continue":"auth.button.login")})]})]})}));var M=(0,f.jl)("Framework","RequestNewPassword");function RequestNewPassword(e){var t=e.initEmail,n=(0,a.KH)(),i=n.authorizationStore,c=n.apiHandler,h=n.loadingAndErrorStore,w=(0,r.useState)(t),x=(0,s.Z)(w,2),f=x[0],m=x[1],y=(0,r.useState)(!1),k=(0,s.Z)(y,2),C=k[0],L=k[1],N=(0,r.useState)(),S=(0,s.Z)(N,2),E=S[0],I=S[1],Z=(0,r.useState)(),z=(0,s.Z)(Z,2),D=z[0],b=z[1],A=(0,p.$G)().t,P=function(){var e=(0,o.Z)(l().mark((function _callee(){return l().wrap((function _callee$(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,b(!0),h.toggleLoading("SendPassword"),e.next=5,c.sendPasswordRecoveryMail({email:f});case 5:b(!1),h.toggleLoading("SendPassword"),L(!0),I(void 0),e.next=17;break;case 11:e.prev=11,e.t0=e.catch(0),M.error(new d.GE("Error while sending password recovery mail",{cause:e.t0})),I("auth.error.resetpassword"),b(!1),h.toggleLoading("SendPassword");case 17:case"end":return e.stop()}}),_callee,null,[[0,11]])})));return function resetPassword(){return e.apply(this,arguments)}}();return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("h1",{children:A("auth.title.resetpassword")}),(0,j.jsx)("p",{children:A("auth.info.resetdescription")}),!!E&&(0,j.jsxs)("div",{className:u.vU,children:[(0,j.jsx)("span",{}),(0,j.jsx)("div",{children:A(E)})]}),C&&(0,j.jsxs)("div",{className:u.Vp,children:[(0,j.jsx)("span",{}),(0,j.jsx)("div",{children:A("auth.info.resetpassword")})]}),!C&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(v.Z,{value:f,autoFocus:!0,placeholder:A("auth.input.email"),onChange:function onChange(e){return m(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&P()}}),(0,j.jsx)(g.Z,{disabled:0==f.length,onClick:P,children:A("auth.button.resetpassword")})]}),C&&(0,j.jsx)(g.Z,{disabled:D,onClick:function toLogin(){i.close(),i.showLogin()},children:A("auth.button.login")})]})}function Errormessage(e){var t=e.hasError,n=e.authErrorsg,r=(0,p.$G)().t;return(0,j.jsxs)("div",{className:u.vU,children:[(0,j.jsx)("span",{}),"INVALID"==t&&(0,j.jsx)("div",{children:r("auth.error.verifypassword")}),"SERVER"==t&&(0,j.jsx)("div",{children:n})]})}var k=(0,f.jl)("Framework","cfhange-password");function ChangePassword(e){var t,n=e.token,i=(0,a.KH)(),c=i.configurationStore,h=i.authorizationStore,w=i.apiHandler,x=(i.loadingAndErrorStore,(0,r.useState)("")),f=(0,s.Z)(x,2),m=f[0],y=f[1],M=(0,r.useState)(""),C=(0,s.Z)(M,2),L=C[0],N=C[1],S=(0,r.useState)(!1),E=(0,s.Z)(S,2),I=E[0],Z=E[1],z=(0,r.useState)(),D=(0,s.Z)(z,2),b=D[0],A=D[1],P=(0,r.useState)(""),T=(0,s.Z)(P,2),O=T[0],_=T[1],F=(0,r.useRef)(null),U=(0,p.$G)().t;(0,r.useEffect)((function(){m===L&&A(void 0)}),[m,L]);var R=function(){var e=(0,o.Z)(l().mark((function _callee(){return l().wrap((function _callee$(e){for(;;)switch(e.prev=e.next){case 0:if(_(U("auth.error.verifypasswordserver")),!(m.length<8||m!==L)){e.next=4;break}return A("INVALID"),e.abrupt("return");case 4:return e.prev=4,e.next=7,w.resetPassword({password:m,token:n});case 7:Z(!0),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(4),G(e.t0);case 13:case"end":return e.stop()}}),_callee,null,[[4,10]])})));return function resetPassword(){return e.apply(this,arguments)}}(),G=function handleError(e){if(e instanceof d.GE){if("AUTH_0003"===e.name)_(U("auth.error.verifypasswordtokenerror",{errormsg:U("auth.error.tokenexpired")}));else _(U("auth.error.verifypasswordserver",e.message));k.error(e)}k.error(new d.GE("Error while resetting password",{cause:e})),A("SERVER")};return"SERVER"===b?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(Errormessage,{hasError:b,authErrorsg:O}),(0,j.jsx)(g.Z,{onClick:function onClickRequestNewPassword(){h.showRequestNewPassword("")},children:U("auth.button.resetpassword")})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("h1",{children:U("auth.title.verifypassword")}),I&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("div",{className:u.Vp,children:[(0,j.jsx)("span",{}),(0,j.jsx)("div",{children:U("auth.info.verifypassword")})]}),(null===(t=c.authentication.resetPassword)||void 0===t?void 0:t.returnToLogin)&&(0,j.jsx)(g.Z,{onClick:function goToLogin(){h.close(),h.showLogin()},children:U("auth.button.login")})]}),!I&&(0,j.jsxs)(j.Fragment,{children:[b&&(0,j.jsx)(Errormessage,{hasError:b,authErrorsg:O}),(0,j.jsxs)("form",{children:[(0,j.jsx)(v.Z,{value:m,autoFocus:!0,placeholder:U("auth.input.password"),type:"password",autoComplete:"new-password",onChange:function onChange(e){return y(e.target.value)},onKeyPress:function onKeyPress(e){var t;return"Enter"==e.key&&(null===(t=F.current)||void 0===t?void 0:t.focus())}}),(0,j.jsx)(v.Z,{ref:F,value:L,placeholder:U("auth.input.verifypassword"),type:"password",autoComplete:"new-password",onChange:function onChange(e){return N(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&R()}})]}),(0,j.jsx)(g.Z,{disabled:!m||!L,onClick:R,children:U("auth.button.save")})]})]})}var C=n(5486);function WelcomeScreen(e){var t=e.isNewUser,n=e.invitationId,i=e.invitationOrgId,c=(0,a.KH)(),d=c.authorizationStore,h=c.authorizationHandler,v=(0,r.useState)(""),w=(0,s.Z)(v,2),x=w[0],f=w[1],m=(0,p.$G)().t,y=function(){var e=(0,o.Z)(l().mark((function _callee(){var e;return l().wrap((function _callee$(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,checkInvitation();case 2:(e=t.sent)&&(d.close(),d.showLogin(void 0,void 0,i,n,e));case 4:case"end":return t.stop()}}),_callee)})));return function toLogin(){return e.apply(this,arguments)}}(),M=function(){var e=(0,o.Z)(l().mark((function _callee2(){var e;return l().wrap((function _callee2$(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,checkInvitation();case 2:(e=t.sent)&&(d.close(),d.showRegister(n,e));case 4:case"end":return t.stop()}}),_callee2)})));return function toRegister(){return e.apply(this,arguments)}}();function checkInvitation(){return _checkInvitation.apply(this,arguments)}function _checkInvitation(){return _checkInvitation=(0,o.Z)(l().mark((function _callee3(){var e,t,n;return l().wrap((function _callee3$(r){for(;;)switch(r.prev=r.next){case 0:return t=null===(e=d.state)||void 0===e?void 0:e.invitationId,r.next=3,h.getInvitationValue("email",t);case 3:if(!(n=r.sent)){r.next=8;break}return r.abrupt("return",n.email);case 8:return f("Invitation not found"),r.abrupt("return",void 0);case 10:case"end":return r.stop()}}),_callee3)}))),_checkInvitation.apply(this,arguments)}return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("h1",{children:m("auth.title.welcome")}),(0,j.jsx)("p",{children:m("auth.info.welcomedescription")}),x&&(0,j.jsxs)("div",{className:u.vU,children:[(0,j.jsx)("span",{}),(0,j.jsx)("div",{children:m(x)})]}),t&&!x&&(0,j.jsx)(g.Z,{onClick:M,children:m("auth.title.register")}),!t&&!x&&(0,j.jsx)(g.Z,{onClick:y,children:m("auth.button.login")})]})}var L=n(5282),N=n(5113),S=(0,f.jl)("Framework","Register");const E=(0,c.Pi)((function Register(){var e,t,n,i,c,w,x=(0,a.KH)(),f=x.authorizationStore,m=x.configurationStore,y=(0,p.$G)().t,M=(0,r.useState)(null!==(e=null===(t=f.state)||void 0===t?void 0:t.email)&&void 0!==e?e:""),k=(0,s.Z)(M,2),C=k[0],E=k[1],I=(0,r.useState)(""),Z=(0,s.Z)(I,2),z=Z[0],D=Z[1],b=(0,r.useState)(""),A=(0,s.Z)(b,2),P=A[0],T=A[1],O=(0,r.useState)(""),_=(0,s.Z)(O,2),F=_[0],U=_[1],R=(0,r.useState)(""),G=(0,s.Z)(R,2),K=G[0],H=G[1],$=(0,r.useState)(""),Q=(0,s.Z)($,2),V=Q[0],W=Q[1],Y=(0,r.useState)(""),B=(0,s.Z)(Y,2),q=B[0],J=B[1],X=(0,r.useState)(!1),ee=(0,s.Z)(X,2),te=ee[0],ne=ee[1],re=function(){var e=(0,o.Z)(l().mark((function _callee(){var e;return l().wrap((function _callee$(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,(0,h.fl)(f.register(C,z,K,F,null===(e=f.state)||void 0===e?void 0:e.invitationId,ae?q:void 0));case 3:E(""),D(""),T(""),H(""),U(""),t.next=14;break;case 10:t.prev=10,t.t0=t.catch(0),W("auth.error.invitationotp"),S.error(new d.GE("Error while registering",{cause:t.t0}));case 14:case"end":return t.stop()}}),_callee,null,[[0,10]])})));return function onRegister(){return e.apply(this,arguments)}}(),ae=null===(n=f.state)||void 0===n?void 0:n.useOtp,oe=function validPassword(){return ae?null!=q&&""!==q&&z==P&&""!=z&&null!=z&&te:z==P&&""!=z&&null!=z&&te},se=null===(i=f.state)||void 0===i?void 0:i.loginMethods;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("h1",{children:y("auth.title.register")}),(0,j.jsx)("p",{children:y("auth.text.register","")}),!!V&&(0,j.jsxs)("div",{className:u.vU,children:[(0,j.jsx)("span",{}),(0,j.jsx)("div",{children:y(V)})]}),(0,j.jsx)(OpenId,{}),((null==se?void 0:se.generic)||(null==se?void 0:se.google)||(null==se?void 0:se.microsoft))&&se.standard&&(0,j.jsx)("div",{className:u.kr,children:"or"}),(null==se?void 0:se.standard)&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("form",{children:[ae&&(0,j.jsx)(v.Z,{type:"text",value:q,placeholder:y("auth.input.otp"),onChange:function onChange(e){return J(e.target.value)}}),(0,j.jsx)(v.Z,{value:K,autoFocus:!0,placeholder:y("backoffice.form.userdetails.items.name"),onChange:function onChange(e){return H(e.target.value)}}),(0,j.jsx)(v.Z,{value:F,autoFocus:!0,placeholder:y("backoffice.form.userdetails.items.familyName"),onChange:function onChange(e){return U(e.target.value)}}),(0,j.jsx)(v.Z,{value:C,autoComplete:"email",autoFocus:!0,placeholder:y("auth.input.email"),disabled:!0}),(0,j.jsx)(v.Z,{value:z,type:"password",autoFocus:!0,placeholder:y("auth.input.password"),onChange:function onChange(e){return D(e.target.value)}}),(0,j.jsx)(v.Z,{value:P,type:"password",autoFocus:!0,placeholder:y("auth.input.repeatpassword"),onChange:function onChange(e){return T(e.target.value)}}),(0,j.jsxs)("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[(0,j.jsx)(N.Z,{name:"checkAGB",checked:te,onClick:function onClick(){return ne(!te)}}),(0,j.jsxs)("div",{style:{display:"flex",flexDirection:"column",fontSize:9},children:[(0,j.jsx)("span",{children:y("auth.acceptprivacyandagb")}),(0,j.jsxs)("span",{children:[(0,j.jsx)("a",{target:"_blank",href:null!==(c=m.navigation.tosUrl)&&void 0!==c?c:"https://www.diva-portal.de/agb",children:y("auth.GeneralTerms")}),", ",(0,j.jsx)("a",{target:"_blank",href:null!==(w=m.navigation.privacyUrl)&&void 0!==w?w:"https://www.diva-portal.de/datenschutz",children:y("auth.privacypolicy")})]})]})]}),(0,j.jsx)(L.Z,{style:{color:"#FF8C00",marginTop:10,fontSize:14},hidden:oe(),children:y("auth.input.passwordsnotmatch")})]}),(0,j.jsx)(g.Z,{disabled:!oe(),onClick:oe()?re:void 0,children:y("auth.input.login")})]})]})}));var I=(0,c.Pi)((function(){var e,t=(0,a.KH)().authorizationStore;switch(null===(e=t.state)||void 0===e?void 0:e.type){case"LOGIN":return(0,j.jsx)(y,{});case"REQUEST_NEW_PASSWORD":return(0,j.jsx)(RequestNewPassword,{initEmail:t.state.email});case"CHANGE_PASSWORD":return(0,j.jsx)(ChangePassword,{token:t.state.token});case"WELCOME":return(0,j.jsx)(WelcomeScreen,{isNewUser:t.state.isNewUser,invitationId:t.state.invitationId,invitationOrgId:t.state.invitationOrgId});case"REGISTER":return(0,j.jsx)(E,{});case"INVITATION_EXPIRED":return(0,j.jsx)("h1",{children:"Abgelaufen"});default:return(0,j.jsx)(j.Fragment,{})}}));const Z=(0,c.Pi)((function Auth(){var e,t,n,o=(0,a.KH)(),s=o.authorizationStore,i=o.configurationStore,l=o.dataStore,c=(o.authorizationHandler,(0,r.useMemo)((function(){var e,t,n,r="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciICB2aWV3Qm94PSIwIDAgMTAwMCAyOTMuNjUiPjxwYXRoIGQ9Ik0yNTAuODksMTQ3LjNjLTMuMTgtNzQtMzAuNC0xNDMuMTgtMTQxLjczLTE0My4xOEwwLDQuMjZBMzA3Ljg2LDMwNy44NiwwLDAsMSwyNi4xMiw2MC43aDc0LjJjNTIuODYsMCw3NiwyNS42OCw3OC42MSw4NS4yOSwyLjY2LDYxLjgxLTE4LjI5LDg3LjkyLTcxLjE1LDg3LjkySDc5LjJsLTQ2LjcxLjUyYTI4Ny4yOSwyODcuMjksMCwwLDEtMjAsNTMuODhoMTA5YzExMS4zMiwwLDEzMi42Ny02NywxMjkuNDgtMTQxTTMwNi44NCwyODloNzEuMjNWMGEzMDAuMDcsMzAwLjA3LDAsMCwxLTcxLjIzLDI1LjkyWm0zMTguOC42Mkw3MjYuNTkuODVhMzAwLDMwMCwwLDAsMS04My42NSwzMi4yNEw1NzcuMTEsMjI0LDUxMS4yOSwzMy4wOUEzMDAsMzAwLDAsMCwxLDQyNy42NC44NWwxMDEsMjg4Ljc2Wm0zNzQuMzYsNEw4OTkuMDUsNC45MUg4MDJMNzc1LjE0LDgxLjc0LDcwMS4wNSwyOTMuNjVBMzAwLjMyLDMwMC4zMiwwLDAsMSw3ODUsMjYxLjM1bDYuNzktMjEsMTkuMTQtNTcuNTRMODUwLjUyLDYybDQwLjA3LDEyMC44NSwxOC43LDU3LjU0LDcsMjFBMzAwLjIsMzAwLjIsMCwwLDEsMTAwMCwyOTMuNjUiIGZpbGw9IiNiM2IzYjMiLz48L3N2Zz4=";if(null!==(e=l.organization)&&void 0!==e&&e.logoUrl)r=null===(n=l.organization)||void 0===n?void 0:n.logoUrl;else if(null!==(t=i.navigation)&&void 0!==t&&t.logoUrl){var a;r=null===(a=i.navigation)||void 0===a?void 0:a.logoUrl}return r}),[null===(e=i.navigation)||void 0===e?void 0:e.logoUrl,null===(t=l.organization)||void 0===t?void 0:t.logoUrl]));return null==s.state?(0,j.jsx)(j.Fragment,{}):(0,j.jsxs)("div",{className:u.I8,children:[(0,j.jsxs)("div",{className:u.NB,children:[(0,j.jsx)("div",{className:u.tn,style:{height:null!==(n=i.configuration.loginLogoHeight)&&void 0!==n?n:50,backgroundImage:"url(".concat(c,")")}}),(0,j.jsx)(I,{})]}),i.authentication.contentBox&&(0,j.jsx)("div",{style:{width:"calc(100% - 400px)",height:"100%",position:"relative",overflow:"hidden"},children:(0,j.jsx)(C.p,{settings:{contentBoxProps:(0,h.ZN)(i.authentication.contentBox.props)}})})]})}))}}]);