@codebit-programando-solucoes/codebit-web-antd 1.1.26 → 1.1.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1647,7 +1647,7 @@ var __webpack_exports__ = {};
1647
1647
  RECAPTCHA_VALIDATION_FAIL: 'RECAPTCHA_VALIDATION_FAIL',
1648
1648
  SUCCESS: 'SUCCESS'
1649
1649
  });
1650
- const ForgotPassword = ({ navigateToLogin, submitRecoveryPassword })=>{
1650
+ const ForgotPassword = ({ navigateToLogin, submitRecoveryPassword, title })=>{
1651
1651
  const [form] = external_antd_namespaceObject.Form.useForm();
1652
1652
  const { modal } = external_antd_namespaceObject.App.useApp();
1653
1653
  const [loading, setLoading] = (0, external_react_.useState)(false);
@@ -1667,7 +1667,7 @@ var __webpack_exports__ = {};
1667
1667
  switch(result){
1668
1668
  case LocalLoginRecoveryPasswordResult.SUCCESS:
1669
1669
  modal.success({
1670
- title: t('ForgotPassword.title'),
1670
+ title: title || t('ForgotPassword.title'),
1671
1671
  content: t('ForgotPassword.resetSuccessMessage'),
1672
1672
  onOk: handleNavigateToLogin,
1673
1673
  okText: t('Common.ok')
@@ -1685,7 +1685,7 @@ var __webpack_exports__ = {};
1685
1685
  break;
1686
1686
  case LocalLoginRecoveryPasswordResult.RECAPTCHA_VALIDATION_FAIL:
1687
1687
  modal.error({
1688
- title: t('ForgotPassword.title'),
1688
+ title: title || t('ForgotPassword.title'),
1689
1689
  content: t('Common.recaptchaFailed'),
1690
1690
  okText: t('Common.ok')
1691
1691
  });
@@ -1695,7 +1695,7 @@ var __webpack_exports__ = {};
1695
1695
  ForgotPassword_logger.error(error);
1696
1696
  react_namespaceObject.captureException(error);
1697
1697
  modal.error({
1698
- title: t('ForgotPassword.title'),
1698
+ title: title || t('ForgotPassword.title'),
1699
1699
  content: t('Common.genericError'),
1700
1700
  okText: t('Common.ok')
1701
1701
  });
@@ -1704,7 +1704,7 @@ var __webpack_exports__ = {};
1704
1704
  }
1705
1705
  };
1706
1706
  return /*#__PURE__*/ (0, jsx_runtime.jsx)(LoginContainer, {
1707
- title: t('ForgotPassword.title'),
1707
+ title: title || t('ForgotPassword.title'),
1708
1708
  children: /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Form, {
1709
1709
  form: form,
1710
1710
  name: 'forgot-password-form',
@@ -1766,6 +1766,7 @@ var __webpack_exports__ = {};
1766
1766
  });
1767
1767
  };
1768
1768
  ForgotPassword.propTypes = {
1769
+ title: external_prop_types_default().string,
1769
1770
  navigateToLogin: external_prop_types_default().func,
1770
1771
  submitRecoveryPassword: external_prop_types_default().func.isRequired
1771
1772
  };
@@ -1774,7 +1775,7 @@ var __webpack_exports__ = {};
1774
1775
  INVALID_TOKEN: 'INVALID_TOKEN',
1775
1776
  SUCCESS: 'SUCCESS'
1776
1777
  });
1777
- const ChangePassword = ({ navigateToLogin, checkToken, submitChangePassword })=>{
1778
+ const ChangePassword = ({ navigateToLogin, checkToken, submitChangePassword, title })=>{
1778
1779
  const navigate = (0, external_react_router_namespaceObject.useNavigate)();
1779
1780
  const [form] = external_antd_namespaceObject.Form.useForm();
1780
1781
  const { modal } = external_antd_namespaceObject.App.useApp();
@@ -1782,10 +1783,8 @@ var __webpack_exports__ = {};
1782
1783
  const [checkingToken, setCheckingToken] = (0, external_react_.useState)(true);
1783
1784
  const { t } = useCodebitWebAntdTranslation();
1784
1785
  t('');
1785
- const params = (0, external_react_router_namespaceObject.useParams)();
1786
1786
  const context = {
1787
- navigate,
1788
- params
1787
+ navigate
1789
1788
  };
1790
1789
  const handleChangePassword = async (values)=>{
1791
1790
  try {
@@ -1794,7 +1793,7 @@ var __webpack_exports__ = {};
1794
1793
  switch(result){
1795
1794
  case LocalLoginChangePasswordResult.SUCCESS:
1796
1795
  modal.success({
1797
- title: t('ForgotPassword.title'),
1796
+ title: title || t('ChangePassword.title'),
1798
1797
  content: t('ChangePassword.passwordChangedSuccess'),
1799
1798
  onOk: handleNavigateToLogin,
1800
1799
  okText: t('Common.close')
@@ -1802,7 +1801,7 @@ var __webpack_exports__ = {};
1802
1801
  break;
1803
1802
  case LocalLoginChangePasswordResult.INVALID_TOKEN:
1804
1803
  modal.error({
1805
- title: t('ForgotPassword.title'),
1804
+ title: title || t('ChangePassword.title'),
1806
1805
  content: t('ChangePassword.tokenInvalidRecovery'),
1807
1806
  onOk: handleNavigateToLogin,
1808
1807
  okText: t('Common.close')
@@ -1813,7 +1812,7 @@ var __webpack_exports__ = {};
1813
1812
  ChangePassword_logger.error(error);
1814
1813
  react_namespaceObject.captureException(error);
1815
1814
  modal.error({
1816
- title: t('ForgotPassword.title'),
1815
+ title: title || t('ChangePassword.title'),
1817
1816
  content: t('Common.genericError'),
1818
1817
  okText: t('Common.ok')
1819
1818
  });
@@ -1843,7 +1842,7 @@ var __webpack_exports__ = {};
1843
1842
  ChangePassword_logger.error(error);
1844
1843
  react_namespaceObject.captureException(error);
1845
1844
  modal.error({
1846
- title: t('ChangePassword.title'),
1845
+ title: title || t('ChangePassword.title'),
1847
1846
  content: t('Common.genericError'),
1848
1847
  okText: t('Common.ok')
1849
1848
  });
@@ -1856,7 +1855,7 @@ var __webpack_exports__ = {};
1856
1855
  handleCheckToken().then();
1857
1856
  }, []);
1858
1857
  return /*#__PURE__*/ (0, jsx_runtime.jsx)(LoginContainer, {
1859
- title: t('ChangePassword.title'),
1858
+ title: title || t('ChangePassword.title'),
1860
1859
  children: /*#__PURE__*/ (0, jsx_runtime.jsx)(external_antd_namespaceObject.Spin, {
1861
1860
  spinning: checkingToken,
1862
1861
  children: /*#__PURE__*/ (0, jsx_runtime.jsxs)(external_antd_namespaceObject.Form, {
@@ -1964,7 +1963,8 @@ var __webpack_exports__ = {};
1964
1963
  ChangePassword.propTypes = {
1965
1964
  navigateToLogin: external_prop_types_default().func.isRequired,
1966
1965
  checkToken: external_prop_types_default().func.isRequired,
1967
- submitChangePassword: external_prop_types_default().func.isRequired
1966
+ submitChangePassword: external_prop_types_default().func.isRequired,
1967
+ title: external_prop_types_default().string
1968
1968
  };
1969
1969
  const useErrorModal_logger = new codebit_web_namespaceObject.Logger('useErrorModal');
1970
1970
  function useErrorModal() {
@@ -1,4 +1,5 @@
1
1
  import React = require('react');
2
+ import { LocalLoginConfContext } from './Login';
2
3
 
3
4
  /**
4
5
  * Possible results for password change operations.
@@ -7,27 +8,19 @@ import React = require('react');
7
8
  * Represents the outcome of a password change attempt.
8
9
  */
9
10
  export enum LocalLoginChangePasswordResult {
11
+ /** The provided token is invalid or has expired. */
10
12
  INVALID_TOKEN = 'INVALID_TOKEN',
13
+ /** The password was changed successfully. */
11
14
  SUCCESS = 'SUCCESS',
12
15
  }
13
16
 
14
- /**
15
- * Context interface for login flow navigation and parameters.
16
- *
17
- * @property navigate - Function to redirect to different routes
18
- * @property params - URL parameters from React Router
19
- */
20
- export interface LocalLoginConfContext {
21
- navigate: (to: string) => void;
22
- params: Record<string, string | undefined>;
23
- }
24
-
25
17
  /**
26
18
  * Props for the ChangePassword component.
27
19
  *
28
- * @property navigateToLogin - Callback to redirect to login screen
29
- * @property checkToken - Validates the password reset token
30
- * @property submitChangePassword - Submits new password with token validation
20
+ * @property navigateToLogin - Callback that redirects the user to the login screen.
21
+ * @property checkToken - Function that validates the password‑reset token.
22
+ * @property submitChangePassword - Function that submits the new password together with token validation.
23
+ * @property title - Optional custom title for the page.
31
24
  */
32
25
  export interface ChangePasswordProps {
33
26
  navigateToLogin: (context: LocalLoginConfContext) => Promise<void>;
@@ -36,12 +29,13 @@ export interface ChangePasswordProps {
36
29
  password: string,
37
30
  context: LocalLoginConfContext,
38
31
  ) => Promise<LocalLoginChangePasswordResult>;
32
+ title?: string;
39
33
  }
40
34
 
41
35
  /**
42
36
  * Password change interface component.
43
37
  *
44
38
  * @remarks
45
- * Handles user password reset with token validation and form submission. Requires implementation of all callback functions for authentication flow.
39
+ * Handles user password reset with token validation and form submission. All callback functions must be provided to integrate with the authentication flow.
46
40
  */
47
41
  export declare const ChangePassword: React.FC<ChangePasswordProps>;
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { LocalLoginConfContext } from './Login';
2
3
 
3
4
  /** Enumeration of possible statuses for password recovery operations. */
4
5
  export declare enum LocalLoginRecoveryPasswordResult {
@@ -7,17 +8,6 @@ export declare enum LocalLoginRecoveryPasswordResult {
7
8
  SUCCESS = 'SUCCESS',
8
9
  }
9
10
 
10
- /** Context object used for navigation within authentication flows. Contains navigation functions to redirect between authentication screens. */
11
- export interface LocalLoginConfContext {
12
- /**
13
- * Redirects to the specified route path.
14
- *
15
- * @param path - Target navigation path
16
- * @param ...args - Additional navigation parameters
17
- */
18
- navigate: (path: string, ...args: any[]) => void;
19
- }
20
-
21
11
  /** Properties for the ForgotPassword component. */
22
12
  export interface ForgotPasswordProps {
23
13
  /**
@@ -2,3 +2,4 @@ export * from './Login';
2
2
  export * from './LoginContainer';
3
3
  export * from './HandleError';
4
4
  export * from './ForgotPassword';
5
+ export * from './ChangePassword';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebit-programando-solucoes/codebit-web-antd",
3
- "version": "1.1.26",
3
+ "version": "1.1.29",
4
4
  "main": "./dist/index.cjs",
5
5
  "type": "module",
6
6
  "types": "./src/index.d.ts",