@codebit-programando-solucoes/codebit-web-antd 1.1.9 → 1.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/CssTokenBridge.d.ts +10 -0
- package/dist/components/LoggedMainContainer.d.ts +3 -2
- package/dist/components/ThemeToggle.d.ts +4 -5
- package/dist/contexts/CodebitConfigContext.d.ts +55 -59
- package/dist/contexts/CodebitThemeContext.d.ts +26 -0
- package/dist/contexts/index.d.ts +1 -0
- package/dist/index.cjs +978 -441
- package/dist/index.css +65 -64
- package/dist/index.d.ts +0 -1
- package/dist/public-pages/ChangePassword.d.ts +47 -0
- package/dist/public-pages/ForgotPassword.d.ts +45 -0
- package/dist/public-pages/HandleError.d.ts +2 -3
- package/dist/public-pages/Login.d.ts +48 -10
- package/dist/public-pages/LoginContainer.d.ts +13 -13
- package/dist/public-pages/index.d.ts +1 -0
- package/package.json +16 -14
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! For license information please see index.cjs.LICENSE.txt */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __webpack_modules__ = {
|
|
4
|
-
"../../node_modules/.pnpm/react@19.2.
|
|
4
|
+
"../../node_modules/.pnpm/react@19.2.3/node_modules/react/cjs/react-jsx-runtime.development.js" (__unused_rspack_module, exports1, __webpack_require__) {
|
|
5
5
|
/**
|
|
6
6
|
* @license React
|
|
7
7
|
* react-jsx-runtime.development.js
|
|
@@ -209,7 +209,7 @@ var __webpack_modules__ = {
|
|
|
209
209
|
};
|
|
210
210
|
}();
|
|
211
211
|
},
|
|
212
|
-
"../../node_modules/.pnpm/react@19.2.
|
|
212
|
+
"../../node_modules/.pnpm/react@19.2.3/node_modules/react/cjs/react-jsx-runtime.production.js" (__unused_rspack_module, exports1) {
|
|
213
213
|
/**
|
|
214
214
|
* @license React
|
|
215
215
|
* react-jsx-runtime.production.js
|
|
@@ -240,11 +240,11 @@ var __webpack_modules__ = {
|
|
|
240
240
|
exports1.jsx = jsxProd;
|
|
241
241
|
exports1.jsxs = jsxProd;
|
|
242
242
|
},
|
|
243
|
-
"../../node_modules/.pnpm/react@19.2.
|
|
244
|
-
if ('production' === process.env.NODE_ENV) module.exports = __webpack_require__("../../node_modules/.pnpm/react@19.2.
|
|
245
|
-
else module.exports = __webpack_require__("../../node_modules/.pnpm/react@19.2.
|
|
243
|
+
"../../node_modules/.pnpm/react@19.2.3/node_modules/react/jsx-runtime.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
244
|
+
if ('production' === process.env.NODE_ENV) module.exports = __webpack_require__("../../node_modules/.pnpm/react@19.2.3/node_modules/react/cjs/react-jsx-runtime.production.js");
|
|
245
|
+
else module.exports = __webpack_require__("../../node_modules/.pnpm/react@19.2.3/node_modules/react/cjs/react-jsx-runtime.development.js");
|
|
246
246
|
},
|
|
247
|
-
react
|
|
247
|
+
react (module) {
|
|
248
248
|
module.exports = require("react");
|
|
249
249
|
}
|
|
250
250
|
};
|
|
@@ -280,7 +280,7 @@ function __webpack_require__(moduleId) {
|
|
|
280
280
|
})();
|
|
281
281
|
(()=>{
|
|
282
282
|
__webpack_require__.r = (exports1)=>{
|
|
283
|
-
if (
|
|
283
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
284
284
|
value: 'Module'
|
|
285
285
|
});
|
|
286
286
|
Object.defineProperty(exports1, '__esModule', {
|
|
@@ -296,24 +296,116 @@ var __webpack_exports__ = {};
|
|
|
296
296
|
CssTokenBridge: ()=>CssTokenBridge,
|
|
297
297
|
LoggedMainContainer: ()=>LoggedMainContainer,
|
|
298
298
|
Login: ()=>Login,
|
|
299
|
-
|
|
300
|
-
HandleError: ()=>HandleError,
|
|
299
|
+
CodebitThemeProvider: ()=>CodebitThemeProvider,
|
|
301
300
|
ErrorRetry: ()=>ErrorRetry,
|
|
302
|
-
|
|
301
|
+
CodebitThemeContext: ()=>CodebitThemeContext,
|
|
303
302
|
CodebitConfigContext: ()=>CodebitConfigContext,
|
|
304
303
|
ListCard: ()=>ListCard,
|
|
305
|
-
|
|
306
|
-
LoginContainer: ()=>LoginContainer
|
|
304
|
+
ForgotPassword: ()=>ForgotPassword,
|
|
305
|
+
LoginContainer: ()=>LoginContainer,
|
|
306
|
+
LocalLoginRecoveryPasswordResult: ()=>LocalLoginRecoveryPasswordResult,
|
|
307
|
+
FilterContainer: ()=>FilterContainer,
|
|
308
|
+
HandleError: ()=>HandleError,
|
|
309
|
+
LocalLoginAuthenticationResult: ()=>LocalLoginAuthenticationResult,
|
|
310
|
+
CodebitConfigProvider: ()=>CodebitConfigProvider,
|
|
311
|
+
ThemeToggle: ()=>ThemeToggle
|
|
307
312
|
});
|
|
308
|
-
var jsx_runtime = __webpack_require__("../../node_modules/.pnpm/react@19.2.
|
|
313
|
+
var jsx_runtime = __webpack_require__("../../node_modules/.pnpm/react@19.2.3/node_modules/react/jsx-runtime.js");
|
|
309
314
|
const icons_namespaceObject = require("@ant-design/icons");
|
|
310
315
|
const external_antd_namespaceObject = require("antd");
|
|
311
316
|
const external_prop_types_namespaceObject = require("prop-types");
|
|
312
317
|
var external_prop_types_default = /*#__PURE__*/ __webpack_require__.n(external_prop_types_namespaceObject);
|
|
313
318
|
var external_react_ = __webpack_require__("react");
|
|
314
319
|
const external_react_router_namespaceObject = require("react-router");
|
|
315
|
-
const
|
|
320
|
+
const react_namespaceObject = require("@sentry/react");
|
|
321
|
+
const codebit_web_namespaceObject = require("@codebit-programando-solucoes/codebit-web");
|
|
322
|
+
const logger = new codebit_web_namespaceObject.Logger('CodebitConfigContext');
|
|
323
|
+
const CodebitConfigContext = /*#__PURE__*/ (0, external_react_.createContext)(null);
|
|
324
|
+
function CodebitConfigProvider({ children, menuItems, version = '1.0', showVersion = ()=>true, secondarySidebar, secondarySidebarWidth = 280, doLogout, checkLogin }) {
|
|
325
|
+
const [isLogged, setIsLogged] = (0, external_react_.useState)(null);
|
|
326
|
+
const [user, setUser] = (0, external_react_.useState)(null);
|
|
327
|
+
const logout = async ()=>{
|
|
328
|
+
await doLogout();
|
|
329
|
+
setIsLogged(false);
|
|
330
|
+
setUser(null);
|
|
331
|
+
react_namespaceObject.setUser(null);
|
|
332
|
+
};
|
|
333
|
+
(0, external_react_.useEffect)(()=>{
|
|
334
|
+
if (null === isLogged) checkLogin().then((loggedUser)=>{
|
|
335
|
+
if (loggedUser) {
|
|
336
|
+
logger.trace('User data.', loggedUser);
|
|
337
|
+
setIsLogged(true);
|
|
338
|
+
setUser(loggedUser);
|
|
339
|
+
react_namespaceObject.setUser({
|
|
340
|
+
id: loggedUser.id,
|
|
341
|
+
email: loggedUser.email,
|
|
342
|
+
name: loggedUser.name
|
|
343
|
+
});
|
|
344
|
+
} else {
|
|
345
|
+
logger.trace('User not logged in.');
|
|
346
|
+
setIsLogged(false);
|
|
347
|
+
setUser(null);
|
|
348
|
+
react_namespaceObject.setUser(null);
|
|
349
|
+
}
|
|
350
|
+
}).catch((e)=>{
|
|
351
|
+
logger.error('Error fetching session state.', e);
|
|
352
|
+
setIsLogged(false);
|
|
353
|
+
setUser(null);
|
|
354
|
+
});
|
|
355
|
+
}, [
|
|
356
|
+
isLogged
|
|
357
|
+
]);
|
|
358
|
+
const contextValue = (0, external_react_.useMemo)(()=>({
|
|
359
|
+
menuItems,
|
|
360
|
+
isLogged,
|
|
361
|
+
user,
|
|
362
|
+
logout,
|
|
363
|
+
version,
|
|
364
|
+
showVersion,
|
|
365
|
+
secondarySidebar,
|
|
366
|
+
secondarySidebarWidth
|
|
367
|
+
}), [
|
|
368
|
+
menuItems,
|
|
369
|
+
isLogged,
|
|
370
|
+
user,
|
|
371
|
+
version,
|
|
372
|
+
showVersion,
|
|
373
|
+
secondarySidebar,
|
|
374
|
+
secondarySidebarWidth
|
|
375
|
+
]);
|
|
376
|
+
return /*#__PURE__*/ (0, jsx_runtime.jsx)(CodebitConfigContext.Provider, {
|
|
377
|
+
value: contextValue,
|
|
378
|
+
children: children
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
CodebitConfigProvider.propTypes = {
|
|
382
|
+
children: external_prop_types_default().node.isRequired,
|
|
383
|
+
menuItems: external_prop_types_default().func.isRequired,
|
|
384
|
+
version: external_prop_types_default().string,
|
|
385
|
+
showVersion: external_prop_types_default().func,
|
|
386
|
+
secondarySidebar: external_prop_types_default().func,
|
|
387
|
+
secondarySidebarWidth: external_prop_types_default().number,
|
|
388
|
+
doLogout: external_prop_types_default().func.isRequired,
|
|
389
|
+
checkLogin: external_prop_types_default().func.isRequired
|
|
390
|
+
};
|
|
391
|
+
const ThemeToggle = ()=>{
|
|
392
|
+
const config = (0, external_react_.useContext)(CodebitThemeContext);
|
|
393
|
+
if (!config) throw new Error('ThemeToggle must be used within CodebitThemeContext');
|
|
394
|
+
(0, external_react_.useEffect)(()=>{
|
|
395
|
+
document.documentElement.style.colorScheme = config.isDarkMode ? 'dark' : 'light';
|
|
396
|
+
}, [
|
|
397
|
+
config.isDarkMode
|
|
398
|
+
]);
|
|
399
|
+
return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Switch, {
|
|
400
|
+
theme: config.isDarkMode ? 'dark' : 'light',
|
|
401
|
+
checked: config.isDarkMode,
|
|
402
|
+
onChange: (value)=>config.setIsDarkMode(value),
|
|
403
|
+
checkedChildren: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MoonOutlined, {}),
|
|
404
|
+
unCheckedChildren: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.SunOutlined, {})
|
|
405
|
+
});
|
|
406
|
+
};
|
|
316
407
|
const external_react_i18next_namespaceObject = require("react-i18next");
|
|
408
|
+
const external_i18next_namespaceObject = require("i18next");
|
|
317
409
|
const pt = {
|
|
318
410
|
codebitWebAntd: {
|
|
319
411
|
LoggedMainContainer: {
|
|
@@ -346,7 +438,53 @@ var __webpack_exports__ = {};
|
|
|
346
438
|
},
|
|
347
439
|
Login: {
|
|
348
440
|
loginTitle: 'Entrar',
|
|
349
|
-
googleLogin: 'Entrar com o Google'
|
|
441
|
+
googleLogin: 'Entrar com o Google',
|
|
442
|
+
emailLabel: 'E-mail',
|
|
443
|
+
passwordLabel: 'Senha',
|
|
444
|
+
emailPlaceholder: 'Digite seu e-mail',
|
|
445
|
+
passwordPlaceholder: 'Digite sua senha',
|
|
446
|
+
forgotPassword: 'Esqueceu sua senha?',
|
|
447
|
+
loginButton: 'Entrar',
|
|
448
|
+
emailRequired: 'Por favor, insira seu e-mail!',
|
|
449
|
+
emailInvalid: 'Por favor, insira um e-mail válido!',
|
|
450
|
+
passwordRequired: 'Por favor, insira sua senha!',
|
|
451
|
+
separator: 'ou',
|
|
452
|
+
errorTitle: 'Erro ao autenticar',
|
|
453
|
+
genericError: 'Ocorreu um erro. Por favor, tente novamente.',
|
|
454
|
+
invalidPassword: 'A senha está incorreta.',
|
|
455
|
+
invalidEmailOrPassword: 'O e-mail ou senha estão incorretos.',
|
|
456
|
+
userDisabled: 'Sua conta foi desativada. Por favor, entre em contato com o suporte.',
|
|
457
|
+
authenticationFailed: 'Autenticação falhou'
|
|
458
|
+
},
|
|
459
|
+
ForgotPassword: {
|
|
460
|
+
title: 'Redefinição de senha',
|
|
461
|
+
instructions: 'Informe seu e-mail para receber as instruções de recuperação de senha.',
|
|
462
|
+
emailRequired: 'Por favor, insira seu e-mail!',
|
|
463
|
+
emailInvalid: 'Por favor, insira um e-mail válido!',
|
|
464
|
+
emailPlaceholder: 'E-mail',
|
|
465
|
+
submitButton: 'Recuperar senha',
|
|
466
|
+
backToLogin: 'Voltar para o login',
|
|
467
|
+
resetSuccessMessage: 'Se o endereço informado estiver correto, enviaremos um e-mail com instruções para redefinição de senha.'
|
|
468
|
+
},
|
|
469
|
+
ChangePassword: {
|
|
470
|
+
title: 'Alterar senha',
|
|
471
|
+
passwordInstructions: 'Defina uma nova senha para realizar seu login.',
|
|
472
|
+
newPassword: 'Nova senha',
|
|
473
|
+
confirmPassword: 'Confirmar senha',
|
|
474
|
+
submit: 'Enviar',
|
|
475
|
+
backToLogin: 'Voltar para o login',
|
|
476
|
+
passwordRequired: 'Por favor, insira sua nova senha!',
|
|
477
|
+
passwordLength: '8 caracteres',
|
|
478
|
+
passwordUpperCase: 'uma letra maiúscula',
|
|
479
|
+
passwordLowerCase: 'uma letra minúscula',
|
|
480
|
+
passwordNumbers: 'um número',
|
|
481
|
+
passwordSpecialChars: 'um caractere especial (!@#$%^&*)',
|
|
482
|
+
passwordWeak: 'Senha fraca: Deve ter pelo menos {requirements}',
|
|
483
|
+
passwordsNotMatch: 'As senhas digitadas não coincidem!',
|
|
484
|
+
tokenInvalidTitle: 'Token inválido',
|
|
485
|
+
tokenInvalidOrExpired: 'O token informado é inválido ou está expirado. Inicie o processo de recuperação de senha e tente novamente.',
|
|
486
|
+
passwordChangedSuccess: 'A senha foi alterada com sucesso. Você será redirecionado ao login após fechar essa janela.',
|
|
487
|
+
tokenInvalidRecovery: 'O token informado é inválido ou está expirado. Inicie o processo de recuperação de senha novamente.'
|
|
350
488
|
},
|
|
351
489
|
LoginContainer: {
|
|
352
490
|
theme: 'Tema',
|
|
@@ -360,6 +498,12 @@ var __webpack_exports__ = {};
|
|
|
360
498
|
},
|
|
361
499
|
ListCard: {
|
|
362
500
|
clearFilters: 'Limpar filtros'
|
|
501
|
+
},
|
|
502
|
+
Common: {
|
|
503
|
+
ok: 'Ok',
|
|
504
|
+
close: 'Fechar',
|
|
505
|
+
invalidEmail: 'O e-mail é inválido ou não está registrado.',
|
|
506
|
+
recaptchaFailed: 'Validação reCAPTCHA falhou. Por favor, tente novamente.'
|
|
363
507
|
}
|
|
364
508
|
}
|
|
365
509
|
};
|
|
@@ -395,7 +539,52 @@ var __webpack_exports__ = {};
|
|
|
395
539
|
},
|
|
396
540
|
Login: {
|
|
397
541
|
loginTitle: 'Login',
|
|
398
|
-
googleLogin: 'Login with Google'
|
|
542
|
+
googleLogin: 'Login with Google',
|
|
543
|
+
emailLabel: 'Email',
|
|
544
|
+
passwordLabel: 'Password',
|
|
545
|
+
emailPlaceholder: 'Enter your email',
|
|
546
|
+
passwordPlaceholder: 'Enter your password',
|
|
547
|
+
forgotPassword: 'Forgot password?',
|
|
548
|
+
loginButton: 'Login',
|
|
549
|
+
emailRequired: 'Please enter your email!',
|
|
550
|
+
emailInvalid: 'Please enter a valid email!',
|
|
551
|
+
passwordRequired: 'Please enter your password!',
|
|
552
|
+
separator: 'or',
|
|
553
|
+
errorTitle: 'Login Error',
|
|
554
|
+
invalidPassword: 'The password is incorrect.',
|
|
555
|
+
invalidEmailOrPassword: 'The email or password is incorrect.',
|
|
556
|
+
authenticationFailed: 'Authentication failed',
|
|
557
|
+
userDisabled: 'Your account has been disabled. Please contact support.'
|
|
558
|
+
},
|
|
559
|
+
ForgotPassword: {
|
|
560
|
+
title: 'Password reset',
|
|
561
|
+
instructions: 'Enter your email to receive password reset instructions.',
|
|
562
|
+
emailRequired: 'Please enter your email!',
|
|
563
|
+
emailInvalid: 'Please enter a valid email!',
|
|
564
|
+
emailPlaceholder: 'Email',
|
|
565
|
+
submitButton: 'Reset password',
|
|
566
|
+
backToLogin: 'Back to login',
|
|
567
|
+
resetSuccessMessage: 'If the provided email is correct, we will send you an email with instructions to reset your password.'
|
|
568
|
+
},
|
|
569
|
+
ChangePassword: {
|
|
570
|
+
title: 'Change password',
|
|
571
|
+
passwordInstructions: 'Set a new password to log in.',
|
|
572
|
+
newPassword: 'New password',
|
|
573
|
+
confirmPassword: 'Confirm password',
|
|
574
|
+
submit: 'Send',
|
|
575
|
+
backToLogin: 'Back to login',
|
|
576
|
+
passwordRequired: 'Please enter your new password!',
|
|
577
|
+
passwordLength: '8 characters',
|
|
578
|
+
passwordUpperCase: 'an uppercase letter',
|
|
579
|
+
passwordLowerCase: 'a lowercase letter',
|
|
580
|
+
passwordNumbers: 'a number',
|
|
581
|
+
passwordSpecialChars: 'a special character (!@#$%^&*)',
|
|
582
|
+
passwordWeak: 'Weak password: Must have at least {requirements}',
|
|
583
|
+
passwordsNotMatch: 'The passwords do not match!',
|
|
584
|
+
tokenInvalidTitle: 'Invalid Token',
|
|
585
|
+
tokenInvalidOrExpired: 'The provided token is invalid or expired. Start the password recovery process and try again.',
|
|
586
|
+
passwordChangedSuccess: 'Your password has been changed successfully. You will be redirected to the login after closing this window.',
|
|
587
|
+
tokenInvalidRecovery: 'The provided token is invalid or expired. Start the password recovery process again.'
|
|
399
588
|
},
|
|
400
589
|
LoginContainer: {
|
|
401
590
|
theme: 'Theme',
|
|
@@ -409,99 +598,398 @@ var __webpack_exports__ = {};
|
|
|
409
598
|
},
|
|
410
599
|
ListCard: {
|
|
411
600
|
clearFilters: 'Clear filters'
|
|
601
|
+
},
|
|
602
|
+
Common: {
|
|
603
|
+
ok: 'Ok',
|
|
604
|
+
close: 'Close',
|
|
605
|
+
genericError: 'An error occurred. Please try again.',
|
|
606
|
+
invalidEmail: 'The email address is invalid or not registered.',
|
|
607
|
+
recaptchaFailed: 'reCAPTCHA validation failed. Please try again.'
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
};
|
|
611
|
+
const i18nLib = external_i18next_namespaceObject.createInstance();
|
|
612
|
+
i18nLib.use(external_react_i18next_namespaceObject.initReactI18next).init({
|
|
613
|
+
resources: {
|
|
614
|
+
pt: pt,
|
|
615
|
+
en: en
|
|
616
|
+
},
|
|
617
|
+
lng: 'pt',
|
|
618
|
+
fallbackLng: 'pt',
|
|
619
|
+
defaultNS: 'codebitWebAntd',
|
|
620
|
+
ns: [
|
|
621
|
+
'codebitWebAntd'
|
|
622
|
+
],
|
|
623
|
+
interpolation: {
|
|
624
|
+
escapeValue: false
|
|
625
|
+
}
|
|
626
|
+
});
|
|
627
|
+
const i18n = i18nLib;
|
|
628
|
+
const useCodebitWebAntdTranslation = ()=>(0, external_react_i18next_namespaceObject.useTranslation)('codebitWebAntd', {
|
|
629
|
+
i18n: i18n
|
|
630
|
+
});
|
|
631
|
+
const ErrorRetry_logger = new codebit_web_namespaceObject.Logger('ErrorRetry');
|
|
632
|
+
function ErrorRetry({ error, onRetry }) {
|
|
633
|
+
const { t } = useCodebitWebAntdTranslation();
|
|
634
|
+
if (error && error instanceof Error) {
|
|
635
|
+
ErrorRetry_logger.error('Fail to load.', error);
|
|
636
|
+
react_namespaceObject.captureException(error);
|
|
637
|
+
}
|
|
638
|
+
const responseStatus = error?.response?.status || null;
|
|
639
|
+
let errorMessage = t('ErrorRetry.defaultError');
|
|
640
|
+
let retryText = t('ErrorRetry.retryButton');
|
|
641
|
+
let status = 'error';
|
|
642
|
+
if (error?.errorCode) switch(error.errorCode){
|
|
643
|
+
case codebit_web_namespaceObject.ErrorCode.ERR_NETWORK:
|
|
644
|
+
errorMessage = t('ErrorRetry.networkError');
|
|
645
|
+
break;
|
|
646
|
+
case codebit_web_namespaceObject.ErrorCode.ERR_TIMEOUT:
|
|
647
|
+
errorMessage = t('ErrorRetry.timeoutError');
|
|
648
|
+
break;
|
|
649
|
+
}
|
|
650
|
+
else if (responseStatus) switch(responseStatus){
|
|
651
|
+
case 400:
|
|
652
|
+
errorMessage = t('ErrorRetry.badRequestError');
|
|
653
|
+
break;
|
|
654
|
+
case 403:
|
|
655
|
+
errorMessage = t('ErrorRetry.forbiddenError');
|
|
656
|
+
retryText = t('ErrorRetry.reloadPageButton');
|
|
657
|
+
onRetry = ()=>{
|
|
658
|
+
globalThis.location.reload();
|
|
659
|
+
};
|
|
660
|
+
status = 403;
|
|
661
|
+
break;
|
|
662
|
+
case 404:
|
|
663
|
+
errorMessage = t('ErrorRetry.notFoundError');
|
|
664
|
+
status = 404;
|
|
665
|
+
break;
|
|
666
|
+
case 500:
|
|
667
|
+
errorMessage = t('ErrorRetry.internalServerError');
|
|
668
|
+
status = 500;
|
|
669
|
+
break;
|
|
670
|
+
case 401:
|
|
671
|
+
errorMessage = t('ErrorRetry.sessionExpiredError');
|
|
672
|
+
retryText = t('ErrorRetry.reloadPageButton');
|
|
673
|
+
onRetry = ()=>{
|
|
674
|
+
globalThis.location.reload();
|
|
675
|
+
};
|
|
676
|
+
break;
|
|
677
|
+
}
|
|
678
|
+
return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Card, {
|
|
679
|
+
children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Result, {
|
|
680
|
+
status: status,
|
|
681
|
+
title: errorMessage,
|
|
682
|
+
extra: [
|
|
683
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
|
|
684
|
+
type: 'primary',
|
|
685
|
+
onClick: onRetry,
|
|
686
|
+
icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.ReloadOutlined, {}),
|
|
687
|
+
children: retryText
|
|
688
|
+
}, 'retry')
|
|
689
|
+
]
|
|
690
|
+
})
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
ErrorRetry.propTypes = {
|
|
694
|
+
error: external_prop_types_default().object.isRequired,
|
|
695
|
+
onRetry: external_prop_types_default().func.isRequired
|
|
696
|
+
};
|
|
697
|
+
const ListCard_module = {
|
|
698
|
+
listCard: "listCard-ISftFd",
|
|
699
|
+
headerRow: "headerRow-UsZAzP",
|
|
700
|
+
actions: "actions-ig53s2",
|
|
701
|
+
filtersRow: "filtersRow-f3Xk5a",
|
|
702
|
+
expandArea: "expandArea-czOoFS"
|
|
703
|
+
};
|
|
704
|
+
const { Title } = external_antd_namespaceObject.Typography;
|
|
705
|
+
function ListCard({ title, onClearFilters, headerContainer, tableContainer, actions }) {
|
|
706
|
+
const { token } = external_antd_namespaceObject.theme.useToken();
|
|
707
|
+
const { t } = (0, external_react_i18next_namespaceObject.useTranslation)('codebitWebAntd');
|
|
708
|
+
const margin = token['margin'];
|
|
709
|
+
return /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Card, {
|
|
710
|
+
className: ListCard_module.listCard,
|
|
711
|
+
children: [
|
|
712
|
+
/*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Row, {
|
|
713
|
+
gutter: margin,
|
|
714
|
+
align: 'middle',
|
|
715
|
+
className: ListCard_module.headerRow,
|
|
716
|
+
children: [
|
|
717
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Col, {
|
|
718
|
+
xs: 24,
|
|
719
|
+
sm: 24,
|
|
720
|
+
md: 12,
|
|
721
|
+
children: /*#__PURE__*/ (0, jsx_runtime.jsx)(Title, {
|
|
722
|
+
level: 4,
|
|
723
|
+
children: title
|
|
724
|
+
})
|
|
725
|
+
}),
|
|
726
|
+
(!!onClearFilters || !!actions) && /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Col, {
|
|
727
|
+
xs: 24,
|
|
728
|
+
sm: 24,
|
|
729
|
+
md: 12,
|
|
730
|
+
className: ListCard_module.actions,
|
|
731
|
+
children: [
|
|
732
|
+
!!onClearFilters && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
|
|
733
|
+
icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.ClearOutlined, {}),
|
|
734
|
+
onClick: onClearFilters,
|
|
735
|
+
children: t('ListCard.clearFilters')
|
|
736
|
+
}),
|
|
737
|
+
actions
|
|
738
|
+
]
|
|
739
|
+
})
|
|
740
|
+
]
|
|
741
|
+
}),
|
|
742
|
+
!!headerContainer && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Row, {
|
|
743
|
+
gutter: margin,
|
|
744
|
+
className: ListCard_module.filtersRow,
|
|
745
|
+
children: headerContainer
|
|
746
|
+
}),
|
|
747
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Layout, {
|
|
748
|
+
className: ListCard_module.expandArea,
|
|
749
|
+
children: tableContainer
|
|
750
|
+
})
|
|
751
|
+
]
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
ListCard.propTypes = {
|
|
755
|
+
title: external_prop_types_default().string.isRequired,
|
|
756
|
+
onClearFilters: external_prop_types_default().func,
|
|
757
|
+
headerContainer: external_prop_types_default().node,
|
|
758
|
+
tableContainer: external_prop_types_default().node,
|
|
759
|
+
actions: external_prop_types_default().node
|
|
760
|
+
};
|
|
761
|
+
ListCard.defaultProps = {
|
|
762
|
+
onClearFilters: null,
|
|
763
|
+
headerContainer: null,
|
|
764
|
+
tableContainer: null,
|
|
765
|
+
actions: null
|
|
766
|
+
};
|
|
767
|
+
const CssTokenBridge = ()=>{
|
|
768
|
+
const { token } = external_antd_namespaceObject.theme.useToken();
|
|
769
|
+
(0, external_react_.useLayoutEffect)(()=>{
|
|
770
|
+
const root = document.documentElement;
|
|
771
|
+
root.style.setProperty('--antd-color-bg-container', token['colorBgContainer']);
|
|
772
|
+
root.style.setProperty('--antd-color-bg-elevated', token['colorBgElevated']);
|
|
773
|
+
root.style.setProperty('--antd-color-bg-layout', token['colorBgLayout']);
|
|
774
|
+
root.style.setProperty('--antd-color-border', token['colorBorder']);
|
|
775
|
+
root.style.setProperty('--antd-color-primary', token['colorPrimary']);
|
|
776
|
+
root.style.setProperty('--antd-color-text', token['colorText']);
|
|
777
|
+
root.style.setProperty('--antd-color-text-secondary', token['colorTextSecondary']);
|
|
778
|
+
root.style.setProperty('--antd-color-split', token['colorSplit']);
|
|
779
|
+
root.style.setProperty('--antd-margin-xxs', `${token['marginXXS']}px`);
|
|
780
|
+
root.style.setProperty('--antd-margin-xs', `${token['marginXS']}px`);
|
|
781
|
+
root.style.setProperty('--antd-margin-sm', `${token['marginSM']}px`);
|
|
782
|
+
root.style.setProperty('--antd-margin', `${token['margin']}px`);
|
|
783
|
+
root.style.setProperty('--antd-margin-md', `${token['marginMD']}px`);
|
|
784
|
+
root.style.setProperty('--antd-margin-lg', `${token['marginLG']}px`);
|
|
785
|
+
root.style.setProperty('--antd-margin-xl', `${token['marginXL']}px`);
|
|
786
|
+
root.style.setProperty('--antd-margin-xxl', `${token['marginXXL']}px`);
|
|
787
|
+
root.style.setProperty('--antd-padding-xxs', `${token['paddingXXS']}px`);
|
|
788
|
+
root.style.setProperty('--antd-padding-xs', `${token['paddingXS']}px`);
|
|
789
|
+
root.style.setProperty('--antd-padding-sm', `${token['paddingSM']}px`);
|
|
790
|
+
root.style.setProperty('--antd-padding', `${token['padding']}px`);
|
|
791
|
+
root.style.setProperty('--antd-padding-md', `${token['paddingMD']}px`);
|
|
792
|
+
root.style.setProperty('--antd-padding-lg', `${token['paddingLG']}px`);
|
|
793
|
+
root.style.setProperty('--antd-padding-xl', `${token['paddingXL']}px`);
|
|
794
|
+
root.style.setProperty('--antd-font-size-xxs', '8px');
|
|
795
|
+
root.style.setProperty('--antd-font-size-xs', '10px');
|
|
796
|
+
root.style.setProperty('--antd-font-size-sm', `${token['fontSizeSM']}px`);
|
|
797
|
+
root.style.setProperty('--antd-font-size', `${token['fontSize']}px`);
|
|
798
|
+
root.style.setProperty('--antd-font-size-lg', `${token['fontSizeLG']}px`);
|
|
799
|
+
root.style.setProperty('--antd-font-size-xl', `${token['fontSizeXL']}px`);
|
|
800
|
+
root.style.setProperty('--antd-font-size-xxl', `${token['fontSizeXXL']}px`);
|
|
801
|
+
root.style.setProperty('--antd-font-size-heading1', `${token['fontSizeHeading1']}px`);
|
|
802
|
+
root.style.setProperty('--antd-font-size-heading2', `${token['fontSizeHeading2']}px`);
|
|
803
|
+
root.style.setProperty('--antd-font-size-heading3', `${token['fontSizeHeading3']}px`);
|
|
804
|
+
root.style.setProperty('--antd-font-size-heading4', `${token['fontSizeHeading4']}px`);
|
|
805
|
+
root.style.setProperty('--antd-font-size-heading5', `${token['fontSizeHeading5']}px`);
|
|
806
|
+
root.style.setProperty('--antd-line-height', token['lineHeight']);
|
|
807
|
+
root.style.setProperty('--antd-line-height-lg', token['lineHeightLG']);
|
|
808
|
+
root.style.setProperty('--antd-control-height-sm', `${token['controlHeightSM']}px`);
|
|
809
|
+
root.style.setProperty('--antd-control-height', `${token['controlHeight']}px`);
|
|
810
|
+
root.style.setProperty('--antd-control-height-lg', `${token['controlHeightLG']}px`);
|
|
811
|
+
root.style.setProperty('--antd-border-radius-sm', `${token['borderRadiusSM']}px`);
|
|
812
|
+
root.style.setProperty('--antd-border-radius', `${token['borderRadius']}px`);
|
|
813
|
+
root.style.setProperty('--antd-border-radius-lg', `${token['borderRadiusLG']}px`);
|
|
814
|
+
}, [
|
|
815
|
+
token
|
|
816
|
+
]);
|
|
817
|
+
return null;
|
|
818
|
+
};
|
|
819
|
+
const TableContainer_module = {
|
|
820
|
+
tableContainer: "tableContainer-EhNwOm"
|
|
821
|
+
};
|
|
822
|
+
function isPaginationNode(node) {
|
|
823
|
+
if (node.nodeType !== Node.ELEMENT_NODE) return false;
|
|
824
|
+
const element = node;
|
|
825
|
+
return element.classList?.contains('ant-table-pagination') || element.querySelector?.('.ant-table-pagination');
|
|
826
|
+
}
|
|
827
|
+
function hasPaginationInMutation(mutation) {
|
|
828
|
+
return Array.from(mutation.addedNodes).some(isPaginationNode);
|
|
829
|
+
}
|
|
830
|
+
function TableContainer({ children }) {
|
|
831
|
+
const containerRef = (0, external_react_.useRef)(null);
|
|
832
|
+
const containerHeightRef = (0, external_react_.useRef)(null);
|
|
833
|
+
const [scrollY, setScrollY] = (0, external_react_.useState)(void 0);
|
|
834
|
+
(0, external_react_.useLayoutEffect)(()=>{
|
|
835
|
+
const calculateHeights = ()=>{
|
|
836
|
+
if (!containerRef.current) return;
|
|
837
|
+
containerHeightRef.current = containerRef.current.offsetHeight;
|
|
838
|
+
const thead = containerRef.current.querySelector('thead');
|
|
839
|
+
let theadHeight = 0;
|
|
840
|
+
if (thead) {
|
|
841
|
+
const rect = thead.getBoundingClientRect();
|
|
842
|
+
const styles = globalThis.getComputedStyle(thead);
|
|
843
|
+
const marginTop = Number.parseFloat(styles.marginTop) || 0;
|
|
844
|
+
const marginBottom = Number.parseFloat(styles.marginBottom) || 0;
|
|
845
|
+
theadHeight = rect.height + marginTop + marginBottom;
|
|
846
|
+
}
|
|
847
|
+
const pagination = containerRef.current.querySelector('.ant-table-pagination');
|
|
848
|
+
let paginationHeight = 0;
|
|
849
|
+
if (pagination) {
|
|
850
|
+
const rect = pagination.getBoundingClientRect();
|
|
851
|
+
const styles = globalThis.getComputedStyle(pagination);
|
|
852
|
+
const marginTop = Number.parseFloat(styles.marginTop) || 0;
|
|
853
|
+
const marginBottom = Number.parseFloat(styles.marginBottom) || 0;
|
|
854
|
+
paginationHeight = rect.height + marginTop + marginBottom;
|
|
855
|
+
}
|
|
856
|
+
const availableHeight = Math.ceil(containerHeightRef.current) - Math.ceil(theadHeight) - Math.ceil(paginationHeight) - 1;
|
|
857
|
+
setScrollY(availableHeight);
|
|
858
|
+
};
|
|
859
|
+
calculateHeights();
|
|
860
|
+
const observer = new MutationObserver((mutations)=>{
|
|
861
|
+
const hasPagination = mutations.some(hasPaginationInMutation);
|
|
862
|
+
if (hasPagination) calculateHeights();
|
|
863
|
+
});
|
|
864
|
+
if (containerRef.current) observer.observe(containerRef.current, {
|
|
865
|
+
childList: true,
|
|
866
|
+
subtree: true
|
|
867
|
+
});
|
|
868
|
+
globalThis.addEventListener('resize', calculateHeights);
|
|
869
|
+
return ()=>{
|
|
870
|
+
observer.disconnect();
|
|
871
|
+
globalThis.removeEventListener('resize', calculateHeights);
|
|
872
|
+
};
|
|
873
|
+
}, []);
|
|
874
|
+
const enhancedChildren = scrollY ? /*#__PURE__*/ (0, external_react_.cloneElement)(children, {
|
|
875
|
+
scroll: {
|
|
876
|
+
...children.props?.scroll,
|
|
877
|
+
y: scrollY,
|
|
878
|
+
x: 'max-content'
|
|
412
879
|
}
|
|
413
|
-
}
|
|
880
|
+
}) : children;
|
|
881
|
+
return /*#__PURE__*/ (0, jsx_runtime.jsx)("div", {
|
|
882
|
+
ref: containerRef,
|
|
883
|
+
className: TableContainer_module.tableContainer,
|
|
884
|
+
children: enhancedChildren
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
TableContainer.propTypes = {
|
|
888
|
+
children: external_prop_types_default().element.isRequired
|
|
414
889
|
};
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
'codebitWebAntd'
|
|
426
|
-
],
|
|
427
|
-
interpolation: {
|
|
428
|
-
escapeValue: false
|
|
429
|
-
}
|
|
430
|
-
});
|
|
431
|
-
const i18n = i18nLib;
|
|
432
|
-
const CodebitConfigContext = /*#__PURE__*/ (0, external_react_.createContext)(null);
|
|
433
|
-
function CodebitConfigProvider({ children, menuItems, user, onLogout, toggleTheme, isDarkMode, oauthCallbackUrl, version = '1.0', showVersion = true, secondarySidebar, secondarySidebarWidth = 280 }) {
|
|
434
|
-
const contextValue = (0, external_react_.useMemo)(()=>({
|
|
435
|
-
menuItems,
|
|
436
|
-
user,
|
|
437
|
-
onLogout,
|
|
438
|
-
toggleTheme,
|
|
439
|
-
isDarkMode,
|
|
440
|
-
oauthCallbackUrl,
|
|
441
|
-
version,
|
|
442
|
-
showVersion,
|
|
443
|
-
i18n: i18n,
|
|
444
|
-
secondarySidebar,
|
|
445
|
-
secondarySidebarWidth
|
|
446
|
-
}), [
|
|
447
|
-
menuItems,
|
|
448
|
-
user,
|
|
449
|
-
onLogout,
|
|
450
|
-
toggleTheme,
|
|
451
|
-
isDarkMode,
|
|
452
|
-
version,
|
|
453
|
-
showVersion,
|
|
454
|
-
oauthCallbackUrl,
|
|
455
|
-
secondarySidebar,
|
|
456
|
-
secondarySidebarWidth
|
|
457
|
-
]);
|
|
458
|
-
return /*#__PURE__*/ (0, jsx_runtime.jsxs)(CodebitConfigContext.Provider, {
|
|
459
|
-
value: contextValue,
|
|
460
|
-
children: [
|
|
461
|
-
/*#__PURE__*/ (0, jsx_runtime.jsx)(CssTokenBridge, {}),
|
|
462
|
-
children
|
|
463
|
-
]
|
|
890
|
+
function FilterContainer({ children, ...props }) {
|
|
891
|
+
const { token } = external_antd_namespaceObject.theme.useToken();
|
|
892
|
+
return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Card, {
|
|
893
|
+
styles: {
|
|
894
|
+
body: {
|
|
895
|
+
padding: token['paddingXS'] + 'px'
|
|
896
|
+
}
|
|
897
|
+
},
|
|
898
|
+
...props,
|
|
899
|
+
children: children
|
|
464
900
|
});
|
|
465
901
|
}
|
|
466
|
-
|
|
902
|
+
FilterContainer.propTypes = {
|
|
467
903
|
children: external_prop_types_default().node.isRequired,
|
|
468
|
-
|
|
469
|
-
key: external_prop_types_default().string.isRequired,
|
|
470
|
-
icon: external_prop_types_default().node,
|
|
471
|
-
label: external_prop_types_default().string.isRequired,
|
|
472
|
-
roles: external_prop_types_default().arrayOf(external_prop_types_default().string)
|
|
473
|
-
})).isRequired,
|
|
474
|
-
user: external_prop_types_default().shape({
|
|
475
|
-
name: external_prop_types_default().string.isRequired,
|
|
476
|
-
email: external_prop_types_default().string.isRequired,
|
|
477
|
-
id: external_prop_types_default().string.isRequired,
|
|
478
|
-
roles: external_prop_types_default().arrayOf(external_prop_types_default().string).isRequired
|
|
479
|
-
}).isRequired,
|
|
480
|
-
onLogout: external_prop_types_default().func.isRequired,
|
|
481
|
-
version: external_prop_types_default().string,
|
|
482
|
-
showVersion: external_prop_types_default().bool,
|
|
483
|
-
toggleTheme: external_prop_types_default().func.isRequired,
|
|
484
|
-
isDarkMode: external_prop_types_default().bool.isRequired,
|
|
485
|
-
oauthCallbackUrl: external_prop_types_default().string.isRequired,
|
|
486
|
-
secondarySidebar: external_prop_types_default().node,
|
|
487
|
-
secondarySidebarWidth: external_prop_types_default().number
|
|
904
|
+
...external_antd_namespaceObject.Card.propTypes
|
|
488
905
|
};
|
|
489
|
-
const
|
|
490
|
-
|
|
491
|
-
|
|
906
|
+
const CodebitThemeContext = /*#__PURE__*/ (0, external_react_.createContext)(null);
|
|
907
|
+
const CodebitThemeProvider = ({ children, storeThemeInLocalStorage = true, ...props })=>{
|
|
908
|
+
const hasLoaded = (0, external_react_.useRef)(false);
|
|
909
|
+
const [isDarkMode, setIsDarkMode] = (0, external_react_.useState)(()=>{
|
|
910
|
+
try {
|
|
911
|
+
if (storeThemeInLocalStorage) {
|
|
912
|
+
const savedTheme = localStorage?.getItem('theme');
|
|
913
|
+
if (null !== savedTheme) return 'dark' === savedTheme;
|
|
914
|
+
}
|
|
915
|
+
return globalThis.matchMedia?.('(prefers-color-scheme: dark)')?.matches ?? false;
|
|
916
|
+
} finally{
|
|
917
|
+
hasLoaded.current = true;
|
|
918
|
+
}
|
|
919
|
+
});
|
|
920
|
+
const toggleTheme = ()=>{
|
|
921
|
+
setIsDarkMode((prev)=>!prev);
|
|
922
|
+
};
|
|
492
923
|
(0, external_react_.useEffect)(()=>{
|
|
493
|
-
|
|
924
|
+
const rootElement = document.getElementById('root');
|
|
925
|
+
if (isDarkMode) {
|
|
926
|
+
document.body.classList.add('dark-theme');
|
|
927
|
+
rootElement.classList.add('dark-theme');
|
|
928
|
+
} else {
|
|
929
|
+
document.body.classList.remove('dark-theme');
|
|
930
|
+
rootElement.classList.remove('dark-theme');
|
|
931
|
+
}
|
|
932
|
+
document.documentElement.style.setProperty('--color-primary', isDarkMode ? '#589C75' : '#29D266');
|
|
494
933
|
}, [
|
|
495
|
-
|
|
934
|
+
isDarkMode
|
|
496
935
|
]);
|
|
497
|
-
|
|
498
|
-
theme
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
936
|
+
(0, external_react_.useEffect)(()=>{
|
|
937
|
+
if (hasLoaded.current && storeThemeInLocalStorage) localStorage.setItem('theme', isDarkMode ? 'dark' : 'light');
|
|
938
|
+
}, [
|
|
939
|
+
isDarkMode,
|
|
940
|
+
storeThemeInLocalStorage
|
|
941
|
+
]);
|
|
942
|
+
const themeContextValue = (0, external_react_.useMemo)(()=>({
|
|
943
|
+
isDarkMode,
|
|
944
|
+
toggleTheme,
|
|
945
|
+
setIsDarkMode
|
|
946
|
+
}), [
|
|
947
|
+
isDarkMode
|
|
948
|
+
]);
|
|
949
|
+
return /*#__PURE__*/ (0, jsx_runtime.jsx)(CodebitThemeContext.Provider, {
|
|
950
|
+
value: themeContextValue,
|
|
951
|
+
children: /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.ConfigProvider, {
|
|
952
|
+
theme: {
|
|
953
|
+
algorithm: isDarkMode ? external_antd_namespaceObject.theme.darkAlgorithm : external_antd_namespaceObject.theme.defaultAlgorithm,
|
|
954
|
+
token: {
|
|
955
|
+
colorPrimary: isDarkMode ? '#589C75' : '#29D266',
|
|
956
|
+
colorInfo: isDarkMode ? '#589C75' : '#29D266',
|
|
957
|
+
colorLink: isDarkMode ? '#589C75' : '#29D266'
|
|
958
|
+
},
|
|
959
|
+
components: {
|
|
960
|
+
Menu: {
|
|
961
|
+
itemSelectedBg: isDarkMode ? '#589C75' : '#29D266',
|
|
962
|
+
itemSelectedColor: '#FAFAFA',
|
|
963
|
+
darkItemSelectedBg: isDarkMode ? '#589C75' : '#29D266',
|
|
964
|
+
darkItemSelectedColor: '#FAFAFA'
|
|
965
|
+
},
|
|
966
|
+
Button: {
|
|
967
|
+
colorPrimary: isDarkMode ? '#589C75' : '#29D266',
|
|
968
|
+
colorPrimaryHover: isDarkMode ? '#6DB589' : '#3FE67F',
|
|
969
|
+
colorPrimaryActive: isDarkMode ? '#4A8361' : '#1FBF4D'
|
|
970
|
+
},
|
|
971
|
+
Layout: {
|
|
972
|
+
siderBg: isDarkMode ? '#1a1a1a' : '#001529',
|
|
973
|
+
triggerBg: isDarkMode ? '#589C75' : '#29D266',
|
|
974
|
+
triggerColor: '#FAFAFA'
|
|
975
|
+
},
|
|
976
|
+
Header: {
|
|
977
|
+
colorPrimary: isDarkMode ? '#589C75' : '#29D266'
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
},
|
|
981
|
+
...props,
|
|
982
|
+
children: [
|
|
983
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(CssTokenBridge, {}),
|
|
984
|
+
children
|
|
985
|
+
]
|
|
986
|
+
})
|
|
503
987
|
});
|
|
504
988
|
};
|
|
989
|
+
CodebitThemeProvider.propTypes = {
|
|
990
|
+
children: external_prop_types_default().node.isRequired,
|
|
991
|
+
storeThemeInLocalStorage: external_prop_types_default().bool
|
|
992
|
+
};
|
|
505
993
|
const LoggedMainContainer_module = {
|
|
506
994
|
layout: "layout-mL5o6I",
|
|
507
995
|
drawer: "drawer-oj0mJX",
|
|
@@ -522,9 +1010,6 @@ var __webpack_exports__ = {};
|
|
|
522
1010
|
headerSpace: "headerSpace-Fd_iha",
|
|
523
1011
|
content: "content-OZHp2h"
|
|
524
1012
|
};
|
|
525
|
-
const useCodebitWebAntdTranslation = ()=>(0, external_react_i18next_namespaceObject.useTranslation)('codebitWebAntd', {
|
|
526
|
-
i18n: i18n
|
|
527
|
-
});
|
|
528
1013
|
const { Header, Sider, Content } = external_antd_namespaceObject.Layout;
|
|
529
1014
|
const { Text } = external_antd_namespaceObject.Typography;
|
|
530
1015
|
function LoggedMainContainer({ children }) {
|
|
@@ -535,11 +1020,13 @@ var __webpack_exports__ = {};
|
|
|
535
1020
|
const { t } = useCodebitWebAntdTranslation();
|
|
536
1021
|
const navigate = (0, external_react_router_namespaceObject.useNavigate)();
|
|
537
1022
|
const location = (0, external_react_router_namespaceObject.useLocation)();
|
|
538
|
-
const
|
|
539
|
-
|
|
540
|
-
|
|
1023
|
+
const configCodebit = (0, external_react_.useContext)(CodebitConfigContext);
|
|
1024
|
+
const configTheme = (0, external_react_.useContext)(CodebitThemeContext);
|
|
1025
|
+
if (!configCodebit || !configTheme) throw new Error('LoggedContainer must be used within CodebitConfigProvider and CodebitThemeContext');
|
|
1026
|
+
const { logout, user, menuItems, version, showVersion, secondarySidebar, secondarySidebarWidth = 280 } = configCodebit;
|
|
1027
|
+
const { isDarkMode } = configTheme;
|
|
541
1028
|
const systemTheme = isDarkMode ? 'dark' : 'light';
|
|
542
|
-
const filteredMenuItems = (0, external_react_.useMemo)(()=>menuItems.filter((item)=>{
|
|
1029
|
+
const filteredMenuItems = (0, external_react_.useMemo)(()=>menuItems(user).filter((item)=>{
|
|
543
1030
|
if (!item.roles) return true;
|
|
544
1031
|
if (!user || !user.roles) return false;
|
|
545
1032
|
if (item.roles) return item.roles.some((role)=>user.roles.includes(role));
|
|
@@ -557,7 +1044,7 @@ var __webpack_exports__ = {};
|
|
|
557
1044
|
return ()=>window.removeEventListener('resize', checkScreenSize);
|
|
558
1045
|
}, []);
|
|
559
1046
|
const handleLogout = async ()=>{
|
|
560
|
-
|
|
1047
|
+
await logout?.();
|
|
561
1048
|
if (isMobile) setDrawerVisible(false);
|
|
562
1049
|
navigate('/');
|
|
563
1050
|
};
|
|
@@ -588,7 +1075,7 @@ var __webpack_exports__ = {};
|
|
|
588
1075
|
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Layout.Content, {
|
|
589
1076
|
className: LoggedMainContainer_module.menuSpacer
|
|
590
1077
|
}),
|
|
591
|
-
showVersion && version && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Menu, {
|
|
1078
|
+
showVersion?.(user) && version && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Menu, {
|
|
592
1079
|
theme: systemTheme,
|
|
593
1080
|
mode: 'horizontal',
|
|
594
1081
|
className: LoggedMainContainer_module.versionMenu,
|
|
@@ -650,7 +1137,7 @@ var __webpack_exports__ = {};
|
|
|
650
1137
|
theme: systemTheme,
|
|
651
1138
|
width: secondarySidebarWidth,
|
|
652
1139
|
className: `${LoggedMainContainer_module.secondarySidebar} ${isDarkMode ? LoggedMainContainer_module.secondarySidebarDark : ''}`,
|
|
653
|
-
children: secondarySidebar
|
|
1140
|
+
children: secondarySidebar(user)
|
|
654
1141
|
}) : /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Drawer, {
|
|
655
1142
|
placement: 'right',
|
|
656
1143
|
onClose: ()=>setSecondarySidebarDrawerVisible(false),
|
|
@@ -659,320 +1146,52 @@ var __webpack_exports__ = {};
|
|
|
659
1146
|
className: LoggedMainContainer_module.drawer,
|
|
660
1147
|
title: null,
|
|
661
1148
|
closeIcon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.CloseOutlined, {}),
|
|
662
|
-
children: secondarySidebar
|
|
1149
|
+
children: secondarySidebar(user)
|
|
663
1150
|
}),
|
|
664
1151
|
/*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Layout, {
|
|
665
1152
|
children: [
|
|
666
1153
|
/*#__PURE__*/ (0, jsx_runtime.jsxs)(Header, {
|
|
667
|
-
className: `${LoggedMainContainer_module.header} ${isMobile ? LoggedMainContainer_module.mobile : ''}`,
|
|
668
|
-
children: [
|
|
669
|
-
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Space, {
|
|
670
|
-
children: isMobile ? /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
|
|
671
|
-
type: 'text',
|
|
672
|
-
icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuOutlined, {}),
|
|
673
|
-
onClick: ()=>setDrawerVisible(true)
|
|
674
|
-
}) : /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
|
|
675
|
-
type: 'text',
|
|
676
|
-
icon: collapsed ? /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuUnfoldOutlined, {}) : /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuFoldOutlined, {}),
|
|
677
|
-
onClick: ()=>setCollapsed(!collapsed)
|
|
678
|
-
})
|
|
679
|
-
}),
|
|
680
|
-
/*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Space, {
|
|
681
|
-
size: isMobile ? 'small' : 'middle',
|
|
682
|
-
className: `${LoggedMainContainer_module.headerSpace} ${isMobile ? LoggedMainContainer_module.mobile : ''}`,
|
|
683
|
-
children: [
|
|
684
|
-
secondarySidebar && isMobile && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
|
|
685
|
-
type: 'text',
|
|
686
|
-
icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuOutlined, {}),
|
|
687
|
-
onClick: ()=>setSecondarySidebarDrawerVisible(true)
|
|
688
|
-
}),
|
|
689
|
-
!isMobile && /*#__PURE__*/ (0, jsx_runtime.jsx)(Text, {
|
|
690
|
-
children: t('LoggedMainContainer.theme')
|
|
691
|
-
}),
|
|
692
|
-
/*#__PURE__*/ (0, jsx_runtime.jsx)(ThemeToggle, {})
|
|
693
|
-
]
|
|
694
|
-
})
|
|
695
|
-
]
|
|
696
|
-
}),
|
|
697
|
-
/*#__PURE__*/ (0, jsx_runtime.jsx)(Content, {
|
|
698
|
-
className: `${LoggedMainContainer_module.content} ${isMobile ? LoggedMainContainer_module.mobile : ''}`,
|
|
699
|
-
children: children
|
|
700
|
-
})
|
|
701
|
-
]
|
|
702
|
-
})
|
|
703
|
-
]
|
|
704
|
-
});
|
|
705
|
-
}
|
|
706
|
-
LoggedMainContainer.propTypes = {
|
|
707
|
-
children: external_prop_types_default().node.isRequired
|
|
708
|
-
};
|
|
709
|
-
const codebit_web_namespaceObject = require("@codebit-programando-solucoes/codebit-web");
|
|
710
|
-
const react_namespaceObject = require("@sentry/react");
|
|
711
|
-
function ErrorRetry({ error, onRetry }) {
|
|
712
|
-
const { t } = useCodebitWebAntdTranslation();
|
|
713
|
-
if (error && error instanceof Error) {
|
|
714
|
-
console.error('Fail to load.', error);
|
|
715
|
-
react_namespaceObject.captureException(error);
|
|
716
|
-
}
|
|
717
|
-
const responseStatus = error?.response?.status || null;
|
|
718
|
-
let errorMessage = t('ErrorRetry.defaultError');
|
|
719
|
-
let retryText = t('ErrorRetry.retryButton');
|
|
720
|
-
let status = 'error';
|
|
721
|
-
if (error?.errorCode) switch(error.errorCode){
|
|
722
|
-
case codebit_web_namespaceObject.ErrorCode.ERR_NETWORK:
|
|
723
|
-
errorMessage = t('ErrorRetry.networkError');
|
|
724
|
-
break;
|
|
725
|
-
case codebit_web_namespaceObject.ErrorCode.ERR_TIMEOUT:
|
|
726
|
-
errorMessage = t('ErrorRetry.timeoutError');
|
|
727
|
-
break;
|
|
728
|
-
}
|
|
729
|
-
else if (responseStatus) switch(responseStatus){
|
|
730
|
-
case 400:
|
|
731
|
-
errorMessage = t('ErrorRetry.badRequestError');
|
|
732
|
-
break;
|
|
733
|
-
case 403:
|
|
734
|
-
errorMessage = t('ErrorRetry.forbiddenError');
|
|
735
|
-
retryText = t('ErrorRetry.reloadPageButton');
|
|
736
|
-
onRetry = ()=>{
|
|
737
|
-
globalThis.location.reload();
|
|
738
|
-
};
|
|
739
|
-
status = 403;
|
|
740
|
-
break;
|
|
741
|
-
case 404:
|
|
742
|
-
errorMessage = t('ErrorRetry.notFoundError');
|
|
743
|
-
status = 404;
|
|
744
|
-
break;
|
|
745
|
-
case 500:
|
|
746
|
-
errorMessage = t('ErrorRetry.internalServerError');
|
|
747
|
-
status = 500;
|
|
748
|
-
break;
|
|
749
|
-
case 401:
|
|
750
|
-
errorMessage = t('ErrorRetry.sessionExpiredError');
|
|
751
|
-
retryText = t('ErrorRetry.reloadPageButton');
|
|
752
|
-
onRetry = ()=>{
|
|
753
|
-
globalThis.location.reload();
|
|
754
|
-
};
|
|
755
|
-
break;
|
|
756
|
-
}
|
|
757
|
-
return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Card, {
|
|
758
|
-
children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Result, {
|
|
759
|
-
status: status,
|
|
760
|
-
title: errorMessage,
|
|
761
|
-
extra: [
|
|
762
|
-
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
|
|
763
|
-
type: 'primary',
|
|
764
|
-
onClick: onRetry,
|
|
765
|
-
icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.ReloadOutlined, {}),
|
|
766
|
-
children: retryText
|
|
767
|
-
}, 'retry')
|
|
768
|
-
]
|
|
769
|
-
})
|
|
770
|
-
});
|
|
771
|
-
}
|
|
772
|
-
ErrorRetry.propTypes = {
|
|
773
|
-
error: external_prop_types_default().object.isRequired,
|
|
774
|
-
onRetry: external_prop_types_default().func.isRequired
|
|
775
|
-
};
|
|
776
|
-
const ListCard_module = {
|
|
777
|
-
listCard: "listCard-ISftFd",
|
|
778
|
-
headerRow: "headerRow-UsZAzP",
|
|
779
|
-
actions: "actions-ig53s2",
|
|
780
|
-
filtersRow: "filtersRow-f3Xk5a",
|
|
781
|
-
expandArea: "expandArea-czOoFS"
|
|
782
|
-
};
|
|
783
|
-
const { Title } = external_antd_namespaceObject.Typography;
|
|
784
|
-
function ListCard({ title, onClearFilters, headerContainer, tableContainer, actions }) {
|
|
785
|
-
const { token } = external_antd_namespaceObject.theme.useToken();
|
|
786
|
-
const { t } = (0, external_react_i18next_namespaceObject.useTranslation)('codebitWebAntd');
|
|
787
|
-
const margin = token['margin'];
|
|
788
|
-
return /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Card, {
|
|
789
|
-
className: ListCard_module.listCard,
|
|
790
|
-
children: [
|
|
791
|
-
/*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Row, {
|
|
792
|
-
gutter: margin,
|
|
793
|
-
align: 'middle',
|
|
794
|
-
className: ListCard_module.headerRow,
|
|
795
|
-
children: [
|
|
796
|
-
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Col, {
|
|
797
|
-
xs: 24,
|
|
798
|
-
sm: 24,
|
|
799
|
-
md: 12,
|
|
800
|
-
children: /*#__PURE__*/ (0, jsx_runtime.jsx)(Title, {
|
|
801
|
-
level: 4,
|
|
802
|
-
children: title
|
|
803
|
-
})
|
|
804
|
-
}),
|
|
805
|
-
(!!onClearFilters || !!actions) && /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Col, {
|
|
806
|
-
xs: 24,
|
|
807
|
-
sm: 24,
|
|
808
|
-
md: 12,
|
|
809
|
-
className: ListCard_module.actions,
|
|
1154
|
+
className: `${LoggedMainContainer_module.header} ${isMobile ? LoggedMainContainer_module.mobile : ''}`,
|
|
810
1155
|
children: [
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
1156
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Space, {
|
|
1157
|
+
children: isMobile ? /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
|
|
1158
|
+
type: 'text',
|
|
1159
|
+
icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuOutlined, {}),
|
|
1160
|
+
onClick: ()=>setDrawerVisible(true)
|
|
1161
|
+
}) : /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
|
|
1162
|
+
type: 'text',
|
|
1163
|
+
icon: collapsed ? /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuUnfoldOutlined, {}) : /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuFoldOutlined, {}),
|
|
1164
|
+
onClick: ()=>setCollapsed(!collapsed)
|
|
1165
|
+
})
|
|
815
1166
|
}),
|
|
816
|
-
|
|
1167
|
+
/*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Space, {
|
|
1168
|
+
size: isMobile ? 'small' : 'middle',
|
|
1169
|
+
className: `${LoggedMainContainer_module.headerSpace} ${isMobile ? LoggedMainContainer_module.mobile : ''}`,
|
|
1170
|
+
children: [
|
|
1171
|
+
secondarySidebar && isMobile && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
|
|
1172
|
+
type: 'text',
|
|
1173
|
+
icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MenuOutlined, {}),
|
|
1174
|
+
onClick: ()=>setSecondarySidebarDrawerVisible(true)
|
|
1175
|
+
}),
|
|
1176
|
+
!isMobile && /*#__PURE__*/ (0, jsx_runtime.jsx)(Text, {
|
|
1177
|
+
children: t('LoggedMainContainer.theme')
|
|
1178
|
+
}),
|
|
1179
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(ThemeToggle, {})
|
|
1180
|
+
]
|
|
1181
|
+
})
|
|
817
1182
|
]
|
|
1183
|
+
}),
|
|
1184
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(Content, {
|
|
1185
|
+
className: `${LoggedMainContainer_module.content} ${isMobile ? LoggedMainContainer_module.mobile : ''}`,
|
|
1186
|
+
children: children
|
|
818
1187
|
})
|
|
819
1188
|
]
|
|
820
|
-
}),
|
|
821
|
-
!!headerContainer && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Row, {
|
|
822
|
-
gutter: margin,
|
|
823
|
-
className: ListCard_module.filtersRow,
|
|
824
|
-
children: headerContainer
|
|
825
|
-
}),
|
|
826
|
-
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Layout, {
|
|
827
|
-
className: ListCard_module.expandArea,
|
|
828
|
-
children: tableContainer
|
|
829
1189
|
})
|
|
830
1190
|
]
|
|
831
1191
|
});
|
|
832
1192
|
}
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
onClearFilters: external_prop_types_default().func,
|
|
836
|
-
headerContainer: external_prop_types_default().node,
|
|
837
|
-
tableContainer: external_prop_types_default().node,
|
|
838
|
-
actions: external_prop_types_default().node
|
|
839
|
-
};
|
|
840
|
-
ListCard.defaultProps = {
|
|
841
|
-
onClearFilters: null,
|
|
842
|
-
headerContainer: null,
|
|
843
|
-
tableContainer: null,
|
|
844
|
-
actions: null
|
|
845
|
-
};
|
|
846
|
-
const CssTokenBridge = ()=>{
|
|
847
|
-
const { token } = external_antd_namespaceObject.theme.useToken();
|
|
848
|
-
(0, external_react_.useLayoutEffect)(()=>{
|
|
849
|
-
const root = document.documentElement;
|
|
850
|
-
root.style.setProperty('--antd-color-bg-container', token['colorBgContainer']);
|
|
851
|
-
root.style.setProperty('--antd-color-bg-elevated', token['colorBgElevated']);
|
|
852
|
-
root.style.setProperty('--antd-color-bg-layout', token['colorBgLayout']);
|
|
853
|
-
root.style.setProperty('--antd-color-border', token['colorBorder']);
|
|
854
|
-
root.style.setProperty('--antd-color-primary', token['colorPrimary']);
|
|
855
|
-
root.style.setProperty('--antd-color-text', token['colorText']);
|
|
856
|
-
root.style.setProperty('--antd-color-text-secondary', token['colorTextSecondary']);
|
|
857
|
-
root.style.setProperty('--antd-color-split', token['colorSplit']);
|
|
858
|
-
root.style.setProperty('--antd-margin-xxs', `${token['marginXXS']}px`);
|
|
859
|
-
root.style.setProperty('--antd-margin-xs', `${token['marginXS']}px`);
|
|
860
|
-
root.style.setProperty('--antd-margin-sm', `${token['marginSM']}px`);
|
|
861
|
-
root.style.setProperty('--antd-margin', `${token['margin']}px`);
|
|
862
|
-
root.style.setProperty('--antd-margin-md', `${token['marginMD']}px`);
|
|
863
|
-
root.style.setProperty('--antd-margin-lg', `${token['marginLG']}px`);
|
|
864
|
-
root.style.setProperty('--antd-margin-xl', `${token['marginXL']}px`);
|
|
865
|
-
root.style.setProperty('--antd-margin-xxl', `${token['marginXXL']}px`);
|
|
866
|
-
root.style.setProperty('--antd-padding-xxs', `${token['paddingXXS']}px`);
|
|
867
|
-
root.style.setProperty('--antd-padding-xs', `${token['paddingXS']}px`);
|
|
868
|
-
root.style.setProperty('--antd-padding-sm', `${token['paddingSM']}px`);
|
|
869
|
-
root.style.setProperty('--antd-padding', `${token['padding']}px`);
|
|
870
|
-
root.style.setProperty('--antd-padding-md', `${token['paddingMD']}px`);
|
|
871
|
-
root.style.setProperty('--antd-padding-lg', `${token['paddingLG']}px`);
|
|
872
|
-
root.style.setProperty('--antd-padding-xl', `${token['paddingXL']}px`);
|
|
873
|
-
root.style.setProperty('--antd-font-size-sm', `${token['fontSizeSM']}px`);
|
|
874
|
-
root.style.setProperty('--antd-font-size', `${token['fontSize']}px`);
|
|
875
|
-
root.style.setProperty('--antd-font-size-lg', `${token['fontSizeLG']}px`);
|
|
876
|
-
root.style.setProperty('--antd-font-size-xl', `${token['fontSizeXL']}px`);
|
|
877
|
-
root.style.setProperty('--antd-line-height', token['lineHeight']);
|
|
878
|
-
root.style.setProperty('--antd-line-height-lg', token['lineHeightLG']);
|
|
879
|
-
root.style.setProperty('--antd-control-height-sm', `${token['controlHeightSM']}px`);
|
|
880
|
-
root.style.setProperty('--antd-control-height', `${token['controlHeight']}px`);
|
|
881
|
-
root.style.setProperty('--antd-control-height-lg', `${token['controlHeightLG']}px`);
|
|
882
|
-
root.style.setProperty('--antd-border-radius-sm', `${token['borderRadiusSM']}px`);
|
|
883
|
-
root.style.setProperty('--antd-border-radius', `${token['borderRadius']}px`);
|
|
884
|
-
root.style.setProperty('--antd-border-radius-lg', `${token['borderRadiusLG']}px`);
|
|
885
|
-
}, [
|
|
886
|
-
token
|
|
887
|
-
]);
|
|
888
|
-
return null;
|
|
889
|
-
};
|
|
890
|
-
const TableContainer_module = {
|
|
891
|
-
tableContainer: "tableContainer-EhNwOm"
|
|
892
|
-
};
|
|
893
|
-
function isPaginationNode(node) {
|
|
894
|
-
if (node.nodeType !== Node.ELEMENT_NODE) return false;
|
|
895
|
-
const element = node;
|
|
896
|
-
return element.classList?.contains('ant-table-pagination') || element.querySelector?.('.ant-table-pagination');
|
|
897
|
-
}
|
|
898
|
-
function hasPaginationInMutation(mutation) {
|
|
899
|
-
return Array.from(mutation.addedNodes).some(isPaginationNode);
|
|
900
|
-
}
|
|
901
|
-
function TableContainer({ children }) {
|
|
902
|
-
const containerRef = (0, external_react_.useRef)(null);
|
|
903
|
-
const containerHeightRef = (0, external_react_.useRef)(null);
|
|
904
|
-
const [scrollY, setScrollY] = (0, external_react_.useState)(void 0);
|
|
905
|
-
(0, external_react_.useLayoutEffect)(()=>{
|
|
906
|
-
const calculateHeights = ()=>{
|
|
907
|
-
if (!containerRef.current) return;
|
|
908
|
-
containerHeightRef.current = containerRef.current.offsetHeight;
|
|
909
|
-
const thead = containerRef.current.querySelector('thead');
|
|
910
|
-
let theadHeight = 0;
|
|
911
|
-
if (thead) {
|
|
912
|
-
const rect = thead.getBoundingClientRect();
|
|
913
|
-
const styles = globalThis.getComputedStyle(thead);
|
|
914
|
-
const marginTop = Number.parseFloat(styles.marginTop) || 0;
|
|
915
|
-
const marginBottom = Number.parseFloat(styles.marginBottom) || 0;
|
|
916
|
-
theadHeight = rect.height + marginTop + marginBottom;
|
|
917
|
-
}
|
|
918
|
-
const pagination = containerRef.current.querySelector('.ant-table-pagination');
|
|
919
|
-
let paginationHeight = 0;
|
|
920
|
-
if (pagination) {
|
|
921
|
-
const rect = pagination.getBoundingClientRect();
|
|
922
|
-
const styles = globalThis.getComputedStyle(pagination);
|
|
923
|
-
const marginTop = Number.parseFloat(styles.marginTop) || 0;
|
|
924
|
-
const marginBottom = Number.parseFloat(styles.marginBottom) || 0;
|
|
925
|
-
paginationHeight = rect.height + marginTop + marginBottom;
|
|
926
|
-
}
|
|
927
|
-
const availableHeight = Math.ceil(containerHeightRef.current) - Math.ceil(theadHeight) - Math.ceil(paginationHeight) - 1;
|
|
928
|
-
setScrollY(availableHeight);
|
|
929
|
-
};
|
|
930
|
-
calculateHeights();
|
|
931
|
-
const observer = new MutationObserver((mutations)=>{
|
|
932
|
-
const hasPagination = mutations.some(hasPaginationInMutation);
|
|
933
|
-
if (hasPagination) calculateHeights();
|
|
934
|
-
});
|
|
935
|
-
if (containerRef.current) observer.observe(containerRef.current, {
|
|
936
|
-
childList: true,
|
|
937
|
-
subtree: true
|
|
938
|
-
});
|
|
939
|
-
globalThis.addEventListener('resize', calculateHeights);
|
|
940
|
-
return ()=>{
|
|
941
|
-
observer.disconnect();
|
|
942
|
-
globalThis.removeEventListener('resize', calculateHeights);
|
|
943
|
-
};
|
|
944
|
-
}, []);
|
|
945
|
-
const enhancedChildren = scrollY ? /*#__PURE__*/ (0, external_react_.cloneElement)(children, {
|
|
946
|
-
scroll: {
|
|
947
|
-
...children.props?.scroll,
|
|
948
|
-
y: scrollY,
|
|
949
|
-
x: 'max-content'
|
|
950
|
-
}
|
|
951
|
-
}) : children;
|
|
952
|
-
return /*#__PURE__*/ (0, jsx_runtime.jsx)("div", {
|
|
953
|
-
ref: containerRef,
|
|
954
|
-
className: TableContainer_module.tableContainer,
|
|
955
|
-
children: enhancedChildren
|
|
956
|
-
});
|
|
957
|
-
}
|
|
958
|
-
TableContainer.propTypes = {
|
|
959
|
-
children: external_prop_types_default().element.isRequired
|
|
960
|
-
};
|
|
961
|
-
function FilterContainer({ children, ...props }) {
|
|
962
|
-
const { token } = external_antd_namespaceObject.theme.useToken();
|
|
963
|
-
return /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Card, {
|
|
964
|
-
styles: {
|
|
965
|
-
body: {
|
|
966
|
-
padding: token['paddingXS'] + 'px'
|
|
967
|
-
}
|
|
968
|
-
},
|
|
969
|
-
...props,
|
|
970
|
-
children: children
|
|
971
|
-
});
|
|
972
|
-
}
|
|
973
|
-
FilterContainer.propTypes = {
|
|
974
|
-
children: external_prop_types_default().node.isRequired,
|
|
975
|
-
...external_antd_namespaceObject.Card.propTypes
|
|
1193
|
+
LoggedMainContainer.propTypes = {
|
|
1194
|
+
children: external_prop_types_default().node.isRequired
|
|
976
1195
|
};
|
|
977
1196
|
const Login_module = {
|
|
978
1197
|
containerRow: "containerRow-lnjnDt",
|
|
@@ -985,8 +1204,8 @@ var __webpack_exports__ = {};
|
|
|
985
1204
|
loginHeader: "loginHeader-bBGO5B"
|
|
986
1205
|
};
|
|
987
1206
|
function LoginContainer({ title, children }) {
|
|
988
|
-
const config = (0, external_react_.useContext)(
|
|
989
|
-
if (!config) throw new Error('Login must be used within
|
|
1207
|
+
const config = (0, external_react_.useContext)(CodebitThemeContext);
|
|
1208
|
+
if (!config) throw new Error('Login must be used within CodebitThemeContext');
|
|
990
1209
|
const { t } = useCodebitWebAntdTranslation();
|
|
991
1210
|
const classList = [
|
|
992
1211
|
Login_module.loginCard
|
|
@@ -1022,21 +1241,16 @@ var __webpack_exports__ = {};
|
|
|
1022
1241
|
justify: 'center',
|
|
1023
1242
|
className: Login_module.titleRow,
|
|
1024
1243
|
children: [
|
|
1025
|
-
|
|
1244
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Typography.Title, {
|
|
1026
1245
|
level: 3,
|
|
1027
1246
|
className: Login_module.appTitle,
|
|
1028
1247
|
children: title
|
|
1029
|
-
})
|
|
1248
|
+
}),
|
|
1030
1249
|
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Divider, {
|
|
1031
1250
|
className: Login_module.divider
|
|
1032
1251
|
})
|
|
1033
1252
|
]
|
|
1034
1253
|
}),
|
|
1035
|
-
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Typography.Title, {
|
|
1036
|
-
level: 4,
|
|
1037
|
-
className: `login-header ${Login_module.loginHeader}`,
|
|
1038
|
-
children: t('LoginContainer.signIn')
|
|
1039
|
-
}),
|
|
1040
1254
|
children
|
|
1041
1255
|
]
|
|
1042
1256
|
})
|
|
@@ -1051,42 +1265,227 @@ var __webpack_exports__ = {};
|
|
|
1051
1265
|
]).isRequired,
|
|
1052
1266
|
children: external_prop_types_default().node
|
|
1053
1267
|
};
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1268
|
+
const Login_logger = new codebit_web_namespaceObject.Logger('Login');
|
|
1269
|
+
const LocalLoginAuthenticationResult = Object.freeze({
|
|
1270
|
+
INVALID_EMAIL: 'INVALID_EMAIL',
|
|
1271
|
+
INVALID_PASSWORD: 'INVALID_PASSWORD',
|
|
1272
|
+
INVALID_EMAIL_OR_PASSWORD: 'INVALID_EMAIL_OR_PASSWORD',
|
|
1273
|
+
RECAPTCHA_VALIDATION_FAIL: 'RECAPTCHA_VALIDATION_FAIL',
|
|
1274
|
+
USER_DISABLED: 'USER_DISABLED',
|
|
1275
|
+
SUCCESS: 'SUCCESS'
|
|
1276
|
+
});
|
|
1277
|
+
function Login({ title, oauthCallbackUrl, navigateToForgotPassword, submitAuthenticateLocalUser }) {
|
|
1278
|
+
const [localLoading, setLocalLoading] = (0, external_react_.useState)(false);
|
|
1279
|
+
const [googleLoading, setGoogleLoading] = (0, external_react_.useState)(false);
|
|
1280
|
+
const [form] = external_antd_namespaceObject.Form.useForm();
|
|
1059
1281
|
const { t } = useCodebitWebAntdTranslation();
|
|
1282
|
+
const { modal } = external_antd_namespaceObject.App.useApp();
|
|
1283
|
+
const navigate = (0, external_react_router_namespaceObject.useNavigate)();
|
|
1284
|
+
const context = {
|
|
1285
|
+
navigate
|
|
1286
|
+
};
|
|
1060
1287
|
const handleGoogleLogin = ()=>{
|
|
1061
|
-
|
|
1288
|
+
setGoogleLoading(true);
|
|
1062
1289
|
setTimeout(()=>{
|
|
1063
|
-
console.debug('Redirecting to Google Login...');
|
|
1064
1290
|
globalThis.location.assign(oauthCallbackUrl);
|
|
1291
|
+
setGoogleLoading(false);
|
|
1065
1292
|
}, 1000);
|
|
1066
1293
|
};
|
|
1067
|
-
|
|
1294
|
+
const handleLocalLogin = async (values)=>{
|
|
1295
|
+
setLocalLoading(true);
|
|
1296
|
+
try {
|
|
1297
|
+
const { email, password } = values;
|
|
1298
|
+
const result = await submitAuthenticateLocalUser(email, password, context);
|
|
1299
|
+
switch(result){
|
|
1300
|
+
case LocalLoginAuthenticationResult.SUCCESS:
|
|
1301
|
+
break;
|
|
1302
|
+
case LocalLoginAuthenticationResult.INVALID_EMAIL:
|
|
1303
|
+
form.setFields([
|
|
1304
|
+
{
|
|
1305
|
+
name: 'email',
|
|
1306
|
+
errors: [
|
|
1307
|
+
t('Common.invalidEmail')
|
|
1308
|
+
]
|
|
1309
|
+
}
|
|
1310
|
+
]);
|
|
1311
|
+
break;
|
|
1312
|
+
case LocalLoginAuthenticationResult.INVALID_PASSWORD:
|
|
1313
|
+
form.setFields([
|
|
1314
|
+
{
|
|
1315
|
+
name: 'password',
|
|
1316
|
+
errors: [
|
|
1317
|
+
t('Login.invalidPassword')
|
|
1318
|
+
]
|
|
1319
|
+
}
|
|
1320
|
+
]);
|
|
1321
|
+
break;
|
|
1322
|
+
case LocalLoginAuthenticationResult.INVALID_EMAIL_OR_PASSWORD:
|
|
1323
|
+
form.setFields([
|
|
1324
|
+
{
|
|
1325
|
+
name: 'email',
|
|
1326
|
+
errors: [
|
|
1327
|
+
t('Login.invalidEmailOrPassword')
|
|
1328
|
+
]
|
|
1329
|
+
},
|
|
1330
|
+
{
|
|
1331
|
+
name: 'password',
|
|
1332
|
+
errors: [
|
|
1333
|
+
t('Login.invalidEmailOrPassword')
|
|
1334
|
+
]
|
|
1335
|
+
}
|
|
1336
|
+
]);
|
|
1337
|
+
break;
|
|
1338
|
+
case LocalLoginAuthenticationResult.RECAPTCHA_VALIDATION_FAIL:
|
|
1339
|
+
modal.error({
|
|
1340
|
+
title: t('Login.authenticationFailed'),
|
|
1341
|
+
content: t('Common.recaptchaFailed'),
|
|
1342
|
+
okText: t('Common.ok')
|
|
1343
|
+
});
|
|
1344
|
+
break;
|
|
1345
|
+
case LocalLoginAuthenticationResult.USER_DISABLED:
|
|
1346
|
+
modal.error({
|
|
1347
|
+
title: t('Login.authenticationFailed'),
|
|
1348
|
+
content: t('Login.userDisabled'),
|
|
1349
|
+
okText: t('Common.ok')
|
|
1350
|
+
});
|
|
1351
|
+
break;
|
|
1352
|
+
default:
|
|
1353
|
+
Login_logger.warn('Unhandled authentication result:', result);
|
|
1354
|
+
modal.error({
|
|
1355
|
+
title: t('Login.authenticationFailed'),
|
|
1356
|
+
content: t('Common.genericError'),
|
|
1357
|
+
okText: t('Common.ok')
|
|
1358
|
+
});
|
|
1359
|
+
}
|
|
1360
|
+
} catch (error) {
|
|
1361
|
+
Login_logger.error(error);
|
|
1362
|
+
react_namespaceObject.captureException(error);
|
|
1363
|
+
modal.error({
|
|
1364
|
+
title: t('Login.errorTitle'),
|
|
1365
|
+
content: t('Common.genericError'),
|
|
1366
|
+
okText: t('Common.ok')
|
|
1367
|
+
});
|
|
1368
|
+
} finally{
|
|
1369
|
+
setLocalLoading(false);
|
|
1370
|
+
}
|
|
1371
|
+
};
|
|
1372
|
+
const handleNavigateToForgotPassword = async ()=>{
|
|
1373
|
+
await navigateToForgotPassword(context);
|
|
1374
|
+
};
|
|
1375
|
+
return /*#__PURE__*/ (0, jsx_runtime.jsxs)(LoginContainer, {
|
|
1068
1376
|
title: title || t('Login.loginTitle'),
|
|
1069
|
-
children:
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1377
|
+
children: [
|
|
1378
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Typography.Title, {
|
|
1379
|
+
level: 4,
|
|
1380
|
+
className: `${Login_module.loginHeader}`,
|
|
1381
|
+
children: t('LoginContainer.signIn')
|
|
1382
|
+
}),
|
|
1383
|
+
/*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Space, {
|
|
1384
|
+
direction: 'vertical',
|
|
1075
1385
|
size: 'large',
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1386
|
+
style: {
|
|
1387
|
+
width: '100%'
|
|
1388
|
+
},
|
|
1389
|
+
children: [
|
|
1390
|
+
submitAuthenticateLocalUser && /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Form, {
|
|
1391
|
+
name: 'login-form',
|
|
1392
|
+
layout: 'vertical',
|
|
1393
|
+
onFinish: handleLocalLogin,
|
|
1394
|
+
children: [
|
|
1395
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Form.Item, {
|
|
1396
|
+
name: 'email',
|
|
1397
|
+
label: t('Login.emailLabel'),
|
|
1398
|
+
rules: [
|
|
1399
|
+
{
|
|
1400
|
+
required: true,
|
|
1401
|
+
message: t('Login.emailRequired')
|
|
1402
|
+
},
|
|
1403
|
+
{
|
|
1404
|
+
type: 'email',
|
|
1405
|
+
message: t('Login.emailInvalid')
|
|
1406
|
+
}
|
|
1407
|
+
],
|
|
1408
|
+
children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Input, {
|
|
1409
|
+
prefix: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MailOutlined, {}),
|
|
1410
|
+
placeholder: t('Login.emailPlaceholder'),
|
|
1411
|
+
size: 'large'
|
|
1412
|
+
})
|
|
1413
|
+
}),
|
|
1414
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Form.Item, {
|
|
1415
|
+
name: 'password',
|
|
1416
|
+
label: t('Login.passwordLabel'),
|
|
1417
|
+
rules: [
|
|
1418
|
+
{
|
|
1419
|
+
required: true,
|
|
1420
|
+
message: t('Login.passwordRequired')
|
|
1421
|
+
}
|
|
1422
|
+
],
|
|
1423
|
+
children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Input.Password, {
|
|
1424
|
+
prefix: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.LockOutlined, {}),
|
|
1425
|
+
placeholder: t('Login.passwordPlaceholder'),
|
|
1426
|
+
size: 'large'
|
|
1427
|
+
})
|
|
1428
|
+
}),
|
|
1429
|
+
navigateToForgotPassword && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Form.Item, {
|
|
1430
|
+
children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Row, {
|
|
1431
|
+
justify: 'end',
|
|
1432
|
+
children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Col, {
|
|
1433
|
+
children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Typography.Link, {
|
|
1434
|
+
onClick: handleNavigateToForgotPassword,
|
|
1435
|
+
children: t('Login.forgotPassword')
|
|
1436
|
+
})
|
|
1437
|
+
})
|
|
1438
|
+
})
|
|
1439
|
+
}),
|
|
1440
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Form.Item, {
|
|
1441
|
+
style: {
|
|
1442
|
+
marginBottom: 0
|
|
1443
|
+
},
|
|
1444
|
+
children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
|
|
1445
|
+
type: 'primary',
|
|
1446
|
+
htmlType: 'submit',
|
|
1447
|
+
size: 'large',
|
|
1448
|
+
loading: localLoading,
|
|
1449
|
+
disabled: googleLoading,
|
|
1450
|
+
block: true,
|
|
1451
|
+
children: t('Login.loginButton')
|
|
1452
|
+
})
|
|
1453
|
+
})
|
|
1454
|
+
]
|
|
1455
|
+
}),
|
|
1456
|
+
submitAuthenticateLocalUser && oauthCallbackUrl && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Divider, {
|
|
1457
|
+
children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Typography.Text, {
|
|
1458
|
+
type: 'secondary',
|
|
1459
|
+
children: t('Login.separator')
|
|
1460
|
+
})
|
|
1461
|
+
}),
|
|
1462
|
+
oauthCallbackUrl && /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Flex, {
|
|
1463
|
+
vertical: true,
|
|
1464
|
+
align: 'center',
|
|
1465
|
+
children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
|
|
1466
|
+
type: 'primary',
|
|
1467
|
+
size: 'large',
|
|
1468
|
+
icon: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.GoogleOutlined, {}),
|
|
1469
|
+
loading: googleLoading,
|
|
1470
|
+
onClick: handleGoogleLogin,
|
|
1471
|
+
disabled: localLoading,
|
|
1472
|
+
block: true,
|
|
1473
|
+
children: t('Login.googleLogin')
|
|
1474
|
+
})
|
|
1475
|
+
})
|
|
1476
|
+
]
|
|
1081
1477
|
})
|
|
1082
|
-
|
|
1478
|
+
]
|
|
1083
1479
|
});
|
|
1084
1480
|
}
|
|
1085
1481
|
Login.propTypes = {
|
|
1086
1482
|
title: external_prop_types_default().oneOfType([
|
|
1087
1483
|
external_prop_types_default().string,
|
|
1088
1484
|
external_prop_types_default().node
|
|
1089
|
-
])
|
|
1485
|
+
]),
|
|
1486
|
+
oauthCallbackUrl: external_prop_types_default().string,
|
|
1487
|
+
navigateToForgotPassword: external_prop_types_default().func,
|
|
1488
|
+
submitAuthenticateLocalUser: external_prop_types_default().func
|
|
1090
1489
|
};
|
|
1091
1490
|
const HandleError_module = {
|
|
1092
1491
|
container: "container-A_JXAc",
|
|
@@ -1152,33 +1551,171 @@ var __webpack_exports__ = {};
|
|
|
1152
1551
|
HandleError.propTypes = {
|
|
1153
1552
|
title: external_prop_types_default().string
|
|
1154
1553
|
};
|
|
1554
|
+
const ForgotPassword_logger = new codebit_web_namespaceObject.Logger('ForgotPassword');
|
|
1555
|
+
const LocalLoginRecoveryPasswordResult = Object.freeze({
|
|
1556
|
+
INVALID_EMAIL: 'INVALID_EMAIL',
|
|
1557
|
+
RECAPTCHA_VALIDATION_FAIL: 'RECAPTCHA_VALIDATION_FAIL',
|
|
1558
|
+
SUCCESS: 'SUCCESS'
|
|
1559
|
+
});
|
|
1560
|
+
const ForgotPassword = ({ navigateToLogin, submitRecoveryPassword })=>{
|
|
1561
|
+
const [form] = external_antd_namespaceObject.Form.useForm();
|
|
1562
|
+
const { modal } = external_antd_namespaceObject.App.useApp();
|
|
1563
|
+
const [loading, setLoading] = (0, external_react_.useState)(false);
|
|
1564
|
+
const { t } = useCodebitWebAntdTranslation();
|
|
1565
|
+
const navigate = (0, external_react_router_namespaceObject.useNavigate)();
|
|
1566
|
+
const context = {
|
|
1567
|
+
navigate
|
|
1568
|
+
};
|
|
1569
|
+
const handleNavigateToLogin = async ()=>{
|
|
1570
|
+
await navigateToLogin(context);
|
|
1571
|
+
};
|
|
1572
|
+
const handleRecoveryPassword = async (values)=>{
|
|
1573
|
+
setLoading(true);
|
|
1574
|
+
try {
|
|
1575
|
+
setLoading(true);
|
|
1576
|
+
const result = await submitRecoveryPassword(values.email, context);
|
|
1577
|
+
switch(result){
|
|
1578
|
+
case LocalLoginRecoveryPasswordResult.SUCCESS:
|
|
1579
|
+
modal.success({
|
|
1580
|
+
title: t('ForgotPassword.title'),
|
|
1581
|
+
content: t('ForgotPassword.resetSuccessMessage'),
|
|
1582
|
+
onOk: handleNavigateToLogin,
|
|
1583
|
+
okText: t('Common.ok')
|
|
1584
|
+
});
|
|
1585
|
+
break;
|
|
1586
|
+
case LocalLoginRecoveryPasswordResult.INVALID_EMAIL:
|
|
1587
|
+
form.setFields([
|
|
1588
|
+
{
|
|
1589
|
+
name: 'email',
|
|
1590
|
+
errors: [
|
|
1591
|
+
t('Common.invalidEmail')
|
|
1592
|
+
]
|
|
1593
|
+
}
|
|
1594
|
+
]);
|
|
1595
|
+
break;
|
|
1596
|
+
case LocalLoginRecoveryPasswordResult.RECAPTCHA_VALIDATION_FAIL:
|
|
1597
|
+
modal.error({
|
|
1598
|
+
title: t('ForgotPassword.title'),
|
|
1599
|
+
content: t('Common.recaptchaFailed'),
|
|
1600
|
+
okText: t('Common.ok')
|
|
1601
|
+
});
|
|
1602
|
+
break;
|
|
1603
|
+
}
|
|
1604
|
+
} catch (error) {
|
|
1605
|
+
ForgotPassword_logger.error(error);
|
|
1606
|
+
react_namespaceObject.captureException(error);
|
|
1607
|
+
modal.error({
|
|
1608
|
+
title: t('ForgotPassword.title'),
|
|
1609
|
+
content: t('Common.genericError'),
|
|
1610
|
+
okText: t('Common.ok')
|
|
1611
|
+
});
|
|
1612
|
+
} finally{
|
|
1613
|
+
setLoading(false);
|
|
1614
|
+
}
|
|
1615
|
+
};
|
|
1616
|
+
return /*#__PURE__*/ (0, jsx_runtime.jsx)(LoginContainer, {
|
|
1617
|
+
title: t('ForgotPassword.title'),
|
|
1618
|
+
children: /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Form, {
|
|
1619
|
+
form: form,
|
|
1620
|
+
name: 'forgot-password-form',
|
|
1621
|
+
onFinish: handleRecoveryPassword,
|
|
1622
|
+
initialValues: {
|
|
1623
|
+
email: ''
|
|
1624
|
+
},
|
|
1625
|
+
style: {
|
|
1626
|
+
width: '100%'
|
|
1627
|
+
},
|
|
1628
|
+
children: [
|
|
1629
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Typography.Paragraph, {
|
|
1630
|
+
style: {
|
|
1631
|
+
textAlign: 'center'
|
|
1632
|
+
},
|
|
1633
|
+
children: t('ForgotPassword.instructions')
|
|
1634
|
+
}),
|
|
1635
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Form.Item, {
|
|
1636
|
+
name: 'email',
|
|
1637
|
+
rules: [
|
|
1638
|
+
{
|
|
1639
|
+
required: true,
|
|
1640
|
+
message: t('ForgotPassword.emailRequired')
|
|
1641
|
+
},
|
|
1642
|
+
{
|
|
1643
|
+
type: 'email',
|
|
1644
|
+
message: t('ForgotPassword.emailInvalid')
|
|
1645
|
+
}
|
|
1646
|
+
],
|
|
1647
|
+
children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Input, {
|
|
1648
|
+
prefix: /*#__PURE__*/ (0, jsx_runtime.jsx)(icons_namespaceObject.MailOutlined, {}),
|
|
1649
|
+
placeholder: t('ForgotPassword.emailPlaceholder'),
|
|
1650
|
+
size: 'large'
|
|
1651
|
+
})
|
|
1652
|
+
}),
|
|
1653
|
+
/*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Form.Item, {
|
|
1654
|
+
children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Button, {
|
|
1655
|
+
type: 'primary',
|
|
1656
|
+
htmlType: 'submit',
|
|
1657
|
+
size: 'large',
|
|
1658
|
+
loading: loading,
|
|
1659
|
+
style: {
|
|
1660
|
+
width: '100%'
|
|
1661
|
+
},
|
|
1662
|
+
children: t('ForgotPassword.submitButton')
|
|
1663
|
+
})
|
|
1664
|
+
}),
|
|
1665
|
+
navigateToLogin && /*#__PURE__*/ (0, jsx_runtime.jsx)("div", {
|
|
1666
|
+
style: {
|
|
1667
|
+
textAlign: 'center'
|
|
1668
|
+
},
|
|
1669
|
+
children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Typography.Link, {
|
|
1670
|
+
onClick: handleNavigateToLogin,
|
|
1671
|
+
children: t('ForgotPassword.backToLogin')
|
|
1672
|
+
})
|
|
1673
|
+
})
|
|
1674
|
+
]
|
|
1675
|
+
})
|
|
1676
|
+
});
|
|
1677
|
+
};
|
|
1678
|
+
ForgotPassword.propTypes = {
|
|
1679
|
+
navigateToLogin: external_prop_types_default().func,
|
|
1680
|
+
submitRecoveryPassword: external_prop_types_default().func.isRequired
|
|
1681
|
+
};
|
|
1155
1682
|
})();
|
|
1156
1683
|
exports.CodebitConfigContext = __webpack_exports__.CodebitConfigContext;
|
|
1157
1684
|
exports.CodebitConfigProvider = __webpack_exports__.CodebitConfigProvider;
|
|
1685
|
+
exports.CodebitThemeContext = __webpack_exports__.CodebitThemeContext;
|
|
1686
|
+
exports.CodebitThemeProvider = __webpack_exports__.CodebitThemeProvider;
|
|
1158
1687
|
exports.CssTokenBridge = __webpack_exports__.CssTokenBridge;
|
|
1159
1688
|
exports.ErrorRetry = __webpack_exports__.ErrorRetry;
|
|
1160
1689
|
exports.FilterContainer = __webpack_exports__.FilterContainer;
|
|
1690
|
+
exports.ForgotPassword = __webpack_exports__.ForgotPassword;
|
|
1161
1691
|
exports.HandleError = __webpack_exports__.HandleError;
|
|
1162
1692
|
exports.ListCard = __webpack_exports__.ListCard;
|
|
1693
|
+
exports.LocalLoginAuthenticationResult = __webpack_exports__.LocalLoginAuthenticationResult;
|
|
1694
|
+
exports.LocalLoginRecoveryPasswordResult = __webpack_exports__.LocalLoginRecoveryPasswordResult;
|
|
1163
1695
|
exports.LoggedMainContainer = __webpack_exports__.LoggedMainContainer;
|
|
1164
1696
|
exports.Login = __webpack_exports__.Login;
|
|
1165
1697
|
exports.LoginContainer = __webpack_exports__.LoginContainer;
|
|
1166
1698
|
exports.TableContainer = __webpack_exports__.TableContainer;
|
|
1167
1699
|
exports.ThemeToggle = __webpack_exports__.ThemeToggle;
|
|
1168
|
-
for(var
|
|
1700
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
1169
1701
|
"CodebitConfigContext",
|
|
1170
1702
|
"CodebitConfigProvider",
|
|
1703
|
+
"CodebitThemeContext",
|
|
1704
|
+
"CodebitThemeProvider",
|
|
1171
1705
|
"CssTokenBridge",
|
|
1172
1706
|
"ErrorRetry",
|
|
1173
1707
|
"FilterContainer",
|
|
1708
|
+
"ForgotPassword",
|
|
1174
1709
|
"HandleError",
|
|
1175
1710
|
"ListCard",
|
|
1711
|
+
"LocalLoginAuthenticationResult",
|
|
1712
|
+
"LocalLoginRecoveryPasswordResult",
|
|
1176
1713
|
"LoggedMainContainer",
|
|
1177
1714
|
"Login",
|
|
1178
1715
|
"LoginContainer",
|
|
1179
1716
|
"TableContainer",
|
|
1180
1717
|
"ThemeToggle"
|
|
1181
|
-
].indexOf(
|
|
1718
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
1182
1719
|
Object.defineProperty(exports, '__esModule', {
|
|
1183
1720
|
value: true
|
|
1184
1721
|
});
|