@movalib/movalib-commons 1.2.23 → 1.2.25

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.
@@ -61,6 +61,25 @@ var AccountValidation = function (_a) {
61
61
  // Si cette variable est transmise, cela signifie que le compte a été créé sans mot de passe
62
62
  var localEmptyPwd = Boolean(params.get('emptyPwd'));
63
63
  setEmptyPwd(localEmptyPwd);
64
+ if (token) {
65
+ setLoading(true);
66
+ try {
67
+ UserService_1.default.existsByToken(token)
68
+ .then(function (response) {
69
+ Logger_1.default.info(response);
70
+ if (response.success) {
71
+ // Si le compte est déjà actif, on appelle le callback de succès
72
+ onSubmit(true, "Votre compte est activé !");
73
+ }
74
+ });
75
+ }
76
+ catch (error) {
77
+ Logger_1.default.error('Error occurred during submission:', error);
78
+ }
79
+ finally {
80
+ setLoading(false);
81
+ }
82
+ }
64
83
  if (token && !resetPassword) {
65
84
  if (!localEmptyPwd) {
66
85
  var req = {
@@ -51,9 +51,7 @@ var MovaDialog = function (_a) {
51
51
  onClose();
52
52
  }
53
53
  };
54
- return ((0, jsx_runtime_1.jsxs)(material_1.Dialog, __assign({ fullScreen: fullScreen, fullWidth: true,
55
- //TransitionComponent={getTransition()}
56
- open: open, "aria-labelledby": "garage-dialog-title", "aria-describedby": "garage-dialog-description", onClose: handleOnClose, maxWidth: maxWidth, sx: __assign(__assign({}, sx), { textAlign: 'center' }) }, { children: [(0, jsx_runtime_1.jsx)("img", { src: getLeafImage(), style: {
54
+ return ((0, jsx_runtime_1.jsxs)(material_1.Dialog, __assign({ fullScreen: fullScreen, fullWidth: true, TransitionComponent: getTransition(), open: open, "aria-labelledby": "garage-dialog-title", "aria-describedby": "garage-dialog-description", onClose: handleOnClose, maxWidth: maxWidth, sx: __assign(__assign({}, sx), { textAlign: 'center' }) }, { children: [(0, jsx_runtime_1.jsx)("img", { src: getLeafImage(), style: {
57
55
  position: 'absolute',
58
56
  float: 'left',
59
57
  width: '150px',
@@ -3,6 +3,7 @@ import { MovaAppType } from "../helpers/Enums";
3
3
  import Garage from "../models/Garage";
4
4
  import User from "../models/User";
5
5
  export default class UserService {
6
+ static existsByToken(token: string): Promise<APIResponse<User>>;
6
7
  static existsByPhoneNumber(phoneNumber: string): Promise<APIResponse<User>>;
7
8
  static reestPassword(req: any): Promise<APIResponse<string>>;
8
9
  static resendSecurityCode(req: any): Promise<APIResponse<string>>;
@@ -45,6 +45,12 @@ var Logger_1 = __importDefault(require("../helpers/Logger"));
45
45
  var UserService = /** @class */ (function () {
46
46
  function UserService() {
47
47
  }
48
+ UserService.existsByToken = function (token) {
49
+ return (0, ApiHelper_1.request)({
50
+ url: "".concat(ApiHelper_1.API_BASE_URL, "/user/token/").concat(token),
51
+ method: Enums_1.APIMethod.GET
52
+ });
53
+ };
48
54
  UserService.existsByPhoneNumber = function (phoneNumber) {
49
55
  return (0, ApiHelper_1.request)({
50
56
  url: "".concat(ApiHelper_1.API_BASE_URL, "/user/phone-number/").concat(phoneNumber),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movalib/movalib-commons",
3
- "version": "1.2.23",
3
+ "version": "1.2.25",
4
4
  "description": "Bibliothèque d'objets communs à l'ensemble des projets React de Movalib",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -59,6 +59,29 @@ const AccountValidation: FunctionComponent<AccountValidationProps> = ({ movaAppT
59
59
  // Si cette variable est transmise, cela signifie que le compte a été créé sans mot de passe
60
60
  let localEmptyPwd = Boolean(params.get('emptyPwd'));
61
61
  setEmptyPwd(localEmptyPwd);
62
+
63
+ if(token){
64
+ setLoading(true);
65
+
66
+ try {
67
+
68
+ UserService.existsByToken(token)
69
+ .then(response => {
70
+
71
+ Logger.info(response);
72
+
73
+ if(response.success){
74
+ // Si le compte est déjà actif, on appelle le callback de succès
75
+ onSubmit(true, "Votre compte est activé !");
76
+ }
77
+ });
78
+
79
+ }catch (error){
80
+ Logger.error('Error occurred during submission:', error);
81
+ }finally {
82
+ setLoading(false);
83
+ }
84
+ }
62
85
 
63
86
  if (token && !resetPassword) {
64
87
 
@@ -70,7 +70,7 @@ const MovaDialog: FC<MovaDialogProps> = ({fullScreen, open, onClose, closable =
70
70
  <Dialog
71
71
  fullScreen={fullScreen}
72
72
  fullWidth
73
- //TransitionComponent={getTransition()}
73
+ TransitionComponent={getTransition()}
74
74
  open={open}
75
75
  aria-labelledby="garage-dialog-title"
76
76
  aria-describedby="garage-dialog-description"
@@ -6,6 +6,13 @@ import User from "../models/User";
6
6
 
7
7
  export default class UserService {
8
8
 
9
+ static existsByToken(token: string): Promise<APIResponse<User>> {
10
+ return request({
11
+ url: `${API_BASE_URL}/user/token/${token}`,
12
+ method: APIMethod.GET
13
+ });
14
+ }
15
+
9
16
  static existsByPhoneNumber(phoneNumber: string): Promise<APIResponse<User>> {
10
17
  return request({
11
18
  url: `${API_BASE_URL}/user/phone-number/${phoneNumber}`,