@movalib/movalib-commons 1.59.36 → 1.59.38
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/src/MovaLogin.js +6 -5
- package/dist/src/assets/images/logo/header_logo_admin.png +0 -0
- package/dist/src/assets/images/logo/logo_admin_large.png +0 -0
- package/dist/src/components/vehicle/VehicleFullCard.d.ts +5 -5
- package/dist/src/components/vehicle/VehicleFullCard.js +101 -82
- package/dist/src/helpers/ApiHelper.js +5 -0
- package/dist/src/helpers/CookieUtils.d.ts +1 -0
- package/dist/src/helpers/CookieUtils.js +2 -1
- package/dist/src/helpers/Enums.d.ts +7 -6
- package/dist/src/helpers/Enums.js +6 -5
- package/dist/src/models/Document.d.ts +2 -1
- package/dist/src/models/Document.js +3 -5
- package/dist/src/models/Event.d.ts +12 -1
- package/dist/src/models/Event.js +2 -1
- package/dist/src/models/Product.d.ts +2 -1
- package/dist/src/models/Product.js +2 -1
- package/dist/src/services/AuthenticationService.d.ts +1 -1
- package/dist/src/services/AuthenticationService.js +38 -9
- package/dist/src/services/GarageService.d.ts +3 -1
- package/dist/src/services/GarageService.js +18 -4
- package/package.json +1 -1
- package/src/MovaLogin.tsx +6 -5
- package/src/assets/images/logo/header_logo_admin.png +0 -0
- package/src/assets/images/logo/logo_admin_large.png +0 -0
- package/src/components/vehicle/VehicleFullCard.tsx +847 -559
- package/src/helpers/ApiHelper.ts +6 -1
- package/src/helpers/CookieUtils.ts +1 -0
- package/src/helpers/Enums.ts +216 -217
- package/src/models/Document.ts +42 -37
- package/src/models/Event.ts +13 -1
- package/src/models/Product.ts +40 -26
- package/src/services/AuthenticationService.ts +31 -6
- package/src/services/GarageService.ts +667 -621
|
@@ -6,11 +6,12 @@ export default class Product {
|
|
|
6
6
|
name: string;
|
|
7
7
|
code: string;
|
|
8
8
|
type: ProductType;
|
|
9
|
+
order?: String;
|
|
9
10
|
orderPreference?: OrderPreference;
|
|
10
11
|
originReferences?: string[];
|
|
11
12
|
operation?: Operation;
|
|
12
13
|
orderState?: OrderState;
|
|
13
14
|
supplier?: Supplier;
|
|
14
15
|
application?: PartsApplicationType;
|
|
15
|
-
constructor(id: string, code: string, name: string, type: ProductType, orderPreference: OrderPreference, originReferences: string[]);
|
|
16
|
+
constructor(id: string, code: string, name: string, type: ProductType, orderPreference: OrderPreference, originReferences: string[], order?: string);
|
|
16
17
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var Product = /** @class */ (function () {
|
|
4
|
-
function Product(id, code, name, type, orderPreference, originReferences) {
|
|
4
|
+
function Product(id, code, name, type, orderPreference, originReferences, order) {
|
|
5
5
|
this.id = id;
|
|
6
6
|
this.name = name;
|
|
7
7
|
this.code = code;
|
|
8
8
|
this.type = type;
|
|
9
9
|
this.orderPreference = orderPreference;
|
|
10
10
|
this.originReferences = originReferences;
|
|
11
|
+
this.order = order;
|
|
11
12
|
}
|
|
12
13
|
return Product;
|
|
13
14
|
}());
|
|
@@ -6,5 +6,5 @@ export default class AuthenticationService {
|
|
|
6
6
|
static login(appType: MovaAppType, phoneEmail: string, password: string): Promise<APIResponse<User>>;
|
|
7
7
|
static ValidateSecurityCode(req: {
|
|
8
8
|
securityCode: string;
|
|
9
|
-
}): Promise<APIResponse<User>>;
|
|
9
|
+
}, appType?: MovaAppType): Promise<APIResponse<User>>;
|
|
10
10
|
}
|
|
@@ -86,6 +86,14 @@ var AuthenticationService = /** @class */ (function () {
|
|
|
86
86
|
password: password
|
|
87
87
|
};
|
|
88
88
|
break;
|
|
89
|
+
case Enums_1.MovaAppType.ADMIN:
|
|
90
|
+
url = "".concat(ApiHelper_1.API_BASE_URL, "/garage/login");
|
|
91
|
+
tokenCookie = CookieUtils_1.COOKIE_ADMIN_TOKEN;
|
|
92
|
+
req = {
|
|
93
|
+
email: phoneEmail,
|
|
94
|
+
password: password
|
|
95
|
+
};
|
|
96
|
+
break;
|
|
89
97
|
}
|
|
90
98
|
return [4 /*yield*/, (0, ApiHelper_1.request)({
|
|
91
99
|
url: url,
|
|
@@ -97,7 +105,7 @@ var AuthenticationService = /** @class */ (function () {
|
|
|
97
105
|
tokenResponse = _a.sent();
|
|
98
106
|
if (!tokenResponse.success) return [3 /*break*/, 3];
|
|
99
107
|
// CSM CASE
|
|
100
|
-
if (tokenResponse.data.accessToken === null && tokenResponse.data.role.includes('ROLE_CSM')) {
|
|
108
|
+
if (tokenResponse.data.accessToken === null && (tokenResponse.data.role.includes('ROLE_CSM') || tokenResponse.data.role.includes('ROLE_SUPER_ADMIN'))) {
|
|
101
109
|
return [2 /*return*/, { success: true, data: tokenResponse.data }];
|
|
102
110
|
}
|
|
103
111
|
Logger_1.default.info(tokenResponse);
|
|
@@ -123,13 +131,13 @@ var AuthenticationService = /** @class */ (function () {
|
|
|
123
131
|
});
|
|
124
132
|
});
|
|
125
133
|
};
|
|
126
|
-
AuthenticationService.ValidateSecurityCode = function (req) {
|
|
134
|
+
AuthenticationService.ValidateSecurityCode = function (req, appType) {
|
|
127
135
|
return __awaiter(this, void 0, void 0, function () {
|
|
128
136
|
var tokenResponse, tokenCookie, userResponse, errorMsg, error_2, errorMessage;
|
|
129
137
|
return __generator(this, function (_a) {
|
|
130
138
|
switch (_a.label) {
|
|
131
139
|
case 0:
|
|
132
|
-
_a.trys.push([0,
|
|
140
|
+
_a.trys.push([0, 8, , 9]);
|
|
133
141
|
return [4 /*yield*/, (0, ApiHelper_1.request)({
|
|
134
142
|
url: "".concat(ApiHelper_1.API_BASE_URL, "/check-security-code"),
|
|
135
143
|
method: Enums_1.APIMethod.POST,
|
|
@@ -138,26 +146,47 @@ var AuthenticationService = /** @class */ (function () {
|
|
|
138
146
|
case 1:
|
|
139
147
|
tokenResponse = _a.sent();
|
|
140
148
|
tokenCookie = CookieUtils_1.COOKIE_PRO_TOKEN;
|
|
141
|
-
if (
|
|
149
|
+
if (appType) {
|
|
150
|
+
switch (appType) {
|
|
151
|
+
case Enums_1.MovaAppType.GARAGE:
|
|
152
|
+
tokenCookie = CookieUtils_1.COOKIE_PRO_TOKEN;
|
|
153
|
+
break;
|
|
154
|
+
case Enums_1.MovaAppType.INDIVIDUAL:
|
|
155
|
+
tokenCookie = CookieUtils_1.COOKIE_INDIVIDUAL_TOKEN;
|
|
156
|
+
break;
|
|
157
|
+
case Enums_1.MovaAppType.ADMIN:
|
|
158
|
+
tokenCookie = CookieUtils_1.COOKIE_ADMIN_TOKEN;
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (!tokenResponse.success) return [3 /*break*/, 6];
|
|
142
163
|
Logger_1.default.info(tokenResponse);
|
|
143
164
|
(0, CookieUtils_1.createCookie)(tokenCookie, tokenResponse.data.accessToken);
|
|
144
|
-
|
|
165
|
+
userResponse = void 0;
|
|
166
|
+
if (!appType) return [3 /*break*/, 3];
|
|
167
|
+
return [4 /*yield*/, UserService_1.default.getCurrentUser(appType)];
|
|
145
168
|
case 2:
|
|
146
169
|
userResponse = _a.sent();
|
|
170
|
+
return [3 /*break*/, 5];
|
|
171
|
+
case 3: return [4 /*yield*/, UserService_1.default.getCurrentUser(Enums_1.MovaAppType.GARAGE)];
|
|
172
|
+
case 4:
|
|
173
|
+
userResponse = _a.sent();
|
|
174
|
+
_a.label = 5;
|
|
175
|
+
case 5:
|
|
147
176
|
if (!userResponse || !userResponse.success) {
|
|
148
177
|
errorMsg = 'Erreur au chargement de votre profil';
|
|
149
178
|
Logger_1.default.error(errorMsg);
|
|
150
179
|
return [2 /*return*/, { success: false, error: errorMsg }];
|
|
151
180
|
}
|
|
152
181
|
return [2 /*return*/, { success: true, data: userResponse.data }];
|
|
153
|
-
case
|
|
154
|
-
case
|
|
155
|
-
case
|
|
182
|
+
case 6: return [2 /*return*/, tokenResponse];
|
|
183
|
+
case 7: return [3 /*break*/, 9];
|
|
184
|
+
case 8:
|
|
156
185
|
error_2 = _a.sent();
|
|
157
186
|
Logger_1.default.error('Error occurred during login:', error_2);
|
|
158
187
|
errorMessage = error_2 instanceof Error ? error_2.message : 'Erreur inconnue';
|
|
159
188
|
return [2 /*return*/, { success: false, error: errorMessage }];
|
|
160
|
-
case
|
|
189
|
+
case 9: return [2 /*return*/];
|
|
161
190
|
}
|
|
162
191
|
});
|
|
163
192
|
});
|
|
@@ -19,7 +19,7 @@ export default class GarageService {
|
|
|
19
19
|
static sendGarageMandate(garageId: string): Promise<APIResponse<string>>;
|
|
20
20
|
static getGarageAllData(garageId: string): Promise<APIResponse<Garage>>;
|
|
21
21
|
static createGaragePrestationRequest(garageId: string, req: any): Promise<APIResponse<string>>;
|
|
22
|
-
static getGarageSettings({ garageId }: {
|
|
22
|
+
static getGarageSettings({ garageId, }: {
|
|
23
23
|
garageId: string;
|
|
24
24
|
}): Promise<APIResponse<Garage>>;
|
|
25
25
|
static uploadLogo(garageId: string, formData: FormData): Promise<APIResponse<string>>;
|
|
@@ -44,6 +44,8 @@ export default class GarageService {
|
|
|
44
44
|
static sendCustomerReminder(garageId: string, eventId: string, message: string): Promise<APIResponse<string>>;
|
|
45
45
|
static updateGarageEvent(garageId: string, eventId: string, req: any): Promise<APIResponse<string>>;
|
|
46
46
|
static sendSupplierRequest(garageId: string, eventId: string, req: any): Promise<APIResponse<string>>;
|
|
47
|
+
static deleteSupplierRequest(orderId: string): Promise<APIResponse<string>>;
|
|
48
|
+
static receiveSupplierRequest(orderId: string): Promise<APIResponse<string>>;
|
|
47
49
|
static deleteGarageSupplier(garageId: string, supplierId: string): Promise<APIResponse<string>>;
|
|
48
50
|
static createGarageSupplier(garageId: string, req: any): Promise<APIResponse<string>>;
|
|
49
51
|
static updateGarageSupplier(garageId: string, supplierId: number, req: any): Promise<APIResponse<string>>;
|
|
@@ -65,7 +65,7 @@ var GarageService = /** @class */ (function () {
|
|
|
65
65
|
url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/prestation-category/").concat(categoryCode, "/color"),
|
|
66
66
|
method: Enums_1.APIMethod.PATCH,
|
|
67
67
|
appType: Enums_1.MovaAppType.GARAGE,
|
|
68
|
-
body: JSON.stringify({ color: color })
|
|
68
|
+
body: JSON.stringify({ color: color }),
|
|
69
69
|
});
|
|
70
70
|
};
|
|
71
71
|
GarageService.updateGarageEventColor = function (garageId, eventId, color) {
|
|
@@ -73,7 +73,7 @@ var GarageService = /** @class */ (function () {
|
|
|
73
73
|
url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/event/").concat(eventId, "/color"),
|
|
74
74
|
method: Enums_1.APIMethod.PATCH,
|
|
75
75
|
appType: Enums_1.MovaAppType.GARAGE,
|
|
76
|
-
body: JSON.stringify({ color: color })
|
|
76
|
+
body: JSON.stringify({ color: color }),
|
|
77
77
|
});
|
|
78
78
|
};
|
|
79
79
|
GarageService.updateVehicleGarageEvent = function (garageId, eventId, req) {
|
|
@@ -81,7 +81,7 @@ var GarageService = /** @class */ (function () {
|
|
|
81
81
|
url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/event/").concat(eventId, "/vehicle"),
|
|
82
82
|
method: Enums_1.APIMethod.PATCH,
|
|
83
83
|
appType: Enums_1.MovaAppType.GARAGE,
|
|
84
|
-
body: JSON.stringify(req)
|
|
84
|
+
body: JSON.stringify(req),
|
|
85
85
|
});
|
|
86
86
|
};
|
|
87
87
|
GarageService.uploadEventDocument = function (garageId, eventId, req) {
|
|
@@ -89,7 +89,7 @@ var GarageService = /** @class */ (function () {
|
|
|
89
89
|
url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/event/").concat(eventId, "/documents"),
|
|
90
90
|
method: Enums_1.APIMethod.POST,
|
|
91
91
|
appType: Enums_1.MovaAppType.GARAGE,
|
|
92
|
-
body: req
|
|
92
|
+
body: req,
|
|
93
93
|
});
|
|
94
94
|
};
|
|
95
95
|
GarageService.deleteEventDocument = function (garageId, eventId, docId) {
|
|
@@ -294,6 +294,20 @@ var GarageService = /** @class */ (function () {
|
|
|
294
294
|
body: JSON.stringify(req),
|
|
295
295
|
});
|
|
296
296
|
};
|
|
297
|
+
GarageService.deleteSupplierRequest = function (orderId) {
|
|
298
|
+
return (0, ApiHelper_1.request)({
|
|
299
|
+
url: "".concat(ApiHelper_1.API_BASE_URL, "/order/").concat(orderId),
|
|
300
|
+
method: Enums_1.APIMethod.DELETE,
|
|
301
|
+
appType: Enums_1.MovaAppType.GARAGE,
|
|
302
|
+
});
|
|
303
|
+
};
|
|
304
|
+
GarageService.receiveSupplierRequest = function (orderId) {
|
|
305
|
+
return (0, ApiHelper_1.request)({
|
|
306
|
+
url: "".concat(ApiHelper_1.API_BASE_URL, "/order/").concat(orderId, "/receive"),
|
|
307
|
+
method: Enums_1.APIMethod.PATCH,
|
|
308
|
+
appType: Enums_1.MovaAppType.GARAGE,
|
|
309
|
+
});
|
|
310
|
+
};
|
|
297
311
|
GarageService.deleteGarageSupplier = function (garageId, supplierId) {
|
|
298
312
|
return (0, ApiHelper_1.request)({
|
|
299
313
|
url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/suppliers/").concat(supplierId),
|
package/package.json
CHANGED
package/src/MovaLogin.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import { CSSProperties, ChangeEvent, FormEvent, FunctionComponent, MouseEvent, R
|
|
|
2
2
|
import { LoadingButton } from '@mui/lab';
|
|
3
3
|
import LogoLarge from './assets/images/logo/logo_large_border.png';
|
|
4
4
|
import LogoProLarge from './assets/images/logo/logo_pro_large_border.png';
|
|
5
|
+
import LogoAdminLarge from './assets/images/logo/logo_admin_large.png';
|
|
5
6
|
import LogoLargeDarkMode from './assets/images/logo/logo_large_dm.png';
|
|
6
7
|
import LogoProLargeDarkMode from './assets/images/logo/logo_pro_large_dm.png';
|
|
7
8
|
import GreenLeafImage from "./assets/images/leaf_green_large.png";
|
|
@@ -93,7 +94,7 @@ const MovaLogin: FunctionComponent<MovaLoginProps> = ({ loading, movaAppType, on
|
|
|
93
94
|
let newForm: MovaLoginForm = { ...form };
|
|
94
95
|
|
|
95
96
|
// Validator pour les champs obligatoires
|
|
96
|
-
if(movaAppType === MovaAppType.GARAGE){
|
|
97
|
+
if(movaAppType === MovaAppType.GARAGE || movaAppType === MovaAppType.ADMIN){
|
|
97
98
|
newForm.email = validateField(form.email, value => !!value, 'Champ obligatoire');
|
|
98
99
|
// Validator pour l'email
|
|
99
100
|
newForm.email = validateField(form.email, validateEmail, 'Adresse email invalide');
|
|
@@ -112,7 +113,7 @@ const MovaLogin: FunctionComponent<MovaLoginProps> = ({ loading, movaAppType, on
|
|
|
112
113
|
|
|
113
114
|
setForm(newForm);
|
|
114
115
|
|
|
115
|
-
return newForm.password.isValid && (movaAppType === MovaAppType.GARAGE ? newForm.email.isValid : true)
|
|
116
|
+
return newForm.password.isValid && ((movaAppType === MovaAppType.GARAGE || movaAppType === MovaAppType.ADMIN) ? newForm.email.isValid : true)
|
|
116
117
|
&& (movaAppType === MovaAppType.INDIVIDUAL ? newForm.phoneNumberEmail.isValid : true) ;
|
|
117
118
|
}
|
|
118
119
|
|
|
@@ -125,7 +126,7 @@ const MovaLogin: FunctionComponent<MovaLoginProps> = ({ loading, movaAppType, on
|
|
|
125
126
|
} else {
|
|
126
127
|
return movaAppType === MovaAppType.GARAGE ? LogoProLarge :
|
|
127
128
|
movaAppType === MovaAppType.INDIVIDUAL ? LogoLarge :
|
|
128
|
-
movaAppType === MovaAppType.ADMIN ?
|
|
129
|
+
movaAppType === MovaAppType.ADMIN ? LogoAdminLarge : LogoLarge;
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
132
|
|
|
@@ -147,7 +148,7 @@ const MovaLogin: FunctionComponent<MovaLoginProps> = ({ loading, movaAppType, on
|
|
|
147
148
|
setOpenForgotPassword(false);
|
|
148
149
|
// On appel de callback de soumission de la demande de réinitialisation du mot de passe
|
|
149
150
|
if(onSubmitForgotPassword){
|
|
150
|
-
onSubmitForgotPassword(movaAppType === MovaAppType.GARAGE ? form.email.value : form.phoneNumberEmail.value);
|
|
151
|
+
onSubmitForgotPassword((movaAppType === MovaAppType.GARAGE || movaAppType === MovaAppType.ADMIN) ? form.email.value : form.phoneNumberEmail.value);
|
|
151
152
|
}
|
|
152
153
|
}
|
|
153
154
|
|
|
@@ -253,7 +254,7 @@ const MovaLogin: FunctionComponent<MovaLoginProps> = ({ loading, movaAppType, on
|
|
|
253
254
|
/>
|
|
254
255
|
}
|
|
255
256
|
|
|
256
|
-
{movaAppType === MovaAppType.GARAGE &&
|
|
257
|
+
{(movaAppType === MovaAppType.GARAGE || movaAppType === MovaAppType.ADMIN) &&
|
|
257
258
|
<TextField
|
|
258
259
|
margin="normal"
|
|
259
260
|
required
|
|
Binary file
|
|
Binary file
|