@crystaldesign/diva-core 25.11.0-beta.27 → 25.11.0-beta.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/esm/{ModalsWrapper-1481cbaa.js → ModalsWrapper-b93ad012.js} +1 -1
- package/build/esm/{index-7411da7c.js → index-2e750e7b.js} +9 -3
- package/build/esm/{index-bb2043f5.js → index-85a64419.js} +4 -4
- package/build/esm/index.js +1 -1
- package/build/types/core/src/elements/Auth/OpenId/index.d.ts +3 -1
- package/build/types/core/src/elements/Auth/OpenId/index.d.ts.map +1 -1
- package/build/umd/171.diva-core.umd.min.js +1 -1
- package/build/umd/diva-core.umd.min.js +1 -1
- package/build/umd/report.html +1 -1
- package/package.json +10 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as styleInject, u as useDivaCoreContext } from './index-
|
|
1
|
+
import { i as styleInject, u as useDivaCoreContext } from './index-85a64419.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, A as AuthButton, s as socialButton, g as google, m as microsoft, t as titlecontainer, e as error, a as getLogger, b as separator, I as Input, l as link, c as success, d as auth, f as loginBox, h as logoContainer } from './index-
|
|
1
|
+
import { u as useDivaCoreContext, A as AuthButton, s as socialButton, g as google, m as microsoft, t as titlecontainer, e as error, a as getLogger, b as separator, I as Input, l as link, c as success, d as auth, f as loginBox, h as logoContainer } from './index-85a64419.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';
|
|
@@ -51,8 +51,9 @@ import '@mui/icons-material/HelpOutline';
|
|
|
51
51
|
import '@storybook/addon-actions';
|
|
52
52
|
import '@mui/styles';
|
|
53
53
|
|
|
54
|
-
function OpenId () {
|
|
54
|
+
function OpenId (_ref) {
|
|
55
55
|
var _authorizationStore$s, _loginMethods$generic, _loginMethods$generic2;
|
|
56
|
+
var disabled = _ref.disabled;
|
|
56
57
|
var _useDivaCoreContext = useDivaCoreContext(),
|
|
57
58
|
configurationStore = _useDivaCoreContext.configurationStore,
|
|
58
59
|
authorizationStore = _useDivaCoreContext.authorizationStore;
|
|
@@ -61,6 +62,7 @@ function OpenId () {
|
|
|
61
62
|
var loginMethods = (_authorizationStore$s = authorizationStore.state) === null || _authorizationStore$s === void 0 ? void 0 : _authorizationStore$s.loginMethods;
|
|
62
63
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
63
64
|
children: [(loginMethods === null || loginMethods === void 0 ? void 0 : loginMethods.google) && /*#__PURE__*/jsxs(AuthButton, {
|
|
65
|
+
disabled: disabled,
|
|
64
66
|
className: classnames(socialButton, google),
|
|
65
67
|
onClick: function onClick() {
|
|
66
68
|
var _authorizationStore$s2;
|
|
@@ -68,6 +70,7 @@ function OpenId () {
|
|
|
68
70
|
},
|
|
69
71
|
children: [/*#__PURE__*/jsx("div", {}), t('auth.login.google')]
|
|
70
72
|
}), (loginMethods === null || loginMethods === void 0 ? void 0 : loginMethods.microsoft) && /*#__PURE__*/jsxs(AuthButton, {
|
|
73
|
+
disabled: disabled,
|
|
71
74
|
className: classnames(socialButton, microsoft),
|
|
72
75
|
onClick: function onClick() {
|
|
73
76
|
var _authorizationStore$s3;
|
|
@@ -75,6 +78,7 @@ function OpenId () {
|
|
|
75
78
|
},
|
|
76
79
|
children: [/*#__PURE__*/jsx("div", {}), t('auth.login.microsoft')]
|
|
77
80
|
}), (loginMethods === null || loginMethods === void 0 ? void 0 : loginMethods.generic) && /*#__PURE__*/jsxs(AuthButton, {
|
|
81
|
+
disabled: disabled,
|
|
78
82
|
className: socialButton,
|
|
79
83
|
style: {
|
|
80
84
|
backgroundColor: (_loginMethods$generic = loginMethods.generic.backgroundColor) !== null && _loginMethods$generic !== void 0 ? _loginMethods$generic : configurationStore.theme.palette.secondary.main,
|
|
@@ -854,7 +858,9 @@ function Register() {
|
|
|
854
858
|
title: t('auth.title.register'),
|
|
855
859
|
text: t('auth.text.register', ''),
|
|
856
860
|
errorText: errorText !== null && errorText !== void 0 ? errorText : ''
|
|
857
|
-
}), /*#__PURE__*/jsx(OpenId, {
|
|
861
|
+
}), /*#__PURE__*/jsx(OpenId, {
|
|
862
|
+
disabled: !agbAccepted
|
|
863
|
+
}), ((loginMethods === null || loginMethods === void 0 ? void 0 : loginMethods.generic) || (loginMethods === null || loginMethods === void 0 ? void 0 : loginMethods.google) || (loginMethods === null || loginMethods === void 0 ? void 0 : loginMethods.microsoft)) && loginMethods.standard && /*#__PURE__*/jsx("div", {
|
|
858
864
|
className: separator,
|
|
859
865
|
children: "or"
|
|
860
866
|
}), (loginMethods === null || loginMethods === void 0 ? void 0 : loginMethods.standard) && /*#__PURE__*/jsxs(Fragment, {
|
|
@@ -48,7 +48,7 @@ import { actions } from '@storybook/addon-actions';
|
|
|
48
48
|
import * as Styles from '@mui/styles';
|
|
49
49
|
|
|
50
50
|
(function() {
|
|
51
|
-
const env = {"STAGE":"production","VERSION":"25.11.0-beta.
|
|
51
|
+
const env = {"STAGE":"production","VERSION":"25.11.0-beta.29"};
|
|
52
52
|
try {
|
|
53
53
|
if (process) {
|
|
54
54
|
process.env = Object.assign({}, process.env);
|
|
@@ -9738,7 +9738,7 @@ var DrawerMenu = observer(MobileDrawer);
|
|
|
9738
9738
|
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; }
|
|
9739
9739
|
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; }
|
|
9740
9740
|
var LazyModals$1 = /*#__PURE__*/React.lazy(function () {
|
|
9741
|
-
return import('./ModalsWrapper-
|
|
9741
|
+
return import('./ModalsWrapper-b93ad012.js');
|
|
9742
9742
|
});
|
|
9743
9743
|
function Fullscreen(_ref) {
|
|
9744
9744
|
var inAbsoluteFullscreen = _ref.inAbsoluteFullscreen;
|
|
@@ -10196,10 +10196,10 @@ function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymb
|
|
|
10196
10196
|
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; }
|
|
10197
10197
|
var LOG$2 = getLogger('Framework', 'Root');
|
|
10198
10198
|
var LazyAuth = /*#__PURE__*/React.lazy(function () {
|
|
10199
|
-
return import('./index-
|
|
10199
|
+
return import('./index-2e750e7b.js');
|
|
10200
10200
|
});
|
|
10201
10201
|
var LazyModals = /*#__PURE__*/React.lazy(function () {
|
|
10202
|
-
return import('./ModalsWrapper-
|
|
10202
|
+
return import('./ModalsWrapper-b93ad012.js');
|
|
10203
10203
|
});
|
|
10204
10204
|
function ContentComponent() {
|
|
10205
10205
|
var context = useDivaCoreContext();
|
package/build/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { n as AnalyticsHandler, k as AuthorizationHandler, p as ClientArticleHandler, C as Content, q as DivaMockProvider, H as HelpButton, O as ONE_DAY_UNIX, o as OrganizationHandler, P as ProductHandler, R as RequestStatus, S as SupportHandler, D as default, a as getLogger, r as storyBookCoreMock, j as useDivaCore } from './index-
|
|
1
|
+
export { n as AnalyticsHandler, k as AuthorizationHandler, p as ClientArticleHandler, C as Content, q as DivaMockProvider, H as HelpButton, O as ONE_DAY_UNIX, o as OrganizationHandler, P as ProductHandler, R as RequestStatus, S as SupportHandler, D as default, a as getLogger, r as storyBookCoreMock, j as useDivaCore } from './index-85a64419.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/OpenId/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,MAAM,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/elements/Auth/OpenId/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,MAAM,CAAC,OAAO,WAAW,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,qBA6D5D"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see 171.diva-core.umd.min.js.LICENSE.txt */
|
|
2
|
-
"use strict";(self.webpackChunkCrystaldesignDivaCore=self.webpackChunkCrystaldesignDivaCore||[]).push([[171],{8171:(e,t,n)=>{n.r(t),n.d(t,{default:()=>b});var r=n(7363),a=n(6245),o=n(4658),i=n(4988),s=n(747),l=n.n(s),u=n(523),c=n(9420),d=n(599),h=n(8623),v=n(3528),g=n(7995),p=n(789),w=n(5515),x=n.n(w),f=n(7514);function OpenId(){var e,t,n,r=(0,a.KH)(),o=r.configurationStore,i=r.authorizationStore,s=(0,p.$G)().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)(g.Z,{className:x()(u.FI,u.lk),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)(g.Z,{className:x()(u.FI,u.Eg),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)(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 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,")"),filter:"brightness(0) invert(1)"}:{}}),s("auth.login.generic")]})]})}var j=n(4680),m=n(3830),y=n(6033),M=n(4350);function Header(e){var t=e.title,n=e.text,r=e.errorText,a=(0,M.useTranslation)().t;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("div",{className:u.C4,children:(0,f.jsx)("h2",{children:t})}),(0,f.jsx)("p",{children:n}),r&&(0,f.jsx)(y.Z,{severity:"error",className:u.vU,children:a(r)})]})}var k=(0,j.jl)("Framework","Login");const C=(0,c.Pi)((function Login(){var e,t,n,s,c=(0,a.KH)(),w=c.authorizationStore,x=c.authorizationHandler,j=(0,r.useState)("enter"),y=(0,i.Z)(j,2),M=y[0],C=y[1],L=(0,r.useState)(!1),N=(0,i.Z)(L,2),S=N[0],Z=N[1],I=(0,r.useState)(null!==(e=null===(t=w.state)||void 0===t?void 0:t.email)&&void 0!==e?e:""),E=(0,i.Z)(I,2),D=E[0],z=E[1],b=(0,r.useState)(""),T=(0,i.Z)(b,2),P=T[0],A=T[1],O=(0,r.useState)(""),_=(0,i.Z)(O,2),F=_[0],R=_[1],U=(0,r.useState)(!1),G=(0,i.Z)(U,2),H=G[0],K=G[1],$=(0,r.useState)(w.state.invitationId),Q=(0,i.Z)($,2),V=Q[0],W=Q[1],Y=(0,r.useState)("LOGIN"==(null===(n=w.state)||void 0===n?void 0:n.type)?w.state.error:void 0),B=(0,i.Z)(Y,2),q=B[0],J=B[1],X=(0,p.$G)().t,ee=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(Z(!0),q&&J(void 0),n.prev=2,V){n.next=8;break}return n.next=6,x.getInvitationValue("id",D);case 6:(e=n.sent)&&(e.isNewUser&&(w.close(),w.showRegister(void 0,D,!!e.useotp)),W(!0),e.useotp&&K(!0));case 8:return n.next=10,x.fetchLoginProvider({email:D});case 10:"standard"==(t=n.sent).provider?C("login"):w.openOAuthLogin(t.provider,w.state.organizationId,w.state.invitationId),n.next=18;break;case 14:n.prev=14,n.t0=n.catch(2),k.error(new d.GE("Error while fetching login provider",{cause:n.t0})),J("auth.error.password");case 18:return n.prev=18,Z(!1),n.finish(18);case 21:case"end":return n.stop()}}),_callee,null,[[2,14,18,21]])})));return function onContinue(){return e.apply(this,arguments)}}(),te=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 Z(!0),q&&J(void 0),e.prev=2,e.next=5,(0,h.fl)(w.login(D,P,!1,w.state.organizationId,w.state.invitationId,F));case 5:z(""),A(""),J(void 0),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(2),k.error(new d.GE("Error while logging in",{cause:e.t0})),J(V?"auth.error.passwordotp":"auth.error.password");case 14:return e.prev=14,Z(!1),e.finish(14);case 17:case"end":return e.stop()}}),_callee2,null,[[2,10,14,17]])})));return function onLogin(){return e.apply(this,arguments)}}(),ne=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(D);case 1:case"end":return e.stop()}}),_callee3)})));return function resetPassword(){return e.apply(this,arguments)}}(),re="enter"==M&&0==D.length||"enter"!=M&&0==P.length;H&&!re&&(re=0==F.length);var ae=null===(s=w.state)||void 0===s?void 0:s.loginMethods;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Header,{title:X("auth.title.login"),text:X("auth.text.login",""),errorText:null!=q?q:""}),(0,f.jsx)(OpenId,{}),((null==ae?void 0:ae.generic)||(null==ae?void 0:ae.google)||(null==ae?void 0:ae.microsoft))&&ae.standard&&(0,f.jsx)("div",{className:u.kr,children:"or"}),(null==ae?void 0:ae.standard)&&(0,f.jsxs)(f.Fragment,{children:["enter"==M&&(0,f.jsxs)("form",{children:[(0,f.jsx)(v.Z,{id:"username",value:D,autoComplete:"username",autoFocus:!0,type:"email",placeholder:X("auth.input.email"),onChange:function onChange(e){return z(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&ee()}}),(0,f.jsx)(v.Z,{value:P,id:"password",type:"password",autoComplete:"current-password",hidden:!0,autoFocus:!0,placeholder:X("auth.input.password"),onChange:function onChange(e){return A(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&te()}})]}),"login"==M&&(0,f.jsxs)("form",{children:[H&&(0,f.jsx)(v.Z,{value:F,type:"text",autoFocus:!0,placeholder:X("auth.input.otp"),onChange:function onChange(e){return R(e.target.value)}}),(0,f.jsx)(v.Z,{value:D,type:"email",readOnly:!0,placeholder:X("auth.input.email"),resetInput:function reset(){C("enter"),z(""),A(""),J(void 0)}}),(0,f.jsx)(v.Z,{value:P,type:"password",id:"password",autoFocus:!0,placeholder:X("auth.input.password"),onChange:function onChange(e){return A(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&te()}})]}),(0,f.jsxs)(g.Z,{id:"submit",disabled:re||S,onClick:"enter"==M?ee:te,children:[S?(0,f.jsx)(m.Z,{size:24,color:"inherit"}):void 0,S?void 0:X("enter"==M?"auth.button.continue":"auth.button.login")]}),"login"==M&&(0,f.jsx)("div",{style:{textAlign:"center"},children:(0,f.jsx)("div",{className:u.p4,onClick:ne,children:X("auth.button.forgotpassword")})})," "]})]})}));var L=(0,j.jl)("Framework","RequestNewPassword");function RequestNewPassword(e){var t=e.initEmail,n=(0,a.KH)(),s=n.authorizationStore,c=n.apiHandler,h=n.loadingAndErrorStore,w=(0,r.useState)(t),x=(0,i.Z)(w,2),j=x[0],m=x[1],y=(0,r.useState)(!1),M=(0,i.Z)(y,2),k=M[0],C=M[1],N=(0,r.useState)(),S=(0,i.Z)(N,2),Z=S[0],I=S[1],E=(0,r.useState)(),D=(0,i.Z)(E,2),z=D[0],b=D[1],T=(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:j});case 5:b(!1),h.toggleLoading("SendPassword"),C(!0),I(void 0),e.next=17;break;case 11:e.prev=11,e.t0=e.catch(0),L.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)}}(),A=function toLogin(){s.close(),s.showLogin()};return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Header,{title:T("auth.title.resetpassword"),text:T("auth.info.resetdescription",""),errorText:null!=Z?Z:""}),k&&(0,f.jsxs)("div",{className:u.Vp,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:T("auth.info.resetpassword")})]}),!k&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(v.Z,{value:j,autoFocus:!0,placeholder:T("auth.input.email"),onChange:function onChange(e){return m(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&P()},resetInput:A}),(0,f.jsx)(g.Z,{disabled:0==j.length,onClick:P,children:T("auth.button.resetpassword")})]}),k&&(0,f.jsx)(g.Z,{disabled:z,onClick:A,children:T("auth.button.login")})]})}function Errormessage(e){var t=e.hasError,n=e.authErrorsg,r=(0,p.$G)().t;return(0,f.jsxs)("div",{className:u.vU,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 N=(0,j.jl)("Framework","cfhange-password");function ChangePassword(e){var t,n=e.token,s=(0,a.KH)(),c=s.configurationStore,h=s.authorizationStore,w=s.apiHandler,x=(s.loadingAndErrorStore,(0,r.useState)("")),j=(0,i.Z)(x,2),m=j[0],y=j[1],M=(0,r.useState)(""),k=(0,i.Z)(M,2),C=k[0],L=k[1],S=(0,r.useState)(!1),Z=(0,i.Z)(S,2),I=Z[0],E=Z[1],D=(0,r.useState)(),z=(0,i.Z)(D,2),b=z[0],T=z[1],P=(0,r.useState)(""),A=(0,i.Z)(P,2),O=A[0],_=A[1],F=(0,r.useRef)(null),R=(0,p.$G)().t;(0,r.useEffect)((function(){m===C&&T(void 0)}),[m,C]);var U=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(_(R("auth.error.verifypasswordserver")),!(m.length<8||m!==C)){e.next=4;break}return T("INVALID"),e.abrupt("return");case 4:return e.prev=4,e.next=7,w.resetPassword({password:m,token:n});case 7:E(!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)_(R("auth.error.verifypasswordtokenerror",{errormsg:R("auth.error.tokenexpired")}));else _(R("auth.error.verifypasswordserver",e.message));N.error(e)}N.error(new d.GE("Error while resetting password",{cause:e})),T("SERVER")};return"SERVER"===b?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Errormessage,{hasError:b,authErrorsg:O}),(0,f.jsx)(g.Z,{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:u.Vp,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:R("auth.info.verifypassword")})]}),(null===(t=c.authentication.resetPassword)||void 0===t?void 0:t.returnToLogin)&&(0,f.jsx)(g.Z,{onClick:function goToLogin(){h.close(),h.showLogin()},children:R("auth.button.login")})]}),!I&&(0,f.jsxs)(f.Fragment,{children:[b&&(0,f.jsx)(Errormessage,{hasError:b,authErrorsg:O}),(0,f.jsxs)("form",{children:[(0,f.jsx)(v.Z,{value:m,autoFocus:!0,placeholder:R("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,f.jsx)(v.Z,{ref:F,value:C,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)(g.Z,{disabled:!m||!C,onClick:U,children:R("auth.button.save")})]})]})}var S=n(4691);function WelcomeScreen(e){var t=e.isNewUser,n=e.invitationId,s=e.invitationOrgId,u=(0,a.KH)(),c=u.authorizationStore,d=u.authorizationHandler,h=(0,r.useState)(""),v=(0,i.Z)(h,2),w=v[0],x=v[1],j=(0,p.$G)().t,m=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)&&(c.close(),c.showLogin(void 0,void 0,s,n,e));case 4:case"end":return t.stop()}}),_callee)})));return function toLogin(){return e.apply(this,arguments)}}(),y=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)&&(c.close(),c.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=c.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 x("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)(Header,{title:j("auth.title.welcome"),text:j("auth.info.welcomedescription",""),errorText:null!=w?w:""}),t&&!w&&(0,f.jsx)(g.Z,{onClick:y,children:j("auth.title.register")}),!t&&!w&&(0,f.jsx)(g.Z,{onClick:m,children:j("auth.button.login")})]})}var Z=n(3714),I=(0,j.jl)("Framework","Register");const E=(0,c.Pi)((function Register(){var e,t,n,s,c,w,x=(0,a.KH)(),j=x.authorizationStore,M=x.configurationStore,k=(0,p.$G)().t,C=(0,r.useState)(null!==(e=null===(t=j.state)||void 0===t?void 0:t.email)&&void 0!==e?e:""),L=(0,i.Z)(C,2),N=L[0],S=L[1],E=(0,r.useState)(""),D=(0,i.Z)(E,2),z=D[0],b=D[1],T=(0,r.useState)(""),P=(0,i.Z)(T,2),A=P[0],O=P[1],_=(0,r.useState)(""),F=(0,i.Z)(_,2),R=F[0],U=F[1],G=(0,r.useState)(""),H=(0,i.Z)(G,2),K=H[0],$=H[1],Q=(0,r.useState)(""),V=(0,i.Z)(Q,2),W=V[0],Y=V[1],B=(0,r.useState)(""),q=(0,i.Z)(B,2),J=q[0],X=q[1],ee=(0,r.useState)(!1),te=(0,i.Z)(ee,2),ne=te[0],re=te[1],ae=(0,r.useState)(!1),oe=(0,i.Z)(ae,2),ie=oe[0],se=oe[1],le=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,re(!0),t.next=4,(0,h.fl)(j.register(N,z,K,R,null===(e=j.state)||void 0===e?void 0:e.invitationId,ue?J:void 0));case 4:S(""),b(""),O(""),$(""),U(""),t.next=15;break;case 11:t.prev=11,t.t0=t.catch(0),Y("auth.error.invitationotp"),I.error(new d.GE("Error while registering",{cause:t.t0}));case 15:return t.prev=15,re(!1),t.finish(15);case 18:case"end":return t.stop()}}),_callee,null,[[0,11,15,18]])})));return function onRegister(){return e.apply(this,arguments)}}(),ue=null===(n=j.state)||void 0===n?void 0:n.useOtp,ce=function validPassword(){return ue?null!=J&&""!==J&&z==A&&""!=z&&null!=z&&ie:z==A&&""!=z&&null!=z&&ie},de=null===(s=j.state)||void 0===s?void 0:s.loginMethods;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Header,{title:k("auth.title.register"),text:k("auth.text.register",""),errorText:null!=W?W:""}),(0,f.jsx)(OpenId,{}),((null==de?void 0:de.generic)||(null==de?void 0:de.google)||(null==de?void 0:de.microsoft))&&de.standard&&(0,f.jsx)("div",{className:u.kr,children:"or"}),(null==de?void 0:de.standard)&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("form",{children:[ue&&(0,f.jsx)(v.Z,{type:"text",value:J,placeholder:k("auth.input.otp"),onChange:function onChange(e){return X(e.target.value)}}),(0,f.jsx)(v.Z,{value:K,autoFocus:!0,placeholder:k("backoffice.form.userdetails.items.name"),onChange:function onChange(e){return $(e.target.value)}}),(0,f.jsx)(v.Z,{value:R,autoFocus:!0,placeholder:k("backoffice.form.userdetails.items.familyName"),onChange:function onChange(e){return U(e.target.value)}}),(0,f.jsx)(v.Z,{value:N,autoComplete:"email",autoFocus:!0,placeholder:k("auth.input.email"),disabled:!0}),(0,f.jsx)(v.Z,{value:z,type:"password",autoFocus:!0,placeholder:k("auth.input.newpassword"),onChange:function onChange(e){return b(e.target.value)}}),(0,f.jsx)(v.Z,{value:A,type:"password",autoFocus:!0,placeholder:k("auth.input.repeatpassword"),onChange:function onChange(e){return O(e.target.value)}}),(0,f.jsxs)("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[(0,f.jsx)(Z.Z,{name:"checkAGB",checked:ie,onClick:function onClick(){return se(!ie)}}),(0,f.jsxs)("div",{style:{display:"flex",flexDirection:"column",fontSize:9},children:[(0,f.jsx)("span",{children:k("auth.acceptprivacyandagb")}),(0,f.jsxs)("span",{children:[(0,f.jsx)("a",{target:"_blank",href:null!==(c=M.navigation.tosUrl)&&void 0!==c?c:"https://www.diva-portal.de/agb",children:k("auth.GeneralTerms")}),", ",(0,f.jsx)("a",{target:"_blank",href:null!==(w=M.navigation.privacyUrl)&&void 0!==w?w:"https://www.diva-portal.de/datenschutz",children:k("auth.privacypolicy")})]})]})]}),(0,f.jsx)(y.Z,{severity:"warning",sx:{display:ce()?"none":"flex"},children:k("auth.input.passwordsnotmatch")})]}),(0,f.jsxs)(g.Z,{disabled:!ce()||ne,onClick:ce()?le:void 0,children:[ne?(0,f.jsx)(m.Z,{size:24,color:"inherit"}):void 0,ne?void 0:k("auth.input.login")]})]})]})}));var D=n(4376);var z=(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,f.jsx)(C,{});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)(E,{});case"INVITATION_EXPIRED":return(0,f.jsx)("h1",{children:"Abgelaufen"});default:return(0,f.jsx)(f.Fragment,{})}}));const b=(0,c.Pi)((function Auth(){var e,t,n,o,i=(0,a.KH)(),s=i.authorizationStore,l=i.configurationStore,c=i.dataStore,d=i.contentStore,v=(0,r.useMemo)((function(){var e,t,n,r="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciICB2aWV3Qm94PSIwIDAgMTAwMCAyOTMuNjUiPjxwYXRoIGQ9Ik0yNTAuODksMTQ3LjNjLTMuMTgtNzQtMzAuNC0xNDMuMTgtMTQxLjczLTE0My4xOEwwLDQuMjZBMzA3Ljg2LDMwNy44NiwwLDAsMSwyNi4xMiw2MC43aDc0LjJjNTIuODYsMCw3NiwyNS42OCw3OC42MSw4NS4yOSwyLjY2LDYxLjgxLTE4LjI5LDg3LjkyLTcxLjE1LDg3LjkySDc5LjJsLTQ2LjcxLjUyYTI4Ny4yOSwyODcuMjksMCwwLDEtMjAsNTMuODhoMTA5YzExMS4zMiwwLDEzMi42Ny02NywxMjkuNDgtMTQxTTMwNi44NCwyODloNzEuMjNWMGEzMDAuMDcsMzAwLjA3LDAsMCwxLTcxLjIzLDI1LjkyWm0zMTguOC42Mkw3MjYuNTkuODVhMzAwLDMwMCwwLDAsMS04My42NSwzMi4yNEw1NzcuMTEsMjI0LDUxMS4yOSwzMy4wOUEzMDAsMzAwLDAsMCwxLDQyNy42NC44NWwxMDEsMjg4Ljc2Wm0zNzQuMzYsNEw4OTkuMDUsNC45MUg4MDJMNzc1LjE0LDgxLjc0LDcwMS4wNSwyOTMuNjVBMzAwLjMyLDMwMC4zMiwwLDAsMSw3ODUsMjYxLjM1bDYuNzktMjEsMTkuMTQtNTcuNTRMODUwLjUyLDYybDQwLjA3LDEyMC44NSwxOC43LDU3LjU0LDcsMjFBMzAwLjIsMzAwLjIsMCwwLDEsMTAwMCwyOTMuNjUiIGZpbGw9IiNiM2IzYjMiLz48L3N2Zz4=";if(null!==(e=c.organization)&&void 0!==e&&e.logoUrl)r=null===(n=c.organization)||void 0===n?void 0:n.logoUrl;else if(null!==(t=l.navigation)&&void 0!==t&&t.logoUrl){var a;r=null===(a=l.navigation)||void 0===a?void 0:a.logoUrl}return r}),[null===(e=l.navigation)||void 0===e?void 0:e.logoUrl,null===(t=c.organization)||void 0===t?void 0:t.logoUrl]);return null==s.state?(0,f.jsx)(f.Fragment,{}):(0,f.jsxs)("div",{className:u.I8,children:[(null==l||null===(n=l.navigation)||void 0===n?void 0:n.showSnow)&&(0,f.jsx)(D.Z,{color:"#a7b6eb",speed:[0,2.5],wind:[-1,.5],snowflakeCount:300,radius:[.5,2],style:{zIndex:1e3}}),(0,f.jsxs)("div",{className:u.NB,children:[(!d.containerDimensions.isMobile||d.containerDimensions.isPortrait)&&(0,f.jsx)("div",{className:u.tn,style:{height:null!==(o=l.configuration.loginLogoHeight)&&void 0!==o?o:50,backgroundImage:"url(".concat(v,")")}}),(0,f.jsx)(z,{})]}),l.authentication.contentBox&&!d.containerDimensions.isMobile&&(0,f.jsx)("div",{style:{width:"calc(100% - 400px)",height:"100%",position:"relative",overflow:"hidden"},children:(0,f.jsx)(S.p,{settings:{contentBoxProps:(0,h.ZN)(l.authentication.contentBox.props)}})})]})}))}}]);
|
|
2
|
+
"use strict";(self.webpackChunkCrystaldesignDivaCore=self.webpackChunkCrystaldesignDivaCore||[]).push([[171],{8171:(e,t,n)=>{n.r(t),n.d(t,{default:()=>z});var r=n(7363),a=n(6245),o=n(4658),i=n(4988),s=n(747),l=n.n(s),u=n(523),c=n(9420),d=n(599),h=n(8623),v=n(3528),g=n(7995),p=n(789),w=n(5515),x=n.n(w),f=n(7514);function OpenId(e){var t,n,r,o=e.disabled,i=(0,a.KH)(),s=i.configurationStore,l=i.authorizationStore,c=(0,p.$G)().t,d=null===(t=l.state)||void 0===t?void 0:t.loginMethods;return(0,f.jsxs)(f.Fragment,{children:[(null==d?void 0:d.google)&&(0,f.jsxs)(g.Z,{disabled:o,className:x()(u.FI,u.lk),onClick:function onClick(){var e;return l.openOAuthLogin("google",l.state.organizationId,null===(e=l.state)||void 0===e?void 0:e.invitationId)},children:[(0,f.jsx)("div",{}),c("auth.login.google")]}),(null==d?void 0:d.microsoft)&&(0,f.jsxs)(g.Z,{disabled:o,className:x()(u.FI,u.Eg),onClick:function onClick(){var e;return l.openOAuthLogin("microsoft",l.state.organizationId,null===(e=l.state)||void 0===e?void 0:e.invitationId)},children:[(0,f.jsx)("div",{}),c("auth.login.microsoft")]}),(null==d?void 0:d.generic)&&(0,f.jsxs)(g.Z,{disabled:o,className:u.FI,style:{backgroundColor:null!==(n=d.generic.backgroundColor)&&void 0!==n?n:s.theme.palette.secondary.main,color:null!==(r=d.generic.color)&&void 0!==r?r:s.theme.palette.secondary.contrastText},onClick:function onClick(){var e;return l.openOAuthLogin("genericOpenId",l.state.organizationId,null===(e=l.state)||void 0===e?void 0:e.invitationId)},children:[(0,f.jsx)("div",{style:d.generic.logo?{backgroundImage:"url(".concat(d.generic.logo,")"),filter:"brightness(0) invert(1)"}:{}}),c("auth.login.generic")]})]})}var j=n(4680),m=n(3830),y=n(6033),M=n(4350);function Header(e){var t=e.title,n=e.text,r=e.errorText,a=(0,M.useTranslation)().t;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("div",{className:u.C4,children:(0,f.jsx)("h2",{children:t})}),(0,f.jsx)("p",{children:n}),r&&(0,f.jsx)(y.Z,{severity:"error",className:u.vU,children:a(r)})]})}var k=(0,j.jl)("Framework","Login");const C=(0,c.Pi)((function Login(){var e,t,n,s,c=(0,a.KH)(),w=c.authorizationStore,x=c.authorizationHandler,j=(0,r.useState)("enter"),y=(0,i.Z)(j,2),M=y[0],C=y[1],L=(0,r.useState)(!1),N=(0,i.Z)(L,2),S=N[0],Z=N[1],I=(0,r.useState)(null!==(e=null===(t=w.state)||void 0===t?void 0:t.email)&&void 0!==e?e:""),E=(0,i.Z)(I,2),D=E[0],b=E[1],z=(0,r.useState)(""),T=(0,i.Z)(z,2),P=T[0],A=T[1],O=(0,r.useState)(""),_=(0,i.Z)(O,2),F=_[0],R=_[1],U=(0,r.useState)(!1),G=(0,i.Z)(U,2),H=G[0],K=G[1],$=(0,r.useState)(w.state.invitationId),Q=(0,i.Z)($,2),V=Q[0],W=Q[1],Y=(0,r.useState)("LOGIN"==(null===(n=w.state)||void 0===n?void 0:n.type)?w.state.error:void 0),B=(0,i.Z)(Y,2),q=B[0],J=B[1],X=(0,p.$G)().t,ee=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(Z(!0),q&&J(void 0),n.prev=2,V){n.next=8;break}return n.next=6,x.getInvitationValue("id",D);case 6:(e=n.sent)&&(e.isNewUser&&(w.close(),w.showRegister(void 0,D,!!e.useotp)),W(!0),e.useotp&&K(!0));case 8:return n.next=10,x.fetchLoginProvider({email:D});case 10:"standard"==(t=n.sent).provider?C("login"):w.openOAuthLogin(t.provider,w.state.organizationId,w.state.invitationId),n.next=18;break;case 14:n.prev=14,n.t0=n.catch(2),k.error(new d.GE("Error while fetching login provider",{cause:n.t0})),J("auth.error.password");case 18:return n.prev=18,Z(!1),n.finish(18);case 21:case"end":return n.stop()}}),_callee,null,[[2,14,18,21]])})));return function onContinue(){return e.apply(this,arguments)}}(),te=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 Z(!0),q&&J(void 0),e.prev=2,e.next=5,(0,h.fl)(w.login(D,P,!1,w.state.organizationId,w.state.invitationId,F));case 5:b(""),A(""),J(void 0),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(2),k.error(new d.GE("Error while logging in",{cause:e.t0})),J(V?"auth.error.passwordotp":"auth.error.password");case 14:return e.prev=14,Z(!1),e.finish(14);case 17:case"end":return e.stop()}}),_callee2,null,[[2,10,14,17]])})));return function onLogin(){return e.apply(this,arguments)}}(),ne=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(D);case 1:case"end":return e.stop()}}),_callee3)})));return function resetPassword(){return e.apply(this,arguments)}}(),re="enter"==M&&0==D.length||"enter"!=M&&0==P.length;H&&!re&&(re=0==F.length);var ae=null===(s=w.state)||void 0===s?void 0:s.loginMethods;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Header,{title:X("auth.title.login"),text:X("auth.text.login",""),errorText:null!=q?q:""}),(0,f.jsx)(OpenId,{}),((null==ae?void 0:ae.generic)||(null==ae?void 0:ae.google)||(null==ae?void 0:ae.microsoft))&&ae.standard&&(0,f.jsx)("div",{className:u.kr,children:"or"}),(null==ae?void 0:ae.standard)&&(0,f.jsxs)(f.Fragment,{children:["enter"==M&&(0,f.jsxs)("form",{children:[(0,f.jsx)(v.Z,{id:"username",value:D,autoComplete:"username",autoFocus:!0,type:"email",placeholder:X("auth.input.email"),onChange:function onChange(e){return b(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&ee()}}),(0,f.jsx)(v.Z,{value:P,id:"password",type:"password",autoComplete:"current-password",hidden:!0,autoFocus:!0,placeholder:X("auth.input.password"),onChange:function onChange(e){return A(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&te()}})]}),"login"==M&&(0,f.jsxs)("form",{children:[H&&(0,f.jsx)(v.Z,{value:F,type:"text",autoFocus:!0,placeholder:X("auth.input.otp"),onChange:function onChange(e){return R(e.target.value)}}),(0,f.jsx)(v.Z,{value:D,type:"email",readOnly:!0,placeholder:X("auth.input.email"),resetInput:function reset(){C("enter"),b(""),A(""),J(void 0)}}),(0,f.jsx)(v.Z,{value:P,type:"password",id:"password",autoFocus:!0,placeholder:X("auth.input.password"),onChange:function onChange(e){return A(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&te()}})]}),(0,f.jsxs)(g.Z,{id:"submit",disabled:re||S,onClick:"enter"==M?ee:te,children:[S?(0,f.jsx)(m.Z,{size:24,color:"inherit"}):void 0,S?void 0:X("enter"==M?"auth.button.continue":"auth.button.login")]}),"login"==M&&(0,f.jsx)("div",{style:{textAlign:"center"},children:(0,f.jsx)("div",{className:u.p4,onClick:ne,children:X("auth.button.forgotpassword")})})," "]})]})}));var L=(0,j.jl)("Framework","RequestNewPassword");function RequestNewPassword(e){var t=e.initEmail,n=(0,a.KH)(),s=n.authorizationStore,c=n.apiHandler,h=n.loadingAndErrorStore,w=(0,r.useState)(t),x=(0,i.Z)(w,2),j=x[0],m=x[1],y=(0,r.useState)(!1),M=(0,i.Z)(y,2),k=M[0],C=M[1],N=(0,r.useState)(),S=(0,i.Z)(N,2),Z=S[0],I=S[1],E=(0,r.useState)(),D=(0,i.Z)(E,2),b=D[0],z=D[1],T=(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,z(!0),h.toggleLoading("SendPassword"),e.next=5,c.sendPasswordRecoveryMail({email:j});case 5:z(!1),h.toggleLoading("SendPassword"),C(!0),I(void 0),e.next=17;break;case 11:e.prev=11,e.t0=e.catch(0),L.error(new d.GE("Error while sending password recovery mail",{cause:e.t0})),I("auth.error.resetpassword"),z(!1),h.toggleLoading("SendPassword");case 17:case"end":return e.stop()}}),_callee,null,[[0,11]])})));return function resetPassword(){return e.apply(this,arguments)}}(),A=function toLogin(){s.close(),s.showLogin()};return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Header,{title:T("auth.title.resetpassword"),text:T("auth.info.resetdescription",""),errorText:null!=Z?Z:""}),k&&(0,f.jsxs)("div",{className:u.Vp,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:T("auth.info.resetpassword")})]}),!k&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(v.Z,{value:j,autoFocus:!0,placeholder:T("auth.input.email"),onChange:function onChange(e){return m(e.target.value)},onKeyPress:function onKeyPress(e){return"Enter"==e.key&&P()},resetInput:A}),(0,f.jsx)(g.Z,{disabled:0==j.length,onClick:P,children:T("auth.button.resetpassword")})]}),k&&(0,f.jsx)(g.Z,{disabled:b,onClick:A,children:T("auth.button.login")})]})}function Errormessage(e){var t=e.hasError,n=e.authErrorsg,r=(0,p.$G)().t;return(0,f.jsxs)("div",{className:u.vU,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 N=(0,j.jl)("Framework","cfhange-password");function ChangePassword(e){var t,n=e.token,s=(0,a.KH)(),c=s.configurationStore,h=s.authorizationStore,w=s.apiHandler,x=(s.loadingAndErrorStore,(0,r.useState)("")),j=(0,i.Z)(x,2),m=j[0],y=j[1],M=(0,r.useState)(""),k=(0,i.Z)(M,2),C=k[0],L=k[1],S=(0,r.useState)(!1),Z=(0,i.Z)(S,2),I=Z[0],E=Z[1],D=(0,r.useState)(),b=(0,i.Z)(D,2),z=b[0],T=b[1],P=(0,r.useState)(""),A=(0,i.Z)(P,2),O=A[0],_=A[1],F=(0,r.useRef)(null),R=(0,p.$G)().t;(0,r.useEffect)((function(){m===C&&T(void 0)}),[m,C]);var U=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(_(R("auth.error.verifypasswordserver")),!(m.length<8||m!==C)){e.next=4;break}return T("INVALID"),e.abrupt("return");case 4:return e.prev=4,e.next=7,w.resetPassword({password:m,token:n});case 7:E(!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)_(R("auth.error.verifypasswordtokenerror",{errormsg:R("auth.error.tokenexpired")}));else _(R("auth.error.verifypasswordserver",e.message));N.error(e)}N.error(new d.GE("Error while resetting password",{cause:e})),T("SERVER")};return"SERVER"===z?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Errormessage,{hasError:z,authErrorsg:O}),(0,f.jsx)(g.Z,{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:u.Vp,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:R("auth.info.verifypassword")})]}),(null===(t=c.authentication.resetPassword)||void 0===t?void 0:t.returnToLogin)&&(0,f.jsx)(g.Z,{onClick:function goToLogin(){h.close(),h.showLogin()},children:R("auth.button.login")})]}),!I&&(0,f.jsxs)(f.Fragment,{children:[z&&(0,f.jsx)(Errormessage,{hasError:z,authErrorsg:O}),(0,f.jsxs)("form",{children:[(0,f.jsx)(v.Z,{value:m,autoFocus:!0,placeholder:R("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,f.jsx)(v.Z,{ref:F,value:C,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)(g.Z,{disabled:!m||!C,onClick:U,children:R("auth.button.save")})]})]})}var S=n(4691);function WelcomeScreen(e){var t=e.isNewUser,n=e.invitationId,s=e.invitationOrgId,u=(0,a.KH)(),c=u.authorizationStore,d=u.authorizationHandler,h=(0,r.useState)(""),v=(0,i.Z)(h,2),w=v[0],x=v[1],j=(0,p.$G)().t,m=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)&&(c.close(),c.showLogin(void 0,void 0,s,n,e));case 4:case"end":return t.stop()}}),_callee)})));return function toLogin(){return e.apply(this,arguments)}}(),y=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)&&(c.close(),c.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=c.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 x("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)(Header,{title:j("auth.title.welcome"),text:j("auth.info.welcomedescription",""),errorText:null!=w?w:""}),t&&!w&&(0,f.jsx)(g.Z,{onClick:y,children:j("auth.title.register")}),!t&&!w&&(0,f.jsx)(g.Z,{onClick:m,children:j("auth.button.login")})]})}var Z=n(3714),I=(0,j.jl)("Framework","Register");const E=(0,c.Pi)((function Register(){var e,t,n,s,c,w,x=(0,a.KH)(),j=x.authorizationStore,M=x.configurationStore,k=(0,p.$G)().t,C=(0,r.useState)(null!==(e=null===(t=j.state)||void 0===t?void 0:t.email)&&void 0!==e?e:""),L=(0,i.Z)(C,2),N=L[0],S=L[1],E=(0,r.useState)(""),D=(0,i.Z)(E,2),b=D[0],z=D[1],T=(0,r.useState)(""),P=(0,i.Z)(T,2),A=P[0],O=P[1],_=(0,r.useState)(""),F=(0,i.Z)(_,2),R=F[0],U=F[1],G=(0,r.useState)(""),H=(0,i.Z)(G,2),K=H[0],$=H[1],Q=(0,r.useState)(""),V=(0,i.Z)(Q,2),W=V[0],Y=V[1],B=(0,r.useState)(""),q=(0,i.Z)(B,2),J=q[0],X=q[1],ee=(0,r.useState)(!1),te=(0,i.Z)(ee,2),ne=te[0],re=te[1],ae=(0,r.useState)(!1),oe=(0,i.Z)(ae,2),ie=oe[0],se=oe[1],le=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,re(!0),t.next=4,(0,h.fl)(j.register(N,b,K,R,null===(e=j.state)||void 0===e?void 0:e.invitationId,ue?J:void 0));case 4:S(""),z(""),O(""),$(""),U(""),t.next=15;break;case 11:t.prev=11,t.t0=t.catch(0),Y("auth.error.invitationotp"),I.error(new d.GE("Error while registering",{cause:t.t0}));case 15:return t.prev=15,re(!1),t.finish(15);case 18:case"end":return t.stop()}}),_callee,null,[[0,11,15,18]])})));return function onRegister(){return e.apply(this,arguments)}}(),ue=null===(n=j.state)||void 0===n?void 0:n.useOtp,ce=function validPassword(){return ue?null!=J&&""!==J&&b==A&&""!=b&&null!=b&&ie:b==A&&""!=b&&null!=b&&ie},de=null===(s=j.state)||void 0===s?void 0:s.loginMethods;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Header,{title:k("auth.title.register"),text:k("auth.text.register",""),errorText:null!=W?W:""}),(0,f.jsx)(OpenId,{disabled:!ie}),((null==de?void 0:de.generic)||(null==de?void 0:de.google)||(null==de?void 0:de.microsoft))&&de.standard&&(0,f.jsx)("div",{className:u.kr,children:"or"}),(null==de?void 0:de.standard)&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("form",{children:[ue&&(0,f.jsx)(v.Z,{type:"text",value:J,placeholder:k("auth.input.otp"),onChange:function onChange(e){return X(e.target.value)}}),(0,f.jsx)(v.Z,{value:K,autoFocus:!0,placeholder:k("backoffice.form.userdetails.items.name"),onChange:function onChange(e){return $(e.target.value)}}),(0,f.jsx)(v.Z,{value:R,autoFocus:!0,placeholder:k("backoffice.form.userdetails.items.familyName"),onChange:function onChange(e){return U(e.target.value)}}),(0,f.jsx)(v.Z,{value:N,autoComplete:"email",autoFocus:!0,placeholder:k("auth.input.email"),disabled:!0}),(0,f.jsx)(v.Z,{value:b,type:"password",autoFocus:!0,placeholder:k("auth.input.newpassword"),onChange:function onChange(e){return z(e.target.value)}}),(0,f.jsx)(v.Z,{value:A,type:"password",autoFocus:!0,placeholder:k("auth.input.repeatpassword"),onChange:function onChange(e){return O(e.target.value)}}),(0,f.jsxs)("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[(0,f.jsx)(Z.Z,{name:"checkAGB",checked:ie,onClick:function onClick(){return se(!ie)}}),(0,f.jsxs)("div",{style:{display:"flex",flexDirection:"column",fontSize:9},children:[(0,f.jsx)("span",{children:k("auth.acceptprivacyandagb")}),(0,f.jsxs)("span",{children:[(0,f.jsx)("a",{target:"_blank",href:null!==(c=M.navigation.tosUrl)&&void 0!==c?c:"https://www.diva-portal.de/agb",children:k("auth.GeneralTerms")}),", ",(0,f.jsx)("a",{target:"_blank",href:null!==(w=M.navigation.privacyUrl)&&void 0!==w?w:"https://www.diva-portal.de/datenschutz",children:k("auth.privacypolicy")})]})]})]}),(0,f.jsx)(y.Z,{severity:"warning",sx:{display:ce()?"none":"flex"},children:k("auth.input.passwordsnotmatch")})]}),(0,f.jsxs)(g.Z,{disabled:!ce()||ne,onClick:ce()?le:void 0,children:[ne?(0,f.jsx)(m.Z,{size:24,color:"inherit"}):void 0,ne?void 0:k("auth.input.login")]})]})]})}));var D=n(4376);var b=(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,f.jsx)(C,{});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)(E,{});case"INVITATION_EXPIRED":return(0,f.jsx)("h1",{children:"Abgelaufen"});default:return(0,f.jsx)(f.Fragment,{})}}));const z=(0,c.Pi)((function Auth(){var e,t,n,o,i=(0,a.KH)(),s=i.authorizationStore,l=i.configurationStore,c=i.dataStore,d=i.contentStore,v=(0,r.useMemo)((function(){var e,t,n,r="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciICB2aWV3Qm94PSIwIDAgMTAwMCAyOTMuNjUiPjxwYXRoIGQ9Ik0yNTAuODksMTQ3LjNjLTMuMTgtNzQtMzAuNC0xNDMuMTgtMTQxLjczLTE0My4xOEwwLDQuMjZBMzA3Ljg2LDMwNy44NiwwLDAsMSwyNi4xMiw2MC43aDc0LjJjNTIuODYsMCw3NiwyNS42OCw3OC42MSw4NS4yOSwyLjY2LDYxLjgxLTE4LjI5LDg3LjkyLTcxLjE1LDg3LjkySDc5LjJsLTQ2LjcxLjUyYTI4Ny4yOSwyODcuMjksMCwwLDEtMjAsNTMuODhoMTA5YzExMS4zMiwwLDEzMi42Ny02NywxMjkuNDgtMTQxTTMwNi44NCwyODloNzEuMjNWMGEzMDAuMDcsMzAwLjA3LDAsMCwxLTcxLjIzLDI1LjkyWm0zMTguOC42Mkw3MjYuNTkuODVhMzAwLDMwMCwwLDAsMS04My42NSwzMi4yNEw1NzcuMTEsMjI0LDUxMS4yOSwzMy4wOUEzMDAsMzAwLDAsMCwxLDQyNy42NC44NWwxMDEsMjg4Ljc2Wm0zNzQuMzYsNEw4OTkuMDUsNC45MUg4MDJMNzc1LjE0LDgxLjc0LDcwMS4wNSwyOTMuNjVBMzAwLjMyLDMwMC4zMiwwLDAsMSw3ODUsMjYxLjM1bDYuNzktMjEsMTkuMTQtNTcuNTRMODUwLjUyLDYybDQwLjA3LDEyMC44NSwxOC43LDU3LjU0LDcsMjFBMzAwLjIsMzAwLjIsMCwwLDEsMTAwMCwyOTMuNjUiIGZpbGw9IiNiM2IzYjMiLz48L3N2Zz4=";if(null!==(e=c.organization)&&void 0!==e&&e.logoUrl)r=null===(n=c.organization)||void 0===n?void 0:n.logoUrl;else if(null!==(t=l.navigation)&&void 0!==t&&t.logoUrl){var a;r=null===(a=l.navigation)||void 0===a?void 0:a.logoUrl}return r}),[null===(e=l.navigation)||void 0===e?void 0:e.logoUrl,null===(t=c.organization)||void 0===t?void 0:t.logoUrl]);return null==s.state?(0,f.jsx)(f.Fragment,{}):(0,f.jsxs)("div",{className:u.I8,children:[(null==l||null===(n=l.navigation)||void 0===n?void 0:n.showSnow)&&(0,f.jsx)(D.Z,{color:"#a7b6eb",speed:[0,2.5],wind:[-1,.5],snowflakeCount:300,radius:[.5,2],style:{zIndex:1e3}}),(0,f.jsxs)("div",{className:u.NB,children:[(!d.containerDimensions.isMobile||d.containerDimensions.isPortrait)&&(0,f.jsx)("div",{className:u.tn,style:{height:null!==(o=l.configuration.loginLogoHeight)&&void 0!==o?o:50,backgroundImage:"url(".concat(v,")")}}),(0,f.jsx)(b,{})]}),l.authentication.contentBox&&!d.containerDimensions.isMobile&&(0,f.jsx)("div",{style:{width:"calc(100% - 400px)",height:"100%",position:"relative",overflow:"hidden"},children:(0,f.jsx)(S.p,{settings:{contentBoxProps:(0,h.ZN)(l.authentication.contentBox.props)}})})]})}))}}]);
|