@crystaldesign/media-upload 24.11.0-beta.4 → 24.11.0-beta.41

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.
@@ -252,7 +252,7 @@ var DivaFile = /*#__PURE__*/function () {
252
252
  }, {
253
253
  key: "save",
254
254
  value: function () {
255
- var _save = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3(params) {
255
+ var _save = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3(params) {
256
256
  var _this$fileObject, _this$itemRef, _this$itemRef$url, _this$itemRef2, _file2, _url, response, blob, formData, mediaitem, _url2, mediaitemref, _mediaitemref, data, media, _media$spinImages, _media, ref, item, _this$item;
257
257
  return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context3) {
258
258
  while (1) switch (_context3.prev = _context3.next) {
@@ -394,8 +394,8 @@ var DivaFile = /*#__PURE__*/function () {
394
394
  headers: this.config.jwt ? {
395
395
  Authorization: "Bearer ".concat(this.config.jwt)
396
396
  } : {}
397
- }).then( /*#__PURE__*/function () {
398
- var _ref = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(r) {
397
+ }).then(/*#__PURE__*/function () {
398
+ var _ref = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(r) {
399
399
  var error, err;
400
400
  return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
401
401
  while (1) switch (_context.prev = _context.next) {
@@ -473,8 +473,8 @@ var DivaFile = /*#__PURE__*/function () {
473
473
  }, this.config.jwt ? {
474
474
  Authorization: "Bearer ".concat(this.config.jwt)
475
475
  } : {})
476
- }).then( /*#__PURE__*/function () {
477
- var _ref2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(r) {
476
+ }).then(/*#__PURE__*/function () {
477
+ var _ref2 = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(r) {
478
478
  var error, err;
479
479
  return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
480
480
  while (1) switch (_context2.prev = _context2.next) {
@@ -525,7 +525,7 @@ var DivaFile = /*#__PURE__*/function () {
525
525
  }, {
526
526
  key: "load",
527
527
  value: function () {
528
- var _load = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee4(params) {
528
+ var _load = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee4(params) {
529
529
  var mediaItemRef;
530
530
  return _regeneratorRuntime__default["default"].wrap(function _callee4$(_context4) {
531
531
  while (1) switch (_context4.prev = _context4.next) {
@@ -586,7 +586,7 @@ var DivaFile = /*#__PURE__*/function () {
586
586
  }, {
587
587
  key: "getMediaItem",
588
588
  value: function () {
589
- var _getMediaItem = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee5(imageUrl, organizationId) {
589
+ var _getMediaItem = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee5(imageUrl, organizationId) {
590
590
  var url, filter, mediaItem;
591
591
  return _regeneratorRuntime__default["default"].wrap(function _callee5$(_context5) {
592
592
  while (1) switch (_context5.prev = _context5.next) {
@@ -627,7 +627,7 @@ var DivaFile = /*#__PURE__*/function () {
627
627
  }, {
628
628
  key: "getMediaItemRef",
629
629
  value: function () {
630
- var _getMediaItemRef = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee6(ref, organizationId) {
630
+ var _getMediaItemRef = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee6(ref, organizationId) {
631
631
  var url, filter, mediaItemRef;
632
632
  return _regeneratorRuntime__default["default"].wrap(function _callee6$(_context6) {
633
633
  while (1) switch (_context6.prev = _context6.next) {
@@ -792,7 +792,7 @@ function index (_ref) {
792
792
  fileObjects = _useState20[0],
793
793
  setFileObjects = _useState20[1];
794
794
  var initState = /*#__PURE__*/function () {
795
- var _ref2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(data) {
795
+ var _ref2 = _asyncToGenerator__default["default"](/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(data) {
796
796
  var _newState$0$classes;
797
797
  var newState, files, i, file, newFile, fileEndingIndex;
798
798
  return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
@@ -228,7 +228,7 @@ var DivaFile = /*#__PURE__*/function () {
228
228
  }, {
229
229
  key: "save",
230
230
  value: function () {
231
- var _save = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(params) {
231
+ var _save = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(params) {
232
232
  var _this$fileObject, _this$itemRef, _this$itemRef$url, _this$itemRef2, _file2, _url, response, blob, formData, mediaitem, _url2, mediaitemref, _mediaitemref, data, media, _media$spinImages, _media, ref, item, _this$item;
233
233
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
234
234
  while (1) switch (_context3.prev = _context3.next) {
@@ -370,8 +370,8 @@ var DivaFile = /*#__PURE__*/function () {
370
370
  headers: this.config.jwt ? {
371
371
  Authorization: "Bearer ".concat(this.config.jwt)
372
372
  } : {}
373
- }).then( /*#__PURE__*/function () {
374
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(r) {
373
+ }).then(/*#__PURE__*/function () {
374
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(r) {
375
375
  var error, err;
376
376
  return _regeneratorRuntime.wrap(function _callee$(_context) {
377
377
  while (1) switch (_context.prev = _context.next) {
@@ -449,8 +449,8 @@ var DivaFile = /*#__PURE__*/function () {
449
449
  }, this.config.jwt ? {
450
450
  Authorization: "Bearer ".concat(this.config.jwt)
451
451
  } : {})
452
- }).then( /*#__PURE__*/function () {
453
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(r) {
452
+ }).then(/*#__PURE__*/function () {
453
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(r) {
454
454
  var error, err;
455
455
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
456
456
  while (1) switch (_context2.prev = _context2.next) {
@@ -501,7 +501,7 @@ var DivaFile = /*#__PURE__*/function () {
501
501
  }, {
502
502
  key: "load",
503
503
  value: function () {
504
- var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(params) {
504
+ var _load = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(params) {
505
505
  var mediaItemRef;
506
506
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
507
507
  while (1) switch (_context4.prev = _context4.next) {
@@ -562,7 +562,7 @@ var DivaFile = /*#__PURE__*/function () {
562
562
  }, {
563
563
  key: "getMediaItem",
564
564
  value: function () {
565
- var _getMediaItem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(imageUrl, organizationId) {
565
+ var _getMediaItem = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(imageUrl, organizationId) {
566
566
  var url, filter, mediaItem;
567
567
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
568
568
  while (1) switch (_context5.prev = _context5.next) {
@@ -603,7 +603,7 @@ var DivaFile = /*#__PURE__*/function () {
603
603
  }, {
604
604
  key: "getMediaItemRef",
605
605
  value: function () {
606
- var _getMediaItemRef = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(ref, organizationId) {
606
+ var _getMediaItemRef = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(ref, organizationId) {
607
607
  var url, filter, mediaItemRef;
608
608
  return _regeneratorRuntime.wrap(function _callee6$(_context6) {
609
609
  while (1) switch (_context6.prev = _context6.next) {
@@ -768,7 +768,7 @@ function index (_ref) {
768
768
  fileObjects = _useState20[0],
769
769
  setFileObjects = _useState20[1];
770
770
  var initState = /*#__PURE__*/function () {
771
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
771
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(data) {
772
772
  var _newState$0$classes;
773
773
  var newState, files, i, file, newFile, fileEndingIndex;
774
774
  return _regeneratorRuntime.wrap(function _callee$(_context) {
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see 478.media-upload.umd.min.js.LICENSE.txt */
2
- "use strict";(self.webpackChunkCrystaldesignMediaUpload=self.webpackChunkCrystaldesignMediaUpload||[]).push([[478],{1478:(e,t,n)=>{n.r(t),n.d(t,{default:()=>q});var r=n(1594),a=n(2108),o=n(6557),i=n(8742),s=n(725),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),w=n(2919),x=n.n(w),f=n(2246);function OpenId(){var e,t,n,r=(0,a.IB)(),o=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:x()(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:x()(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: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,")")}:{}}),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,a.IB)(),w=u.authorizationStore,x=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=w.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)(""),D=(0,i.A)(E,2),P=D[0],O=D[1],T=(0,r.useState)(!1),F=(0,i.A)(T,2),B=F[0],_=F[1],R=(0,r.useState)(w.state.invitationId),U=(0,i.A)(R,2),$=U[0],H=U[1],V=(0,r.useState)("LOGIN"==(null===(n=w.state)||void 0===n?void 0:n.type)?w.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,o.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,x.getInvitationValue("id",L);case 4:(e=n.sent)&&(e.isNewUser&&(w.close(),w.showRegister(void 0,L,!0)),H(!0),_(!0));case 6:return n.next=8,x.fetchLoginProvider({email:L});case 8:"standard"==(t=n.sent).provider?y("login"):w.openOAuthLogin(t.provider,w.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,o.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)(w.login(L,b,!1,w.state.organizationId,w.state.invitationId,P));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,o.A)(l().mark((function _callee3(){return l().wrap((function _callee3$(e){for(;;)switch(e.prev=e.next){case 0:w.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;B&&!X&&(X=0==P.length);var J=null===(s=w.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:[B&&(0,f.jsx)(v.A,{value:P,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,a.IB)(),s=n.authorizationStore,u=n.apiHandler,h=n.loadingAndErrorStore,w=(0,r.useState)(t),x=(0,i.A)(w,2),m=x[0],j=x[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],D=z[1],P=(0,g.B)().t,O=function(){var e=(0,o.A)(l().mark((function _callee(){return l().wrap((function _callee$(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,D(!0),h.toggleLoading("SendPassword"),e.next=5,u.sendPasswordRecoveryMail({email:m});case 5:D(!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"),D(!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:P("auth.title.resetpassword")}),(0,f.jsx)("p",{children:P("auth.info.resetdescription")}),!!S&&(0,f.jsxs)("div",{className:c.z3,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:P(S)})]}),C&&(0,f.jsxs)("div",{className:c.kX,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:P("auth.info.resetpassword")})]}),!C&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(v.A,{value:m,autoFocus:!0,placeholder:P("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:P("auth.button.resetpassword")})]}),C&&(0,f.jsx)(p.A,{disabled:E,onClick:function toLogin(){s.close(),s.showLogin()},children:P("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,a.IB)(),u=s.configurationStore,h=s.authorizationStore,w=s.apiHandler,x=(s.loadingAndErrorStore,(0,r.useState)("")),m=(0,i.A)(x,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),D=E[0],P=E[1],O=(0,r.useState)(""),T=(0,i.A)(O,2),F=T[0],B=T[1],_=(0,r.useRef)(null),R=(0,g.B)().t;(0,r.useEffect)((function(){j===M&&P(void 0)}),[j,M]);var U=function(){var e=(0,o.A)(l().mark((function _callee(){return l().wrap((function _callee$(e){for(;;)switch(e.prev=e.next){case 0:if(B(R("auth.error.verifypasswordserver")),!(j.length<8||j!==M)){e.next=4;break}return P("INVALID"),e.abrupt("return");case 4:return e.prev=4,e.next=7,w.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)B(R("auth.error.verifypasswordtokenerror",{errormsg:R("auth.error.tokenexpired")}));else B(R("auth.error.verifypasswordserver",e.message));y.error(e)}y.error(new d.p$("Error while resetting password",{cause:e})),P("SERVER")};return"SERVER"===D?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Errormessage,{hasError:D,authErrorsg:F}),(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:[D&&(0,f.jsx)(Errormessage,{hasError:D,authErrorsg:F}),(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=_.current)||void 0===t?void 0:t.focus())}}),(0,f.jsx)(v.A,{ref:_,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,a.IB)(),u=s.authorizationStore,d=s.authorizationHandler,h=(0,r.useState)(""),v=(0,i.A)(h,2),w=v[0],x=v[1],m=(0,g.B)().t,j=function(){var e=(0,o.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,o.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,o.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 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)("h1",{children:m("auth.title.welcome")}),(0,f.jsx)("p",{children:m("auth.info.welcomedescription")}),w&&(0,f.jsxs)("div",{className:c.z3,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:m(w)})]}),t&&!w&&(0,f.jsx)(p.A,{onClick:A,children:m("auth.title.register")}),!t&&!w&&(0,f.jsx)(p.A,{onClick:j,children:m("auth.button.login")})]})}var M=n(3494),L=n(250),N=n(120),S=(n(3886),n(203)),I=n(4134),b=n(8686),z=n(1635),E=n(6224),D=n(9874),P=r.forwardRef((function SwitchBase(e,t){var n=e.autoFocus,a=e.checked,o=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,w=e.onChange,x=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:a,default:Boolean(l),name:"SwitchBase",state:"checked"}),M=(0,I.A)(C,2),E=M[0],P=M[1],O=(0,z.A)(),T=c;O&&void 0===T&&(T=O.disabled);var F="checkbox"===A||"radio"===A;return r.createElement(D.A,(0,L.A)({component:"span",className:(0,S.default)(i.root,s,E&&i.checked,T&&i.disabled),disabled:T,tabIndex:null,role:void 0,onFocus:function handleFocus(e){x&&x(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:a,defaultChecked:l,className:i.input,disabled:T,id:F&&d,name:p,onChange:function handleInputChange(e){var t=e.target.checked;P(t),w&&w(e,t)},readOnly:f,ref:v,required:m,tabIndex:j,type:A,value:k},h)),E?o:u)}));const O=(0,E.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"})(P);var T=n(5261);const F=(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 _=n(4287);const R=(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 U=n(433),$=r.createElement(B,null),H=r.createElement(F,null),V=r.createElement(R,null),K=r.forwardRef((function Checkbox(e,t){var n=e.checkedIcon,a=void 0===n?$:n,o=e.classes,i=e.color,s=void 0===i?"secondary":i,l=e.icon,c=void 0===l?H:l,u=e.indeterminate,d=void 0!==u&&u,h=e.indeterminateIcon,v=void 0===h?V:h,p=e.inputProps,g=e.size,w=void 0===g?"medium":g,x=(0,N.A)(e,["checkedIcon","classes","color","icon","indeterminate","indeterminateIcon","inputProps","size"]),f=d?v:c,m=d?v:a;return r.createElement(O,(0,L.A)({type:"checkbox",classes:{root:(0,S.default)(o.root,o["color".concat((0,U.A)(s))],d&&o.indeterminate),checked:o.checked,disabled:o.disabled},color:s,inputProps:(0,L.A)({"data-indeterminate":d},p),icon:r.cloneElement(f,{fontSize:void 0===f.props.fontSize&&"small"===w?w:f.props.fontSize}),checkedIcon:r.cloneElement(m,{fontSize:void 0===m.props.fontSize&&"small"===w?w:m.props.fontSize}),ref:t},x))}));const Q=(0,E.A)((function styles(e){return{root:{color:e.palette.text.secondary},checked:{},disabled:{},indeterminate:{},colorPrimary:{"&$checked":{color:e.palette.primary.main,"&:hover":{backgroundColor:(0,_.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,_.Rv)(e.palette.secondary.main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}}},"&$disabled":{color:e.palette.action.disabled}}}}),{name:"MuiCheckbox"})(K);var W=(0,m.tZ)("Framework","Register");const Y=(0,u.PA)((function Register(){var e,t,n,s,u,w,x=(0,a.IB)(),m=x.authorizationStore,j=x.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),D=E[0],P=E[1],O=(0,r.useState)(""),T=(0,i.A)(O,2),F=T[0],B=T[1],_=(0,r.useState)(""),R=(0,i.A)(_,2),U=R[0],$=R[1],H=(0,r.useState)(""),V=(0,i.A)(H,2),K=V[0],Y=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,o.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,F,null===(e=m.state)||void 0===e?void 0:e.invitationId,Z));case 3:L(""),b(""),P(""),$(""),B(""),t.next=14;break;case 10:t.prev=10,t.t0=t.catch(0),Y("auth.error.invitationotp"),W.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)}}(),ae=null===(n=m.state)||void 0===n?void 0:n.useOtp,oe=function validPassword(){return ae?null!=Z&&""!==Z&&I==D&&""!=I&&null!=I&&te:I==D&&""!=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:[ae&&(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:F,autoFocus:!0,placeholder:A("backoffice.form.userdetails.items.familyName"),onChange:function onChange(e){return B(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:D,type:"password",autoFocus:!0,placeholder:A("auth.input.repeatpassword"),onChange:function onChange(e){return P(e.target.value)}}),(0,f.jsxs)("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[(0,f.jsx)(Q,{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!==(w=j.navigation.privacyUrl)&&void 0!==w?w:"https://www.diva-portal.de/datenschutz",children:A("auth.privacypolicy")})]})]})]}),(0,f.jsx)(M.A,{style:{color:"#FF8C00",marginTop:10,fontSize:14},hidden:oe(),children:A("auth.input.passwordsnotmatch")})]}),(0,f.jsx)(p.A,{disabled:!oe(),onClick:oe()?re:void 0,children:A("auth.input.login")})]})]})}));var G=(0,u.PA)((function(){var e,t=(0,a.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)(Y,{});case"INVITATION_EXPIRED":return(0,f.jsx)("h1",{children:"Abgelaufen"});default:return(0,f.jsx)(f.Fragment,{})}}));const q=(0,u.PA)((function Auth(){var e,t,n,o=(0,a.IB)(),i=o.authorizationStore,s=o.configurationStore,l=o.dataStore,u=(o.authorizationHandler,(0,r.useMemo)((function(){var e,t,n,r="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciICB2aWV3Qm94PSIwIDAgMTAwMCAyOTMuNjUiPjxwYXRoIGQ9Ik0yNTAuODksMTQ3LjNjLTMuMTgtNzQtMzAuNC0xNDMuMTgtMTQxLjczLTE0My4xOEwwLDQuMjZBMzA3Ljg2LDMwNy44NiwwLDAsMSwyNi4xMiw2MC43aDc0LjJjNTIuODYsMCw3NiwyNS42OCw3OC42MSw4NS4yOSwyLjY2LDYxLjgxLTE4LjI5LDg3LjkyLTcxLjE1LDg3LjkySDc5LjJsLTQ2LjcxLjUyYTI4Ny4yOSwyODcuMjksMCwwLDEtMjAsNTMuODhoMTA5YzExMS4zMiwwLDEzMi42Ny02NywxMjkuNDgtMTQxTTMwNi44NCwyODloNzEuMjNWMGEzMDAuMDcsMzAwLjA3LDAsMCwxLTcxLjIzLDI1LjkyWm0zMTguOC42Mkw3MjYuNTkuODVhMzAwLDMwMCwwLDAsMS04My42NSwzMi4yNEw1NzcuMTEsMjI0LDUxMS4yOSwzMy4wOUEzMDAsMzAwLDAsMCwxLDQyNy42NC44NWwxMDEsMjg4Ljc2Wm0zNzQuMzYsNEw4OTkuMDUsNC45MUg4MDJMNzc1LjE0LDgxLjc0LDcwMS4wNSwyOTMuNjVBMzAwLjMyLDMwMC4zMiwwLDAsMSw3ODUsMjYxLjM1bDYuNzktMjEsMTkuMTQtNTcuNTRMODUwLjUyLDYybDQwLjA3LDEyMC44NSwxOC43LDU3LjU0LDcsMjFBMzAwLjIsMzAwLjIsMCwwLDEsMTAwMCwyOTMuNjUiIGZpbGw9IiNiM2IzYjMiLz48L3N2Zz4=";if(null!==(e=l.organization)&&void 0!==e&&e.logoUrl)r=null===(n=l.organization)||void 0===n?void 0:n.logoUrl;else if(null!==(t=s.navigation)&&void 0!==t&&t.logoUrl){var a;r=null===(a=s.navigation)||void 0===a?void 0:a.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)(G,{})]}),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.webpackChunkCrystaldesignMediaUpload=self.webpackChunkCrystaldesignMediaUpload||[]).push([[478],{1478:(e,t,n)=>{n.r(t),n.d(t,{default:()=>q});var r=n(1594),a=n(2108),o=n(6557),i=n(8742),s=n(725),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),w=n(2919),x=n.n(w),f=n(2246);function OpenId(){var e,t,n,r=(0,a.IB)(),o=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:x()(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:x()(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: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,")")}:{}}),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,a.IB)(),w=u.authorizationStore,x=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=w.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)(""),D=(0,i.A)(E,2),P=D[0],O=D[1],T=(0,r.useState)(!1),F=(0,i.A)(T,2),B=F[0],_=F[1],R=(0,r.useState)(w.state.invitationId),U=(0,i.A)(R,2),$=U[0],H=U[1],V=(0,r.useState)("LOGIN"==(null===(n=w.state)||void 0===n?void 0:n.type)?w.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,o.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,x.getInvitationValue("id",I);case 4:(e=n.sent)&&(e.isNewUser&&(w.close(),w.showRegister(void 0,I,!0)),H(!0),_(!0));case 6:return n.next=8,x.fetchLoginProvider({email:I});case 8:"standard"==(t=n.sent).provider?y("login"):w.openOAuthLogin(t.provider,w.state.organizationId,w.state.invitationId),n.next=16;break;case 12:n.prev=12,n.t0=n.catch(0),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,o.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)(w.login(I,b,!1,w.state.organizationId,w.state.invitationId,P));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,o.A)(l().mark((function _callee3(){return l().wrap((function _callee3$(e){for(;;)switch(e.prev=e.next){case 0:w.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;B&&!X&&(X=0==P.length);var J=null===(s=w.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:[B&&(0,f.jsx)(v.A,{value:P,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,a.IB)(),s=n.authorizationStore,u=n.apiHandler,h=n.loadingAndErrorStore,w=(0,r.useState)(t),x=(0,i.A)(w,2),m=x[0],j=x[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],D=z[1],P=(0,g.B)().t,O=function(){var e=(0,o.A)(l().mark((function _callee(){return l().wrap((function _callee$(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,D(!0),h.toggleLoading("SendPassword"),e.next=5,u.sendPasswordRecoveryMail({email:m});case 5:D(!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"),D(!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:P("auth.title.resetpassword")}),(0,f.jsx)("p",{children:P("auth.info.resetdescription")}),!!N&&(0,f.jsxs)("div",{className:c.z3,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:P(N)})]}),C&&(0,f.jsxs)("div",{className:c.kX,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:P("auth.info.resetpassword")})]}),!C&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(v.A,{value:m,autoFocus:!0,placeholder:P("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:P("auth.button.resetpassword")})]}),C&&(0,f.jsx)(p.A,{disabled:E,onClick:function toLogin(){s.close(),s.showLogin()},children:P("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,a.IB)(),u=s.configurationStore,h=s.authorizationStore,w=s.apiHandler,x=(s.loadingAndErrorStore,(0,r.useState)("")),m=(0,i.A)(x,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),D=E[0],P=E[1],O=(0,r.useState)(""),T=(0,i.A)(O,2),F=T[0],B=T[1],_=(0,r.useRef)(null),R=(0,g.B)().t;(0,r.useEffect)((function(){j===M&&P(void 0)}),[j,M]);var U=function(){var e=(0,o.A)(l().mark((function _callee(){return l().wrap((function _callee$(e){for(;;)switch(e.prev=e.next){case 0:if(B(R("auth.error.verifypasswordserver")),!(j.length<8||j!==M)){e.next=4;break}return P("INVALID"),e.abrupt("return");case 4:return e.prev=4,e.next=7,w.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)B(R("auth.error.verifypasswordtokenerror",{errormsg:R("auth.error.tokenexpired")}));else B(R("auth.error.verifypasswordserver",e.message));y.error(e)}y.error(new d.p$("Error while resetting password",{cause:e})),P("SERVER")};return"SERVER"===D?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Errormessage,{hasError:D,authErrorsg:F}),(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:[D&&(0,f.jsx)(Errormessage,{hasError:D,authErrorsg:F}),(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=_.current)||void 0===t?void 0:t.focus())}}),(0,f.jsx)(v.A,{ref:_,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,a.IB)(),d=u.authorizationStore,h=u.authorizationHandler,v=(0,r.useState)(""),w=(0,i.A)(v,2),x=w[0],m=w[1],j=(0,g.B)().t,A=function(){var e=(0,o.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,o.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,o.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")}),x&&(0,f.jsxs)("div",{className:c.z3,children:[(0,f.jsx)("span",{}),(0,f.jsx)("div",{children:j(x)})]}),t&&!x&&(0,f.jsx)(p.A,{onClick:k,children:j("auth.title.register")}),!t&&!x&&(0,f.jsx)(p.A,{onClick:A,children:j("auth.button.login")})]})}var M=n(3494),I=n(250),L=n(120),N=(n(3886),n(203)),S=n(4134),b=n(8686),z=n(1635),E=n(6224),D=n(9874),P=r.forwardRef((function SwitchBase(e,t){var n=e.autoFocus,a=e.checked,o=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,w=e.onChange,x=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:a,default:Boolean(l),name:"SwitchBase",state:"checked"}),M=(0,S.A)(C,2),E=M[0],P=M[1],O=(0,z.A)(),T=c;O&&void 0===T&&(T=O.disabled);var F="checkbox"===A||"radio"===A;return r.createElement(D.A,(0,I.A)({component:"span",className:(0,N.default)(i.root,s,E&&i.checked,T&&i.disabled),disabled:T,tabIndex:null,role:void 0,onFocus:function handleFocus(e){x&&x(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:a,defaultChecked:l,className:i.input,disabled:T,id:F&&d,name:p,onChange:function handleInputChange(e){var t=e.target.checked;P(t),w&&w(e,t)},readOnly:f,ref:v,required:m,tabIndex:j,type:A,value:k},h)),E?o:u)}));const O=(0,E.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"})(P);var T=n(5261);const F=(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 _=n(4287);const R=(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 U=n(433),$=r.createElement(B,null),H=r.createElement(F,null),V=r.createElement(R,null),K=r.forwardRef((function Checkbox(e,t){var n=e.checkedIcon,a=void 0===n?$:n,o=e.classes,i=e.color,s=void 0===i?"secondary":i,l=e.icon,c=void 0===l?H:l,u=e.indeterminate,d=void 0!==u&&u,h=e.indeterminateIcon,v=void 0===h?V:h,p=e.inputProps,g=e.size,w=void 0===g?"medium":g,x=(0,L.A)(e,["checkedIcon","classes","color","icon","indeterminate","indeterminateIcon","inputProps","size"]),f=d?v:c,m=d?v:a;return r.createElement(O,(0,I.A)({type:"checkbox",classes:{root:(0,N.default)(o.root,o["color".concat((0,U.A)(s))],d&&o.indeterminate),checked:o.checked,disabled:o.disabled},color:s,inputProps:(0,I.A)({"data-indeterminate":d},p),icon:r.cloneElement(f,{fontSize:void 0===f.props.fontSize&&"small"===w?w:f.props.fontSize}),checkedIcon:r.cloneElement(m,{fontSize:void 0===m.props.fontSize&&"small"===w?w:m.props.fontSize}),ref:t},x))}));const Q=(0,E.A)((function styles(e){return{root:{color:e.palette.text.secondary},checked:{},disabled:{},indeterminate:{},colorPrimary:{"&$checked":{color:e.palette.primary.main,"&:hover":{backgroundColor:(0,_.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,_.Rv)(e.palette.secondary.main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}}},"&$disabled":{color:e.palette.action.disabled}}}}),{name:"MuiCheckbox"})(K);var W=(0,m.tZ)("Framework","Register");const Y=(0,u.PA)((function Register(){var e,t,n,s,u,w,x=(0,a.IB)(),m=x.authorizationStore,j=x.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),D=E[0],P=E[1],O=(0,r.useState)(""),T=(0,i.A)(O,2),F=T[0],B=T[1],_=(0,r.useState)(""),R=(0,i.A)(_,2),U=R[0],$=R[1],H=(0,r.useState)(""),V=(0,i.A)(H,2),K=V[0],Y=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,o.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,F,null===(e=m.state)||void 0===e?void 0:e.invitationId,Z));case 3:I(""),b(""),P(""),$(""),B(""),t.next=14;break;case 10:t.prev=10,t.t0=t.catch(0),Y("auth.error.invitationotp"),W.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)}}(),ae=null===(n=m.state)||void 0===n?void 0:n.useOtp,oe=function validPassword(){return ae?null!=Z&&""!==Z&&S==D&&""!=S&&null!=S&&te:S==D&&""!=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:[ae&&(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:F,autoFocus:!0,placeholder:A("backoffice.form.userdetails.items.familyName"),onChange:function onChange(e){return B(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:D,type:"password",autoFocus:!0,placeholder:A("auth.input.repeatpassword"),onChange:function onChange(e){return P(e.target.value)}}),(0,f.jsxs)("div",{style:{display:"flex",gap:5,alignItems:"center"},children:[(0,f.jsx)(Q,{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!==(w=j.navigation.privacyUrl)&&void 0!==w?w:"https://www.diva-portal.de/datenschutz",children:A("auth.privacypolicy")})]})]})]}),(0,f.jsx)(M.A,{style:{color:"#FF8C00",marginTop:10,fontSize:14},hidden:oe(),children:A("auth.input.passwordsnotmatch")})]}),(0,f.jsx)(p.A,{disabled:!oe(),onClick:oe()?re:void 0,children:A("auth.input.login")})]})]})}));var G=(0,u.PA)((function(){var e,t=(0,a.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)(Y,{});case"INVITATION_EXPIRED":return(0,f.jsx)("h1",{children:"Abgelaufen"});default:return(0,f.jsx)(f.Fragment,{})}}));const q=(0,u.PA)((function Auth(){var e,t,n,o=(0,a.IB)(),i=o.authorizationStore,s=o.configurationStore,l=o.dataStore,u=(o.authorizationHandler,(0,r.useMemo)((function(){var e,t,n,r="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciICB2aWV3Qm94PSIwIDAgMTAwMCAyOTMuNjUiPjxwYXRoIGQ9Ik0yNTAuODksMTQ3LjNjLTMuMTgtNzQtMzAuNC0xNDMuMTgtMTQxLjczLTE0My4xOEwwLDQuMjZBMzA3Ljg2LDMwNy44NiwwLDAsMSwyNi4xMiw2MC43aDc0LjJjNTIuODYsMCw3NiwyNS42OCw3OC42MSw4NS4yOSwyLjY2LDYxLjgxLTE4LjI5LDg3LjkyLTcxLjE1LDg3LjkySDc5LjJsLTQ2LjcxLjUyYTI4Ny4yOSwyODcuMjksMCwwLDEtMjAsNTMuODhoMTA5YzExMS4zMiwwLDEzMi42Ny02NywxMjkuNDgtMTQxTTMwNi44NCwyODloNzEuMjNWMGEzMDAuMDcsMzAwLjA3LDAsMCwxLTcxLjIzLDI1LjkyWm0zMTguOC42Mkw3MjYuNTkuODVhMzAwLDMwMCwwLDAsMS04My42NSwzMi4yNEw1NzcuMTEsMjI0LDUxMS4yOSwzMy4wOUEzMDAsMzAwLDAsMCwxLDQyNy42NC44NWwxMDEsMjg4Ljc2Wm0zNzQuMzYsNEw4OTkuMDUsNC45MUg4MDJMNzc1LjE0LDgxLjc0LDcwMS4wNSwyOTMuNjVBMzAwLjMyLDMwMC4zMiwwLDAsMSw3ODUsMjYxLjM1bDYuNzktMjEsMTkuMTQtNTcuNTRMODUwLjUyLDYybDQwLjA3LDEyMC44NSwxOC43LDU3LjU0LDcsMjFBMzAwLjIsMzAwLjIsMCwwLDEsMTAwMCwyOTMuNjUiIGZpbGw9IiNiM2IzYjMiLz48L3N2Zz4=";if(null!==(e=l.organization)&&void 0!==e&&e.logoUrl)r=null===(n=l.organization)||void 0===n?void 0:n.logoUrl;else if(null!==(t=s.navigation)&&void 0!==t&&t.logoUrl){var a;r=null===(a=s.navigation)||void 0===a?void 0:a.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)(G,{})]}),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)}})})]})}))}}]);