@crystaldesign/products-component 24.11.0-beta.4 → 24.11.0-beta.40

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.
@@ -448,8 +448,8 @@ function useProductState(_ref) {
448
448
  behavior: 'smooth'
449
449
  });
450
450
  }, []);
451
- var debouncedScroll = react.useCallback(lodash.debounce( /*#__PURE__*/function () {
452
- var _ref2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(e) {
451
+ var debouncedScroll = react.useCallback(lodash.debounce(/*#__PURE__*/function () {
452
+ var _ref2 = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(e) {
453
453
  return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
454
454
  while (1) switch (_context.prev = _context.next) {
455
455
  case 0:
@@ -1549,6 +1549,7 @@ var SearchText = function SearchText(_ref) {
1549
1549
  e.preventDefault();
1550
1550
  },
1551
1551
  children: /*#__PURE__*/jsxRuntime.jsx("input", {
1552
+ "data-test-id": "search-text",
1552
1553
  ref: inputRef,
1553
1554
  placeholder: "Suche",
1554
1555
  onChange: function onChange(e) {
@@ -1580,7 +1581,7 @@ var ProductHeader = function ProductHeader(_ref) {
1580
1581
  filterObject = _ref.filterObject,
1581
1582
  parameters = _ref.parameters,
1582
1583
  currentlyMobile = _ref.currentlyMobile;
1583
- var _useState = react.useState( /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {})),
1584
+ var _useState = react.useState(/*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {})),
1584
1585
  _useState2 = _slicedToArray__default["default"](_useState, 2),
1585
1586
  sliderContent = _useState2[0],
1586
1587
  setSliderContent = _useState2[1];
@@ -1636,7 +1637,7 @@ var ProductHeader = function ProductHeader(_ref) {
1636
1637
  });
1637
1638
  };
1638
1639
  react.useEffect(function () {
1639
- if (!parameters || !parameters.id) setSliderContent( /*#__PURE__*/jsxRuntime.jsx(Facets, {
1640
+ if (!parameters || !parameters.id) setSliderContent(/*#__PURE__*/jsxRuntime.jsx(Facets, {
1640
1641
  productState: productState,
1641
1642
  parameters: parameters
1642
1643
  }));
@@ -433,8 +433,8 @@ function useProductState(_ref) {
433
433
  behavior: 'smooth'
434
434
  });
435
435
  }, []);
436
- var debouncedScroll = useCallback(debounce( /*#__PURE__*/function () {
437
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(e) {
436
+ var debouncedScroll = useCallback(debounce(/*#__PURE__*/function () {
437
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(e) {
438
438
  return _regeneratorRuntime.wrap(function _callee$(_context) {
439
439
  while (1) switch (_context.prev = _context.next) {
440
440
  case 0:
@@ -1534,6 +1534,7 @@ var SearchText = function SearchText(_ref) {
1534
1534
  e.preventDefault();
1535
1535
  },
1536
1536
  children: /*#__PURE__*/jsx("input", {
1537
+ "data-test-id": "search-text",
1537
1538
  ref: inputRef,
1538
1539
  placeholder: "Suche",
1539
1540
  onChange: function onChange(e) {
@@ -1565,7 +1566,7 @@ var ProductHeader = function ProductHeader(_ref) {
1565
1566
  filterObject = _ref.filterObject,
1566
1567
  parameters = _ref.parameters,
1567
1568
  currentlyMobile = _ref.currentlyMobile;
1568
- var _useState = useState( /*#__PURE__*/jsx(Fragment, {})),
1569
+ var _useState = useState(/*#__PURE__*/jsx(Fragment, {})),
1569
1570
  _useState2 = _slicedToArray(_useState, 2),
1570
1571
  sliderContent = _useState2[0],
1571
1572
  setSliderContent = _useState2[1];
@@ -1621,7 +1622,7 @@ var ProductHeader = function ProductHeader(_ref) {
1621
1622
  });
1622
1623
  };
1623
1624
  useEffect(function () {
1624
- if (!parameters || !parameters.id) setSliderContent( /*#__PURE__*/jsx(Facets, {
1625
+ if (!parameters || !parameters.id) setSliderContent(/*#__PURE__*/jsx(Facets, {
1625
1626
  productState: productState,
1626
1627
  parameters: parameters
1627
1628
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/products/ProductsHeader/SearchText/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAK9D,KAAK,KAAK,GAAG;IACX,YAAY,EAAE,YAAY,CAAC;IAC3B,iBAAiB,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC5E,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,QAAA,MAAM,UAAU,qIAOb,KAAK,gBAgEP,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/products/ProductsHeader/SearchText/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAK9D,KAAK,KAAK,GAAG;IACX,YAAY,EAAE,YAAY,CAAC;IAC3B,iBAAiB,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC5E,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,QAAA,MAAM,UAAU,qIAOb,KAAK,gBAwEP,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see 89.products-component.umd.min.js.LICENSE.txt */
2
- "use strict";(self.webpackChunkCrystaldesignProductsComponent=self.webpackChunkCrystaldesignProductsComponent||[]).push([[89],{7089:(e,t,n)=>{n.r(t),n.d(t,{default:()=>Z});var r=n(1594),o=n(2108),a=n(6557),i=n(8742),s=n(3106),l=n.n(s),c=n(5298),u=n(970),d=n(6666),h=n(7975),v=n(4020),p=n(1240),g=n(9681),x=n(2919),w=n.n(x),f=n(2246);function OpenId(){var e,t,n,r=(0,o.IB)(),a=r.configurationStore,i=r.authorizationStore,s=(0,g.B)().t,l=null===(e=i.state)||void 0===e?void 0:e.loginMethods;return(0,f.jsxs)(f.Fragment,{children:[(null==l?void 0:l.google)&&(0,f.jsxs)(p.A,{className:w()(c.Ob,c.q7),onClick:function onClick(){var e;return i.openOAuthLogin("google",i.state.organizationId,null===(e=i.state)||void 0===e?void 0:e.invitationId)},children:[(0,f.jsx)("div",{}),s("auth.login.google")]}),(null==l?void 0:l.microsoft)&&(0,f.jsxs)(p.A,{className:w()(c.Ob,c.l$),onClick:function onClick(){var e;return i.openOAuthLogin("microsoft",i.state.organizationId,null===(e=i.state)||void 0===e?void 0:e.invitationId)},children:[(0,f.jsx)("div",{}),s("auth.login.microsoft")]}),(null==l?void 0:l.generic)&&(0,f.jsxs)(p.A,{className:c.Ob,style:{backgroundColor:null!==(t=l.generic.backgroundColor)&&void 0!==t?t:a.theme.palette.secondary.main,color:null!==(n=l.generic.color)&&void 0!==n?n:a.theme.palette.secondary.contrastText},onClick:function onClick(){var e;return i.openOAuthLogin("genericOpenId",i.state.organizationId,null===(e=i.state)||void 0===e?void 0:e.invitationId)},children:[(0,f.jsx)("div",{style:l.generic.logo?{backgroundImage:"url(".concat(l.generic.logo,")")}:{}}),s("auth.login.generic")]})]})}var m=n(5051),j=(0,m.tZ)("Framework","Login");const A=(0,u.PA)((function Login(){var e,t,n,s,u=(0,o.IB)(),x=u.authorizationStore,w=u.authorizationHandler,m=(0,r.useState)("enter"),A=(0,i.A)(m,2),k=A[0],y=A[1],C=(0,r.useState)(null!==(e=null===(t=x.state)||void 0===t?void 0:t.email)&&void 0!==e?e:""),M=(0,i.A)(C,2),L=M[0],N=M[1],S=(0,r.useState)(""),I=(0,i.A)(S,2),b=I[0],z=I[1],E=(0,r.useState)(""),P=(0,i.A)(E,2),D=P[0],O=P[1],F=(0,r.useState)(!1),T=(0,i.A)(F,2),_=T[0],B=T[1],R=(0,r.useState)(x.state.invitationId),U=(0,i.A)(R,2),$=U[0],H=U[1],V=(0,r.useState)("LOGIN"==(null===(n=x.state)||void 0===n?void 0:n.type)?x.state.error:void 0),K=(0,i.A)(V,2),Q=K[0],W=K[1],Y=(0,g.B)().t,G=function(){var e=(0,a.A)(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,$){n.next=6;break}return n.next=4,w.getInvitationValue("id",L);case 4:(e=n.sent)&&(e.isNewUser&&(x.close(),x.showRegister(void 0,L,!0)),H(!0),B(!0));case 6:return n.next=8,w.fetchLoginProvider({email:L});case 8:"standard"==(t=n.sent).provider?y("login"):x.openOAuthLogin(t.provider,x.state.organizationId),n.next=16;break;case 12:n.prev=12,n.t0=n.catch(0),j.error(new d.p$("Error while fetching login provider",{cause:n.t0})),W("auth.error.password");case 16:case"end":return n.stop()}}),_callee,null,[[0,12]])})));return function onContinue(){return e.apply(this,arguments)}}(),q=function(){var e=(0,a.A)(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.gP)(x.login(L,b,!1,x.state.organizationId,x.state.invitationId,D));case 3:N(""),z(""),W(void 0),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(0),j.error(new d.p$("Error while logging in",{cause:e.t0})),W($?"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)}}(),Z=function(){var e=(0,a.A)(l().mark((function _callee3(){return l().wrap((function _callee3$(e){for(;;)switch(e.prev=e.next){case 0:x.showRequestNewPassword(L);case 1:case"end":return e.stop()}}),_callee3)})));return function resetPassword(){return e.apply(this,arguments)}}(),X="enter"==k&&0==L.length||"enter"!=k&&0==b.length;_&&!X&&(X=0==D.length);var J=null===(s=x.state)||void 0===s?void 0:s.loginMethods;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("h1",{children:Y("auth.title.login")}),(0,f.jsx)("p",{children:Y("auth.text.login","")}),!!Q&&(0,f.jsxs)("div",{className:c.z3,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{id:"loginerrortext",children:Y(Q)})]}),(0,f.jsx)(OpenId,{}),((null==J?void 0:J.generic)||(null==J?void 0:J.google)||(null==J?void 0:J.microsoft))&&J.standard&&(0,f.jsx)("div",{className:c.me,children:"or"}),(null==J?void 0:J.standard)&&(0,f.jsxs)(f.Fragment,{children:["enter"==k&&(0,f.jsxs)("form",{children:[(0,f.jsx)(v.A,{id:"username",value:L,autoComplete:"username",autoFocus:!0,placeholder:Y("auth.input.email"),onChange:function onChange(e){return N(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&G()}}),(0,f.jsx)(v.A,{value:b,id:"password",type:"password",autoComplete:"current-password",hidden:!0,autoFocus:!0,placeholder:Y("auth.input.password"),onChange:function onChange(e){return z(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&q()}})]}),"login"==k&&(0,f.jsxs)("form",{children:[_&&(0,f.jsx)(v.A,{value:D,type:"text",autoFocus:!0,placeholder:Y("auth.input.otp"),onChange:function onChange(e){return O(e.target.value)}}),(0,f.jsx)("label",{className:c.eK,onClick:function reset(){y("enter"),N(""),z(""),W(void 0)},children:(0,f.jsx)(v.A,{value:L,readOnly:!0,placeholder:Y("auth.input.email")})}),(0,f.jsx)(v.A,{value:b,type:"password",id:"password",autoFocus:!0,placeholder:Y("auth.input.password"),onChange:function onChange(e){return z(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&q()}}),(0,f.jsx)("div",{className:c.nf,style:{textAlign:"right"},onClick:Z,children:Y("auth.button.forgotpassword")})]}),(0,f.jsx)(p.A,{id:"submit",disabled:X,onClick:"enter"==k?G:q,children:Y("enter"==k?"auth.button.continue":"auth.button.login")})]})]})}));var k=(0,m.tZ)("Framework","RequestNewPassword");function RequestNewPassword(e){var t=e.initEmail,n=(0,o.IB)(),s=n.authorizationStore,u=n.apiHandler,h=n.loadingAndErrorStore,x=(0,r.useState)(t),w=(0,i.A)(x,2),m=w[0],j=w[1],A=(0,r.useState)(!1),y=(0,i.A)(A,2),C=y[0],M=y[1],L=(0,r.useState)(),N=(0,i.A)(L,2),S=N[0],I=N[1],b=(0,r.useState)(),z=(0,i.A)(b,2),E=z[0],P=z[1],D=(0,g.B)().t,O=function(){var e=(0,a.A)(l().mark((function _callee(){return l().wrap((function _callee$(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,P(!0),h.toggleLoading("SendPassword"),e.next=5,u.sendPasswordRecoveryMail({email:m});case 5:P(!1),h.toggleLoading("SendPassword"),M(!0),I(void 0),e.next=17;break;case 11:e.prev=11,e.t0=e.catch(0),k.error(new d.p$("Error while sending password recovery mail",{cause:e.t0})),I("auth.error.resetpassword"),P(!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,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("h1",{children:D("auth.title.resetpassword")}),(0,f.jsx)("p",{children:D("auth.info.resetdescription")}),!!S&&(0,f.jsxs)("div",{className:c.z3,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:D(S)})]}),C&&(0,f.jsxs)("div",{className:c.kX,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:D("auth.info.resetpassword")})]}),!C&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(v.A,{value:m,autoFocus:!0,placeholder:D("auth.input.email"),onChange:function onChange(e){return j(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&O()}}),(0,f.jsx)(p.A,{disabled:0==m.length,onClick:O,children:D("auth.button.resetpassword")})]}),C&&(0,f.jsx)(p.A,{disabled:E,onClick:function toLogin(){s.close(),s.showLogin()},children:D("auth.button.login")})]})}function Errormessage(e){var t=e.hasError,n=e.authErrorsg,r=(0,g.B)().t;return(0,f.jsxs)("div",{className:c.z3,children:[(0,f.jsx)("span",{}),"INVALID"==t&&(0,f.jsx)("div",{children:r("auth.error.verifypassword")}),"SERVER"==t&&(0,f.jsx)("div",{children:n})]})}var y=(0,m.tZ)("Framework","cfhange-password");function ChangePassword(e){var t,n=e.token,s=(0,o.IB)(),u=s.configurationStore,h=s.authorizationStore,x=s.apiHandler,w=(s.loadingAndErrorStore,(0,r.useState)("")),m=(0,i.A)(w,2),j=m[0],A=m[1],k=(0,r.useState)(""),C=(0,i.A)(k,2),M=C[0],L=C[1],N=(0,r.useState)(!1),S=(0,i.A)(N,2),I=S[0],b=S[1],z=(0,r.useState)(),E=(0,i.A)(z,2),P=E[0],D=E[1],O=(0,r.useState)(""),F=(0,i.A)(O,2),T=F[0],_=F[1],B=(0,r.useRef)(null),R=(0,g.B)().t;(0,r.useEffect)((function(){j===M&&D(void 0)}),[j,M]);var U=function(){var e=(0,a.A)(l().mark((function _callee(){return l().wrap((function _callee$(e){for(;;)switch(e.prev=e.next){case 0:if(_(R("auth.error.verifypasswordserver")),!(j.length<8||j!==M)){e.next=4;break}return D("INVALID"),e.abrupt("return");case 4:return e.prev=4,e.next=7,x.resetPassword({password:j,token:n});case 7:b(!0),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(4),$(e.t0);case 13:case"end":return e.stop()}}),_callee,null,[[4,10]])})));return function resetPassword(){return e.apply(this,arguments)}}(),$=function handleError(e){if(e instanceof d.p$){if("AUTH_0003"===e.name)_(R("auth.error.verifypasswordtokenerror",{errormsg:R("auth.error.tokenexpired")}));else _(R("auth.error.verifypasswordserver",e.message));y.error(e)}y.error(new d.p$("Error while resetting password",{cause:e})),D("SERVER")};return"SERVER"===P?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Errormessage,{hasError:P,authErrorsg:T}),(0,f.jsx)(p.A,{onClick:function onClickRequestNewPassword(){h.showRequestNewPassword("")},children:R("auth.button.resetpassword")})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("h1",{children:R("auth.title.verifypassword")}),I&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("div",{className:c.kX,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:R("auth.info.verifypassword")})]}),(null===(t=u.authentication.resetPassword)||void 0===t?void 0:t.returnToLogin)&&(0,f.jsx)(p.A,{onClick:function goToLogin(){h.close(),h.showLogin()},children:R("auth.button.login")})]}),!I&&(0,f.jsxs)(f.Fragment,{children:[P&&(0,f.jsx)(Errormessage,{hasError:P,authErrorsg:T}),(0,f.jsxs)("form",{children:[(0,f.jsx)(v.A,{value:j,autoFocus:!0,placeholder:R("auth.input.password"),type:"password",autoComplete:"new-password",onChange:function onChange(e){return A(e.target.value)},onKeyPress:function onKeyPress(e){var t;return"Enter"==e.key&&(null===(t=B.current)||void 0===t?void 0:t.focus())}}),(0,f.jsx)(v.A,{ref:B,value:M,placeholder:R("auth.input.verifypassword"),type:"password",autoComplete:"new-password",onChange:function onChange(e){return L(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&U()}})]}),(0,f.jsx)(p.A,{disabled:!j||!M,onClick:U,children:R("auth.button.save")})]})]})}var C=n(8279);function WelcomeScreen(e){var t=e.isNewUser,n=e.invitationId,s=(0,o.IB)(),u=s.authorizationStore,d=s.authorizationHandler,h=(0,r.useState)(""),v=(0,i.A)(h,2),x=v[0],w=v[1],m=(0,g.B)().t,j=function(){var e=(0,a.A)(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)&&(u.close(),u.showLogin(void 0,void 0,void 0,n,e));case 4:case"end":return t.stop()}}),_callee)})));return function toLogin(){return e.apply(this,arguments)}}(),A=function(){var e=(0,a.A)(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)&&(u.close(),u.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,a.A)(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=u.state)||void 0===e?void 0:e.invitationId,r.next=3,d.getInvitationValue("email",t);case 3:if(!(n=r.sent)){r.next=8;break}return r.abrupt("return",n.email);case 8:return w("Invitation not found"),r.abrupt("return",void 0);case 10:case"end":return r.stop()}}),_callee3)}))),_checkInvitation.apply(this,arguments)}return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("h1",{children:m("auth.title.welcome")}),(0,f.jsx)("p",{children:m("auth.info.welcomedescription")}),x&&(0,f.jsxs)("div",{className:c.z3,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:m(x)})]}),t&&!x&&(0,f.jsx)(p.A,{onClick:A,children:m("auth.title.register")}),!t&&!x&&(0,f.jsx)(p.A,{onClick:j,children:m("auth.button.login")})]})}var M=n(1113),L=n(250),N=n(120),S=(n(3886),n(203)),I=n(4134),b=n(8686),z=r.createContext();const E=z;var P=n(6224),D=n(9874),O=r.forwardRef((function SwitchBase(e,t){var n=e.autoFocus,o=e.checked,a=e.checkedIcon,i=e.classes,s=e.className,l=e.defaultChecked,c=e.disabled,u=e.icon,d=e.id,h=e.inputProps,v=e.inputRef,p=e.name,g=e.onBlur,x=e.onChange,w=e.onFocus,f=e.readOnly,m=e.required,j=e.tabIndex,A=e.type,k=e.value,y=(0,N.A)(e,["autoFocus","checked","checkedIcon","classes","className","defaultChecked","disabled","icon","id","inputProps","inputRef","name","onBlur","onChange","onFocus","readOnly","required","tabIndex","type","value"]),C=(0,b.A)({controlled:o,default:Boolean(l),name:"SwitchBase",state:"checked"}),M=(0,I.A)(C,2),z=M[0],P=M[1],O=function useFormControl_useFormControl(){return r.useContext(E)}(),F=c;O&&void 0===F&&(F=O.disabled);var T="checkbox"===A||"radio"===A;return r.createElement(D.A,(0,L.A)({component:"span",className:(0,S.A)(i.root,s,z&&i.checked,F&&i.disabled),disabled:F,tabIndex:null,role:void 0,onFocus:function handleFocus(e){w&&w(e),O&&O.onFocus&&O.onFocus(e)},onBlur:function handleBlur(e){g&&g(e),O&&O.onBlur&&O.onBlur(e)},ref:t},y),r.createElement("input",(0,L.A)({autoFocus:n,checked:o,defaultChecked:l,className:i.input,disabled:F,id:T&&d,name:p,onChange:function handleInputChange(e){var t=e.target.checked;P(t),x&&x(e,t)},readOnly:f,ref:v,required:m,tabIndex:j,type:A,value:k},h)),z?a:u)}));const F=(0,P.A)({root:{padding:9},checked:{},disabled:{},input:{cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}},{name:"PrivateSwitchBase"})(O);var T=n(5261);const _=(0,T.A)(r.createElement("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"}),"CheckBoxOutlineBlank"),B=(0,T.A)(r.createElement("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"}),"CheckBox");var R=n(4287);const U=(0,T.A)(r.createElement("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"}),"IndeterminateCheckBox");var $=n(433),H=r.createElement(B,null),V=r.createElement(_,null),K=r.createElement(U,null),Q=r.forwardRef((function Checkbox(e,t){var n=e.checkedIcon,o=void 0===n?H:n,a=e.classes,i=e.color,s=void 0===i?"secondary":i,l=e.icon,c=void 0===l?V:l,u=e.indeterminate,d=void 0!==u&&u,h=e.indeterminateIcon,v=void 0===h?K:h,p=e.inputProps,g=e.size,x=void 0===g?"medium":g,w=(0,N.A)(e,["checkedIcon","classes","color","icon","indeterminate","indeterminateIcon","inputProps","size"]),f=d?v:c,m=d?v:o;return r.createElement(F,(0,L.A)({type:"checkbox",classes:{root:(0,S.A)(a.root,a["color".concat((0,$.A)(s))],d&&a.indeterminate),checked:a.checked,disabled:a.disabled},color:s,inputProps:(0,L.A)({"data-indeterminate":d},p),icon:r.cloneElement(f,{fontSize:void 0===f.props.fontSize&&"small"===x?x:f.props.fontSize}),checkedIcon:r.cloneElement(m,{fontSize:void 0===m.props.fontSize&&"small"===x?x:m.props.fontSize}),ref:t},w))}));const W=(0,P.A)((function styles(e){return{root:{color:e.palette.text.secondary},checked:{},disabled:{},indeterminate:{},colorPrimary:{"&$checked":{color:e.palette.primary.main,"&:hover":{backgroundColor:(0,R.Rv)(e.palette.primary.main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}}},"&$disabled":{color:e.palette.action.disabled}},colorSecondary:{"&$checked":{color:e.palette.secondary.main,"&:hover":{backgroundColor:(0,R.Rv)(e.palette.secondary.main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}}},"&$disabled":{color:e.palette.action.disabled}}}}),{name:"MuiCheckbox"})(Q);var Y=(0,m.tZ)("Framework","Register");const G=(0,u.PA)((function Register(){var e,t,n,s,u,x,w=(0,o.IB)(),m=w.authorizationStore,j=w.configurationStore,A=(0,g.B)().t,k=(0,r.useState)(null!==(e=null===(t=m.state)||void 0===t?void 0:t.email)&&void 0!==e?e:""),y=(0,i.A)(k,2),C=y[0],L=y[1],N=(0,r.useState)(""),S=(0,i.A)(N,2),I=S[0],b=S[1],z=(0,r.useState)(""),E=(0,i.A)(z,2),P=E[0],D=E[1],O=(0,r.useState)(""),F=(0,i.A)(O,2),T=F[0],_=F[1],B=(0,r.useState)(""),R=(0,i.A)(B,2),U=R[0],$=R[1],H=(0,r.useState)(""),V=(0,i.A)(H,2),K=V[0],Q=V[1],G=(0,r.useState)(""),q=(0,i.A)(G,2),Z=q[0],X=q[1],J=(0,r.useState)(!1),ee=(0,i.A)(J,2),te=ee[0],ne=ee[1],re=function(){var e=(0,a.A)(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.gP)(m.register(C,I,U,T,null===(e=m.state)||void 0===e?void 0:e.invitationId,Z));case 3:L(""),b(""),D(""),$(""),_(""),t.next=14;break;case 10:t.prev=10,t.t0=t.catch(0),Q("auth.error.invitationotp"),Y.error(new d.p$("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)}}(),oe=null===(n=m.state)||void 0===n?void 0:n.useOtp,ae=function validPassword(){return oe?null!=Z&&""!==Z&&I==P&&""!=I&&null!=I&&te:I==P&&""!=I&&null!=I&&te},ie=null===(s=m.state)||void 0===s?void 0:s.loginMethods;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("h1",{children:A("auth.title.register")}),(0,f.jsx)("p",{children:A("auth.text.register","")}),!!K&&(0,f.jsxs)("div",{className:c.z3,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:A(K)})]}),(0,f.jsx)(OpenId,{}),((null==ie?void 0:ie.generic)||(null==ie?void 0:ie.google)||(null==ie?void 0:ie.microsoft))&&ie.standard&&(0,f.jsx)("div",{className:c.me,children:"or"}),(null==ie?void 0:ie.standard)&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("form",{children:[oe&&(0,f.jsx)(v.A,{type:"text",value:Z,placeholder:A("auth.input.otp"),onChange:function onChange(e){return X(e.target.value)}}),(0,f.jsx)(v.A,{value:U,autoFocus:!0,placeholder:A("backoffice.form.userdetails.items.name"),onChange:function onChange(e){return $(e.target.value)}}),(0,f.jsx)(v.A,{value:T,autoFocus:!0,placeholder:A("backoffice.form.userdetails.items.familyName"),onChange:function onChange(e){return _(e.target.value)}}),(0,f.jsx)(v.A,{value:C,autoComplete:"email",autoFocus:!0,placeholder:A("auth.input.email"),disabled:!0}),(0,f.jsx)(v.A,{value:I,type:"password",autoFocus:!0,placeholder:A("auth.input.password"),onChange:function onChange(e){return b(e.target.value)}}),(0,f.jsx)(v.A,{value:P,type:"password",autoFocus:!0,placeholder:A("auth.input.repeatpassword"),onChange:function onChange(e){return D(e.target.value)}}),(0,f.jsxs)("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[(0,f.jsx)(W,{name:"checkAGB",checked:te,onClick:function onClick(){return ne(!te)}}),(0,f.jsxs)("div",{style:{display:"flex",flexDirection:"column",fontSize:9},children:[(0,f.jsx)("span",{children:A("auth.acceptprivacyandagb")}),(0,f.jsxs)("span",{children:[(0,f.jsx)("a",{target:"_blank",href:null!==(u=j.navigation.tosUrl)&&void 0!==u?u:"https://www.diva-portal.de/agb",children:A("auth.GeneralTerms")}),", ",(0,f.jsx)("a",{target:"_blank",href:null!==(x=j.navigation.privacyUrl)&&void 0!==x?x:"https://www.diva-portal.de/datenschutz",children:A("auth.privacypolicy")})]})]})]}),(0,f.jsx)(M.A,{style:{color:"#FF8C00",marginTop:10,fontSize:14},hidden:ae(),children:A("auth.input.passwordsnotmatch")})]}),(0,f.jsx)(p.A,{disabled:!ae(),onClick:ae()?re:void 0,children:A("auth.input.login")})]})]})}));var q=(0,u.PA)((function(){var e,t=(0,o.IB)().authorizationStore;switch(null===(e=t.state)||void 0===e?void 0:e.type){case"LOGIN":return(0,f.jsx)(A,{});case"REQUEST_NEW_PASSWORD":return(0,f.jsx)(RequestNewPassword,{initEmail:t.state.email});case"CHANGE_PASSWORD":return(0,f.jsx)(ChangePassword,{token:t.state.token});case"WELCOME":return(0,f.jsx)(WelcomeScreen,{isNewUser:t.state.isNewUser,invitationId:t.state.invitationId});case"REGISTER":return(0,f.jsx)(G,{});case"INVITATION_EXPIRED":return(0,f.jsx)("h1",{children:"Abgelaufen"});default:return(0,f.jsx)(f.Fragment,{})}}));const Z=(0,u.PA)((function Auth(){var e,t,n,a=(0,o.IB)(),i=a.authorizationStore,s=a.configurationStore,l=a.dataStore,u=(a.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=s.navigation)&&void 0!==t&&t.logoUrl){var o;r=null===(o=s.navigation)||void 0===o?void 0:o.logoUrl}return r}),[null===(e=s.navigation)||void 0===e?void 0:e.logoUrl,null===(t=l.organization)||void 0===t?void 0:t.logoUrl]));return null==i.state?(0,f.jsx)(f.Fragment,{}):(0,f.jsxs)("div",{className:c.j2,children:[(0,f.jsxs)("div",{className:c.TG,children:[(0,f.jsx)("div",{className:c.r$,style:{height:null!==(n=s.configuration.loginLogoHeight)&&void 0!==n?n:50,backgroundImage:"url(".concat(u,")")}}),(0,f.jsx)(q,{})]}),s.authentication.contentBox&&(0,f.jsx)("div",{style:{width:"calc(100% - 400px)",height:"100%",position:"relative",overflow:"hidden"},children:(0,f.jsx)(C.s,{settings:{contentBoxProps:(0,h.HO)(s.authentication.contentBox.props)}})})]})}))}}]);
2
+ "use strict";(self.webpackChunkCrystaldesignProductsComponent=self.webpackChunkCrystaldesignProductsComponent||[]).push([[89],{7089:(e,t,n)=>{n.r(t),n.d(t,{default:()=>Z});var r=n(1594),o=n(2108),a=n(6557),i=n(8742),s=n(3106),l=n.n(s),c=n(5298),u=n(970),d=n(6666),h=n(7975),v=n(4020),p=n(1240),g=n(9681),x=n(2919),w=n.n(x),f=n(2246);function OpenId(){var e,t,n,r=(0,o.IB)(),a=r.configurationStore,i=r.authorizationStore,s=(0,g.B)().t,l=null===(e=i.state)||void 0===e?void 0:e.loginMethods;return(0,f.jsxs)(f.Fragment,{children:[(null==l?void 0:l.google)&&(0,f.jsxs)(p.A,{className:w()(c.Ob,c.q7),onClick:function onClick(){var e;return i.openOAuthLogin("google",i.state.organizationId,null===(e=i.state)||void 0===e?void 0:e.invitationId)},children:[(0,f.jsx)("div",{}),s("auth.login.google")]}),(null==l?void 0:l.microsoft)&&(0,f.jsxs)(p.A,{className:w()(c.Ob,c.l$),onClick:function onClick(){var e;return i.openOAuthLogin("microsoft",i.state.organizationId,null===(e=i.state)||void 0===e?void 0:e.invitationId)},children:[(0,f.jsx)("div",{}),s("auth.login.microsoft")]}),(null==l?void 0:l.generic)&&(0,f.jsxs)(p.A,{className:c.Ob,style:{backgroundColor:null!==(t=l.generic.backgroundColor)&&void 0!==t?t:a.theme.palette.secondary.main,color:null!==(n=l.generic.color)&&void 0!==n?n:a.theme.palette.secondary.contrastText},onClick:function onClick(){var e;return i.openOAuthLogin("genericOpenId",i.state.organizationId,null===(e=i.state)||void 0===e?void 0:e.invitationId)},children:[(0,f.jsx)("div",{style:l.generic.logo?{backgroundImage:"url(".concat(l.generic.logo,")")}:{}}),s("auth.login.generic")]})]})}var m=n(5051),j=(0,m.tZ)("Framework","Login");const A=(0,u.PA)((function Login(){var e,t,n,s,u=(0,o.IB)(),x=u.authorizationStore,w=u.authorizationHandler,m=(0,r.useState)("enter"),A=(0,i.A)(m,2),k=A[0],y=A[1],C=(0,r.useState)(null!==(e=null===(t=x.state)||void 0===t?void 0:t.email)&&void 0!==e?e:""),M=(0,i.A)(C,2),I=M[0],L=M[1],N=(0,r.useState)(""),S=(0,i.A)(N,2),b=S[0],z=S[1],E=(0,r.useState)(""),P=(0,i.A)(E,2),D=P[0],O=P[1],F=(0,r.useState)(!1),T=(0,i.A)(F,2),_=T[0],B=T[1],R=(0,r.useState)(x.state.invitationId),U=(0,i.A)(R,2),$=U[0],H=U[1],V=(0,r.useState)("LOGIN"==(null===(n=x.state)||void 0===n?void 0:n.type)?x.state.error:void 0),K=(0,i.A)(V,2),Q=K[0],W=K[1],Y=(0,g.B)().t,G=function(){var e=(0,a.A)(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,$){n.next=6;break}return n.next=4,w.getInvitationValue("id",I);case 4:(e=n.sent)&&(e.isNewUser&&(x.close(),x.showRegister(void 0,I,!0)),H(!0),B(!0));case 6:return n.next=8,w.fetchLoginProvider({email:I});case 8:"standard"==(t=n.sent).provider?y("login"):x.openOAuthLogin(t.provider,x.state.organizationId,x.state.invitationId),n.next=16;break;case 12:n.prev=12,n.t0=n.catch(0),j.error(new d.p$("Error while fetching login provider",{cause:n.t0})),W("auth.error.password");case 16:case"end":return n.stop()}}),_callee,null,[[0,12]])})));return function onContinue(){return e.apply(this,arguments)}}(),q=function(){var e=(0,a.A)(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.gP)(x.login(I,b,!1,x.state.organizationId,x.state.invitationId,D));case 3:L(""),z(""),W(void 0),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(0),j.error(new d.p$("Error while logging in",{cause:e.t0})),W($?"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)}}(),Z=function(){var e=(0,a.A)(l().mark((function _callee3(){return l().wrap((function _callee3$(e){for(;;)switch(e.prev=e.next){case 0:x.showRequestNewPassword(I);case 1:case"end":return e.stop()}}),_callee3)})));return function resetPassword(){return e.apply(this,arguments)}}(),X="enter"==k&&0==I.length||"enter"!=k&&0==b.length;_&&!X&&(X=0==D.length);var J=null===(s=x.state)||void 0===s?void 0:s.loginMethods;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("h1",{children:Y("auth.title.login")}),(0,f.jsx)("p",{children:Y("auth.text.login","")}),!!Q&&(0,f.jsxs)("div",{className:c.z3,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{id:"loginerrortext",children:Y(Q)})]}),(0,f.jsx)(OpenId,{}),((null==J?void 0:J.generic)||(null==J?void 0:J.google)||(null==J?void 0:J.microsoft))&&J.standard&&(0,f.jsx)("div",{className:c.me,children:"or"}),(null==J?void 0:J.standard)&&(0,f.jsxs)(f.Fragment,{children:["enter"==k&&(0,f.jsxs)("form",{children:[(0,f.jsx)(v.A,{id:"username",value:I,autoComplete:"username",autoFocus:!0,placeholder:Y("auth.input.email"),onChange:function onChange(e){return L(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&G()}}),(0,f.jsx)(v.A,{value:b,id:"password",type:"password",autoComplete:"current-password",hidden:!0,autoFocus:!0,placeholder:Y("auth.input.password"),onChange:function onChange(e){return z(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&q()}})]}),"login"==k&&(0,f.jsxs)("form",{children:[_&&(0,f.jsx)(v.A,{value:D,type:"text",autoFocus:!0,placeholder:Y("auth.input.otp"),onChange:function onChange(e){return O(e.target.value)}}),(0,f.jsx)("label",{className:c.eK,onClick:function reset(){y("enter"),L(""),z(""),W(void 0)},children:(0,f.jsx)(v.A,{value:I,readOnly:!0,placeholder:Y("auth.input.email")})}),(0,f.jsx)(v.A,{value:b,type:"password",id:"password",autoFocus:!0,placeholder:Y("auth.input.password"),onChange:function onChange(e){return z(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&q()}}),(0,f.jsx)("div",{className:c.nf,style:{textAlign:"right"},onClick:Z,children:Y("auth.button.forgotpassword")})]}),(0,f.jsx)(p.A,{id:"submit",disabled:X,onClick:"enter"==k?G:q,children:Y("enter"==k?"auth.button.continue":"auth.button.login")})]})]})}));var k=(0,m.tZ)("Framework","RequestNewPassword");function RequestNewPassword(e){var t=e.initEmail,n=(0,o.IB)(),s=n.authorizationStore,u=n.apiHandler,h=n.loadingAndErrorStore,x=(0,r.useState)(t),w=(0,i.A)(x,2),m=w[0],j=w[1],A=(0,r.useState)(!1),y=(0,i.A)(A,2),C=y[0],M=y[1],I=(0,r.useState)(),L=(0,i.A)(I,2),N=L[0],S=L[1],b=(0,r.useState)(),z=(0,i.A)(b,2),E=z[0],P=z[1],D=(0,g.B)().t,O=function(){var e=(0,a.A)(l().mark((function _callee(){return l().wrap((function _callee$(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,P(!0),h.toggleLoading("SendPassword"),e.next=5,u.sendPasswordRecoveryMail({email:m});case 5:P(!1),h.toggleLoading("SendPassword"),M(!0),S(void 0),e.next=17;break;case 11:e.prev=11,e.t0=e.catch(0),k.error(new d.p$("Error while sending password recovery mail",{cause:e.t0})),S("auth.error.resetpassword"),P(!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,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("h1",{children:D("auth.title.resetpassword")}),(0,f.jsx)("p",{children:D("auth.info.resetdescription")}),!!N&&(0,f.jsxs)("div",{className:c.z3,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:D(N)})]}),C&&(0,f.jsxs)("div",{className:c.kX,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:D("auth.info.resetpassword")})]}),!C&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(v.A,{value:m,autoFocus:!0,placeholder:D("auth.input.email"),onChange:function onChange(e){return j(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&O()}}),(0,f.jsx)(p.A,{disabled:0==m.length,onClick:O,children:D("auth.button.resetpassword")})]}),C&&(0,f.jsx)(p.A,{disabled:E,onClick:function toLogin(){s.close(),s.showLogin()},children:D("auth.button.login")})]})}function Errormessage(e){var t=e.hasError,n=e.authErrorsg,r=(0,g.B)().t;return(0,f.jsxs)("div",{className:c.z3,children:[(0,f.jsx)("span",{}),"INVALID"==t&&(0,f.jsx)("div",{children:r("auth.error.verifypassword")}),"SERVER"==t&&(0,f.jsx)("div",{children:n})]})}var y=(0,m.tZ)("Framework","cfhange-password");function ChangePassword(e){var t,n=e.token,s=(0,o.IB)(),u=s.configurationStore,h=s.authorizationStore,x=s.apiHandler,w=(s.loadingAndErrorStore,(0,r.useState)("")),m=(0,i.A)(w,2),j=m[0],A=m[1],k=(0,r.useState)(""),C=(0,i.A)(k,2),M=C[0],I=C[1],L=(0,r.useState)(!1),N=(0,i.A)(L,2),S=N[0],b=N[1],z=(0,r.useState)(),E=(0,i.A)(z,2),P=E[0],D=E[1],O=(0,r.useState)(""),F=(0,i.A)(O,2),T=F[0],_=F[1],B=(0,r.useRef)(null),R=(0,g.B)().t;(0,r.useEffect)((function(){j===M&&D(void 0)}),[j,M]);var U=function(){var e=(0,a.A)(l().mark((function _callee(){return l().wrap((function _callee$(e){for(;;)switch(e.prev=e.next){case 0:if(_(R("auth.error.verifypasswordserver")),!(j.length<8||j!==M)){e.next=4;break}return D("INVALID"),e.abrupt("return");case 4:return e.prev=4,e.next=7,x.resetPassword({password:j,token:n});case 7:b(!0),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(4),$(e.t0);case 13:case"end":return e.stop()}}),_callee,null,[[4,10]])})));return function resetPassword(){return e.apply(this,arguments)}}(),$=function handleError(e){if(e instanceof d.p$){if("AUTH_0003"===e.name)_(R("auth.error.verifypasswordtokenerror",{errormsg:R("auth.error.tokenexpired")}));else _(R("auth.error.verifypasswordserver",e.message));y.error(e)}y.error(new d.p$("Error while resetting password",{cause:e})),D("SERVER")};return"SERVER"===P?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Errormessage,{hasError:P,authErrorsg:T}),(0,f.jsx)(p.A,{onClick:function onClickRequestNewPassword(){h.showRequestNewPassword("")},children:R("auth.button.resetpassword")})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("h1",{children:R("auth.title.verifypassword")}),S&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("div",{className:c.kX,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:R("auth.info.verifypassword")})]}),(null===(t=u.authentication.resetPassword)||void 0===t?void 0:t.returnToLogin)&&(0,f.jsx)(p.A,{onClick:function goToLogin(){h.close(),h.showLogin()},children:R("auth.button.login")})]}),!S&&(0,f.jsxs)(f.Fragment,{children:[P&&(0,f.jsx)(Errormessage,{hasError:P,authErrorsg:T}),(0,f.jsxs)("form",{children:[(0,f.jsx)(v.A,{value:j,autoFocus:!0,placeholder:R("auth.input.password"),type:"password",autoComplete:"new-password",onChange:function onChange(e){return A(e.target.value)},onKeyPress:function onKeyPress(e){var t;return"Enter"==e.key&&(null===(t=B.current)||void 0===t?void 0:t.focus())}}),(0,f.jsx)(v.A,{ref:B,value:M,placeholder:R("auth.input.verifypassword"),type:"password",autoComplete:"new-password",onChange:function onChange(e){return I(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&U()}})]}),(0,f.jsx)(p.A,{disabled:!j||!M,onClick:U,children:R("auth.button.save")})]})]})}var C=n(8279);function WelcomeScreen(e){var t=e.isNewUser,n=e.invitationId,s=e.invitationOrgId,u=(0,o.IB)(),d=u.authorizationStore,h=u.authorizationHandler,v=(0,r.useState)(""),x=(0,i.A)(v,2),w=x[0],m=x[1],j=(0,g.B)().t,A=function(){var e=(0,a.A)(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,s,n,e));case 4:case"end":return t.stop()}}),_callee)})));return function toLogin(){return e.apply(this,arguments)}}(),k=function(){var e=(0,a.A)(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,a.A)(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 m("Invitation not found"),r.abrupt("return",void 0);case 10:case"end":return r.stop()}}),_callee3)}))),_checkInvitation.apply(this,arguments)}return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("h1",{children:j("auth.title.welcome")}),(0,f.jsx)("p",{children:j("auth.info.welcomedescription")}),w&&(0,f.jsxs)("div",{className:c.z3,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:j(w)})]}),t&&!w&&(0,f.jsx)(p.A,{onClick:k,children:j("auth.title.register")}),!t&&!w&&(0,f.jsx)(p.A,{onClick:A,children:j("auth.button.login")})]})}var M=n(1113),I=n(250),L=n(120),N=(n(3886),n(203)),S=n(4134),b=n(8686),z=r.createContext();const E=z;var P=n(6224),D=n(9874),O=r.forwardRef((function SwitchBase(e,t){var n=e.autoFocus,o=e.checked,a=e.checkedIcon,i=e.classes,s=e.className,l=e.defaultChecked,c=e.disabled,u=e.icon,d=e.id,h=e.inputProps,v=e.inputRef,p=e.name,g=e.onBlur,x=e.onChange,w=e.onFocus,f=e.readOnly,m=e.required,j=e.tabIndex,A=e.type,k=e.value,y=(0,L.A)(e,["autoFocus","checked","checkedIcon","classes","className","defaultChecked","disabled","icon","id","inputProps","inputRef","name","onBlur","onChange","onFocus","readOnly","required","tabIndex","type","value"]),C=(0,b.A)({controlled:o,default:Boolean(l),name:"SwitchBase",state:"checked"}),M=(0,S.A)(C,2),z=M[0],P=M[1],O=function useFormControl_useFormControl(){return r.useContext(E)}(),F=c;O&&void 0===F&&(F=O.disabled);var T="checkbox"===A||"radio"===A;return r.createElement(D.A,(0,I.A)({component:"span",className:(0,N.A)(i.root,s,z&&i.checked,F&&i.disabled),disabled:F,tabIndex:null,role:void 0,onFocus:function handleFocus(e){w&&w(e),O&&O.onFocus&&O.onFocus(e)},onBlur:function handleBlur(e){g&&g(e),O&&O.onBlur&&O.onBlur(e)},ref:t},y),r.createElement("input",(0,I.A)({autoFocus:n,checked:o,defaultChecked:l,className:i.input,disabled:F,id:T&&d,name:p,onChange:function handleInputChange(e){var t=e.target.checked;P(t),x&&x(e,t)},readOnly:f,ref:v,required:m,tabIndex:j,type:A,value:k},h)),z?a:u)}));const F=(0,P.A)({root:{padding:9},checked:{},disabled:{},input:{cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}},{name:"PrivateSwitchBase"})(O);var T=n(5261);const _=(0,T.A)(r.createElement("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"}),"CheckBoxOutlineBlank"),B=(0,T.A)(r.createElement("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"}),"CheckBox");var R=n(4287);const U=(0,T.A)(r.createElement("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"}),"IndeterminateCheckBox");var $=n(433),H=r.createElement(B,null),V=r.createElement(_,null),K=r.createElement(U,null),Q=r.forwardRef((function Checkbox(e,t){var n=e.checkedIcon,o=void 0===n?H:n,a=e.classes,i=e.color,s=void 0===i?"secondary":i,l=e.icon,c=void 0===l?V:l,u=e.indeterminate,d=void 0!==u&&u,h=e.indeterminateIcon,v=void 0===h?K:h,p=e.inputProps,g=e.size,x=void 0===g?"medium":g,w=(0,L.A)(e,["checkedIcon","classes","color","icon","indeterminate","indeterminateIcon","inputProps","size"]),f=d?v:c,m=d?v:o;return r.createElement(F,(0,I.A)({type:"checkbox",classes:{root:(0,N.A)(a.root,a["color".concat((0,$.A)(s))],d&&a.indeterminate),checked:a.checked,disabled:a.disabled},color:s,inputProps:(0,I.A)({"data-indeterminate":d},p),icon:r.cloneElement(f,{fontSize:void 0===f.props.fontSize&&"small"===x?x:f.props.fontSize}),checkedIcon:r.cloneElement(m,{fontSize:void 0===m.props.fontSize&&"small"===x?x:m.props.fontSize}),ref:t},w))}));const W=(0,P.A)((function styles(e){return{root:{color:e.palette.text.secondary},checked:{},disabled:{},indeterminate:{},colorPrimary:{"&$checked":{color:e.palette.primary.main,"&:hover":{backgroundColor:(0,R.Rv)(e.palette.primary.main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}}},"&$disabled":{color:e.palette.action.disabled}},colorSecondary:{"&$checked":{color:e.palette.secondary.main,"&:hover":{backgroundColor:(0,R.Rv)(e.palette.secondary.main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}}},"&$disabled":{color:e.palette.action.disabled}}}}),{name:"MuiCheckbox"})(Q);var Y=(0,m.tZ)("Framework","Register");const G=(0,u.PA)((function Register(){var e,t,n,s,u,x,w=(0,o.IB)(),m=w.authorizationStore,j=w.configurationStore,A=(0,g.B)().t,k=(0,r.useState)(null!==(e=null===(t=m.state)||void 0===t?void 0:t.email)&&void 0!==e?e:""),y=(0,i.A)(k,2),C=y[0],I=y[1],L=(0,r.useState)(""),N=(0,i.A)(L,2),S=N[0],b=N[1],z=(0,r.useState)(""),E=(0,i.A)(z,2),P=E[0],D=E[1],O=(0,r.useState)(""),F=(0,i.A)(O,2),T=F[0],_=F[1],B=(0,r.useState)(""),R=(0,i.A)(B,2),U=R[0],$=R[1],H=(0,r.useState)(""),V=(0,i.A)(H,2),K=V[0],Q=V[1],G=(0,r.useState)(""),q=(0,i.A)(G,2),Z=q[0],X=q[1],J=(0,r.useState)(!1),ee=(0,i.A)(J,2),te=ee[0],ne=ee[1],re=function(){var e=(0,a.A)(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.gP)(m.register(C,S,U,T,null===(e=m.state)||void 0===e?void 0:e.invitationId,Z));case 3:I(""),b(""),D(""),$(""),_(""),t.next=14;break;case 10:t.prev=10,t.t0=t.catch(0),Q("auth.error.invitationotp"),Y.error(new d.p$("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)}}(),oe=null===(n=m.state)||void 0===n?void 0:n.useOtp,ae=function validPassword(){return oe?null!=Z&&""!==Z&&S==P&&""!=S&&null!=S&&te:S==P&&""!=S&&null!=S&&te},ie=null===(s=m.state)||void 0===s?void 0:s.loginMethods;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("h1",{children:A("auth.title.register")}),(0,f.jsx)("p",{children:A("auth.text.register","")}),!!K&&(0,f.jsxs)("div",{className:c.z3,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:A(K)})]}),(0,f.jsx)(OpenId,{}),((null==ie?void 0:ie.generic)||(null==ie?void 0:ie.google)||(null==ie?void 0:ie.microsoft))&&ie.standard&&(0,f.jsx)("div",{className:c.me,children:"or"}),(null==ie?void 0:ie.standard)&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("form",{children:[oe&&(0,f.jsx)(v.A,{type:"text",value:Z,placeholder:A("auth.input.otp"),onChange:function onChange(e){return X(e.target.value)}}),(0,f.jsx)(v.A,{value:U,autoFocus:!0,placeholder:A("backoffice.form.userdetails.items.name"),onChange:function onChange(e){return $(e.target.value)}}),(0,f.jsx)(v.A,{value:T,autoFocus:!0,placeholder:A("backoffice.form.userdetails.items.familyName"),onChange:function onChange(e){return _(e.target.value)}}),(0,f.jsx)(v.A,{value:C,autoComplete:"email",autoFocus:!0,placeholder:A("auth.input.email"),disabled:!0}),(0,f.jsx)(v.A,{value:S,type:"password",autoFocus:!0,placeholder:A("auth.input.password"),onChange:function onChange(e){return b(e.target.value)}}),(0,f.jsx)(v.A,{value:P,type:"password",autoFocus:!0,placeholder:A("auth.input.repeatpassword"),onChange:function onChange(e){return D(e.target.value)}}),(0,f.jsxs)("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[(0,f.jsx)(W,{name:"checkAGB",checked:te,onClick:function onClick(){return ne(!te)}}),(0,f.jsxs)("div",{style:{display:"flex",flexDirection:"column",fontSize:9},children:[(0,f.jsx)("span",{children:A("auth.acceptprivacyandagb")}),(0,f.jsxs)("span",{children:[(0,f.jsx)("a",{target:"_blank",href:null!==(u=j.navigation.tosUrl)&&void 0!==u?u:"https://www.diva-portal.de/agb",children:A("auth.GeneralTerms")}),", ",(0,f.jsx)("a",{target:"_blank",href:null!==(x=j.navigation.privacyUrl)&&void 0!==x?x:"https://www.diva-portal.de/datenschutz",children:A("auth.privacypolicy")})]})]})]}),(0,f.jsx)(M.A,{style:{color:"#FF8C00",marginTop:10,fontSize:14},hidden:ae(),children:A("auth.input.passwordsnotmatch")})]}),(0,f.jsx)(p.A,{disabled:!ae(),onClick:ae()?re:void 0,children:A("auth.input.login")})]})]})}));var q=(0,u.PA)((function(){var e,t=(0,o.IB)().authorizationStore;switch(null===(e=t.state)||void 0===e?void 0:e.type){case"LOGIN":return(0,f.jsx)(A,{});case"REQUEST_NEW_PASSWORD":return(0,f.jsx)(RequestNewPassword,{initEmail:t.state.email});case"CHANGE_PASSWORD":return(0,f.jsx)(ChangePassword,{token:t.state.token});case"WELCOME":return(0,f.jsx)(WelcomeScreen,{isNewUser:t.state.isNewUser,invitationId:t.state.invitationId,invitationOrgId:t.state.invitationOrgId});case"REGISTER":return(0,f.jsx)(G,{});case"INVITATION_EXPIRED":return(0,f.jsx)("h1",{children:"Abgelaufen"});default:return(0,f.jsx)(f.Fragment,{})}}));const Z=(0,u.PA)((function Auth(){var e,t,n,a=(0,o.IB)(),i=a.authorizationStore,s=a.configurationStore,l=a.dataStore,u=(a.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=s.navigation)&&void 0!==t&&t.logoUrl){var o;r=null===(o=s.navigation)||void 0===o?void 0:o.logoUrl}return r}),[null===(e=s.navigation)||void 0===e?void 0:e.logoUrl,null===(t=l.organization)||void 0===t?void 0:t.logoUrl]));return null==i.state?(0,f.jsx)(f.Fragment,{}):(0,f.jsxs)("div",{className:c.j2,children:[(0,f.jsxs)("div",{className:c.TG,children:[(0,f.jsx)("div",{className:c.r$,style:{height:null!==(n=s.configuration.loginLogoHeight)&&void 0!==n?n:50,backgroundImage:"url(".concat(u,")")}}),(0,f.jsx)(q,{})]}),s.authentication.contentBox&&(0,f.jsx)("div",{style:{width:"calc(100% - 400px)",height:"100%",position:"relative",overflow:"hidden"},children:(0,f.jsx)(C.s,{settings:{contentBoxProps:(0,h.HO)(s.authentication.contentBox.props)}})})]})}))}}]);