@movalib/movalib-commons 1.64.3 → 1.64.4

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.
@@ -58,10 +58,11 @@ export default class Garage {
58
58
  billingActive?: boolean;
59
59
  billingToken?: string;
60
60
  billingSimulationActive?: boolean;
61
+ demoBillingActive?: boolean;
61
62
  appId?: number;
62
63
  quoteRequestStart?: Date;
63
64
  companyRegistrationNumber?: string;
64
65
  establishmentRegistrationNumber?: string;
65
66
  reopeningDate?: Date;
66
- constructor(id: string, adminId: string, name: string, address: Address, workforce: number, prestations: Prestation[], schedules: Schedule[], contactPhone: string, prestationCategories: CategoryPrestation[], dayPeriodFastServiceExcluded: boolean, loanerVehicleFastServiceExcluded: boolean, fastServiceThreshold: number, timezone: string, vehicles?: VehicleGarage[], contactEmail?: string, logo?: string, suppliers?: Supplier[], documents?: Document[], subscriptions?: Subscription[], loanerVehicleActive?: boolean, loanerVehicleRequestActive?: boolean, customStyle?: string, subscription?: Subscription, partialWorkforce?: number, mailCustomization?: boolean, billingActive?: boolean, billingToken?: string, billingSimulationActive?: boolean, appId?: number, establishmentRegistrationNumber?: string, companyRegistrationNumber?: string, quoteRequestStart?: Date, reopeningDate?: Date);
67
+ constructor(id: string, adminId: string, name: string, address: Address, workforce: number, prestations: Prestation[], schedules: Schedule[], contactPhone: string, prestationCategories: CategoryPrestation[], dayPeriodFastServiceExcluded: boolean, loanerVehicleFastServiceExcluded: boolean, fastServiceThreshold: number, timezone: string, vehicles?: VehicleGarage[], contactEmail?: string, logo?: string, suppliers?: Supplier[], documents?: Document[], subscriptions?: Subscription[], loanerVehicleActive?: boolean, loanerVehicleRequestActive?: boolean, customStyle?: string, subscription?: Subscription, partialWorkforce?: number, mailCustomization?: boolean, billingActive?: boolean, billingToken?: string, billingSimulationActive?: boolean, appId?: number, establishmentRegistrationNumber?: string, companyRegistrationNumber?: string, quoteRequestStart?: Date, reopeningDate?: Date, demoBillingActive?: boolean);
67
68
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var Garage = /** @class */ (function () {
4
- function Garage(id, adminId, name, address, workforce, prestations, schedules, contactPhone, prestationCategories, dayPeriodFastServiceExcluded, loanerVehicleFastServiceExcluded, fastServiceThreshold, timezone, vehicles, contactEmail, logo, suppliers, documents, subscriptions, loanerVehicleActive, loanerVehicleRequestActive, customStyle, subscription, partialWorkforce, mailCustomization, billingActive, billingToken, billingSimulationActive, appId, establishmentRegistrationNumber, companyRegistrationNumber, quoteRequestStart, reopeningDate) {
4
+ function Garage(id, adminId, name, address, workforce, prestations, schedules, contactPhone, prestationCategories, dayPeriodFastServiceExcluded, loanerVehicleFastServiceExcluded, fastServiceThreshold, timezone, vehicles, contactEmail, logo, suppliers, documents, subscriptions, loanerVehicleActive, loanerVehicleRequestActive, customStyle, subscription, partialWorkforce, mailCustomization, billingActive, billingToken, billingSimulationActive, appId, establishmentRegistrationNumber, companyRegistrationNumber, quoteRequestStart, reopeningDate, demoBillingActive) {
5
5
  this.id = id;
6
6
  this.adminId = adminId;
7
7
  this.name = name;
@@ -35,6 +35,7 @@ var Garage = /** @class */ (function () {
35
35
  this.companyRegistrationNumber = companyRegistrationNumber;
36
36
  this.establishmentRegistrationNumber = establishmentRegistrationNumber;
37
37
  this.reopeningDate = reopeningDate;
38
+ this.demoBillingActive = demoBillingActive;
38
39
  }
39
40
  return Garage;
40
41
  }());
@@ -8,6 +8,7 @@ export default class GarageService {
8
8
  static toogleUrgentQuote(garageId: string, quoteId: string): Promise<APIResponse<string>>;
9
9
  static updatePaymentAuthorization(garageId: string, req: any): Promise<APIResponse<string>>;
10
10
  static toogleGaragePaymentAuthorization(garageId: string): Promise<APIResponse<string>>;
11
+ static toogleGarageSimulationDemoBilling(garageId: string): Promise<APIResponse<string>>;
11
12
  static toogleEventVehicleReceived(garageId: string, eventId: string): Promise<APIResponse<string>>;
12
13
  static setOrderedEvent(garageId: string, eventId: string, req: any): Promise<APIResponse<string>>;
13
14
  static deleteEventEmployee(garageId: string, eventId: string): Promise<APIResponse<string>>;
@@ -38,6 +38,13 @@ var GarageService = /** @class */ (function () {
38
38
  appType: Enums_1.MovaAppType.GARAGE,
39
39
  });
40
40
  };
41
+ GarageService.toogleGarageSimulationDemoBilling = function (garageId) {
42
+ return (0, ApiHelper_1.request)({
43
+ url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/demo-billing/toggle"),
44
+ method: Enums_1.APIMethod.PATCH,
45
+ appType: Enums_1.MovaAppType.GARAGE,
46
+ });
47
+ };
41
48
  GarageService.toogleEventVehicleReceived = function (garageId, eventId) {
42
49
  return (0, ApiHelper_1.request)({
43
50
  url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/events/").concat(eventId, "/vehicle-received"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movalib/movalib-commons",
3
- "version": "1.64.3",
3
+ "version": "1.64.4",
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",
@@ -1,104 +1,104 @@
1
1
  import { Gender, RoleType } from "../helpers/Enums";
2
- import Address from './Address';
2
+ import Address from "./Address";
3
3
  import Garage from "./Garage";
4
4
  import Role from "./Role";
5
5
  import Vehicle from "./Vehicle";
6
6
 
7
7
  export default class User {
8
-
9
- // Properties
10
- id: string;
11
- roles: Role[];
12
- firstname: string;
13
- lastname: string;
14
- avatar: string;
15
- password: string;
16
- created: Date;
17
- email?: string;
18
- gender?: Gender;
19
- birthDate?: Date;
20
- addresses? : Address[]
21
- phoneNumber?: string;
22
- vehicles?: Vehicle[];
23
- isActive?: Boolean;
24
- hasPassword?: Boolean;
25
- garages?: Garage[];
26
-
27
- constructor(
28
- id: string,
29
- roles: Role[],
30
- firstname: string = '',
31
- lastname: string = '',
32
- avatar: string = '',
33
- password: string = '',
34
- created: Date = new Date(),
35
- email?: string,
36
- gender?: Gender,
37
- birthDate?: Date,
38
- addresses?: Address[],
39
- phoneNumber?: string ,
40
- vehicles?: Vehicle[],
41
- isActive?: Boolean,
42
- hasPassword?: Boolean,
43
- garages?: Garage[]
44
- ) {
45
- this.id = id;
46
- this.roles = roles;
47
- this.firstname = firstname;
48
- this.lastname = lastname;
49
- this.avatar = avatar;
50
- this.email = email;
51
- this.password = password;
52
- this.created = created;
53
- this.gender = gender;
54
- this.birthDate = birthDate;
55
- this.addresses = addresses;
56
- this.phoneNumber = phoneNumber;
57
- this.vehicles = vehicles;
58
- this.isActive = isActive;
59
- this.hasPassword = hasPassword;
60
- this.garages = garages;
61
- }
62
-
63
- static getFirstLetter = (user: User) : string => {
64
-
65
- const firstLetter = user.lastname[0].toUpperCase();
66
- return /[0-9]/.test(firstLetter) ? '0-9' : firstLetter;
67
- }
68
-
69
- static isGarageCustomer = (user: User) : boolean => {
70
- if(!user || !user.roles) return false;
71
-
72
- return Boolean(user.roles.find(r => r.name === RoleType.GARAGE_CUSTOMER));
73
- }
74
-
75
- static isGarageTechnician = (user: User) : boolean => {
76
- if(!user || !user.roles) return false;
77
-
78
- return Boolean(user.roles.find(r => r.name === RoleType.GARAGE_TECHNICIAN));
79
- }
80
-
81
- static isGarageAdmin = (user: User) : boolean => {
82
- if(!user || !user.roles) return false;
83
-
84
- return Boolean(user.roles.find(r => r.name === RoleType.GARAGE_ADMIN));
85
- }
86
-
87
- static isSales = (user: User) : boolean => {
88
- if(!user || !user.roles) return false;
89
-
90
- return Boolean(user.roles.find(r => r.name === RoleType.SALES));
91
- }
92
-
93
- static isCsM = (user: User) : boolean => {
94
- if(!user || !user.roles) return false;
95
-
96
- return Boolean(user.roles.find(r => r.name === RoleType.CSM));
97
- }
98
-
99
- static isSuperAdmin = (user: User) : boolean => {
100
- if(!user || !user.roles) return false;
101
-
102
- return Boolean(user.roles.find(r => r.name === RoleType.SUPER_ADMIN));
103
- }
104
- }
8
+ // Properties
9
+ id: string;
10
+ roles: Role[];
11
+ firstname: string;
12
+ lastname: string;
13
+ avatar: string;
14
+ password: string;
15
+ created: Date;
16
+ billingAddress?: Address;
17
+ email?: string;
18
+ gender?: Gender;
19
+ birthDate?: Date;
20
+ phoneNumber?: string;
21
+ vehicles?: Vehicle[];
22
+ isActive?: Boolean;
23
+ hasPassword?: Boolean;
24
+ garages?: Garage[];
25
+
26
+ constructor(
27
+ id: string,
28
+ roles: Role[],
29
+ firstname: string = "",
30
+ lastname: string = "",
31
+ avatar: string = "",
32
+ password: string = "",
33
+ created: Date = new Date(),
34
+ billingAddress?: Address,
35
+ email?: string,
36
+ gender?: Gender,
37
+ birthDate?: Date,
38
+ phoneNumber?: string,
39
+ vehicles?: Vehicle[],
40
+ isActive?: Boolean,
41
+ hasPassword?: Boolean,
42
+ garages?: Garage[]
43
+ ) {
44
+ this.id = id;
45
+ this.roles = roles;
46
+ this.firstname = firstname;
47
+ this.lastname = lastname;
48
+ this.avatar = avatar;
49
+ this.email = email;
50
+ this.password = password;
51
+ this.created = created;
52
+ this.gender = gender;
53
+ this.birthDate = birthDate;
54
+ this.billingAddress = billingAddress;
55
+ this.phoneNumber = phoneNumber;
56
+ this.vehicles = vehicles;
57
+ this.isActive = isActive;
58
+ this.hasPassword = hasPassword;
59
+ this.garages = garages;
60
+ }
61
+
62
+ static getFirstLetter = (user: User): string => {
63
+ const firstLetter = user.lastname[0].toUpperCase();
64
+ return /[0-9]/.test(firstLetter) ? "0-9" : firstLetter;
65
+ };
66
+
67
+ static isGarageCustomer = (user: User): boolean => {
68
+ if (!user || !user.roles) return false;
69
+
70
+ return Boolean(user.roles.find((r) => r.name === RoleType.GARAGE_CUSTOMER));
71
+ };
72
+
73
+ static isGarageTechnician = (user: User): boolean => {
74
+ if (!user || !user.roles) return false;
75
+
76
+ return Boolean(
77
+ user.roles.find((r) => r.name === RoleType.GARAGE_TECHNICIAN)
78
+ );
79
+ };
80
+
81
+ static isGarageAdmin = (user: User): boolean => {
82
+ if (!user || !user.roles) return false;
83
+
84
+ return Boolean(user.roles.find((r) => r.name === RoleType.GARAGE_ADMIN));
85
+ };
86
+
87
+ static isSales = (user: User): boolean => {
88
+ if (!user || !user.roles) return false;
89
+
90
+ return Boolean(user.roles.find((r) => r.name === RoleType.SALES));
91
+ };
92
+
93
+ static isCsM = (user: User): boolean => {
94
+ if (!user || !user.roles) return false;
95
+
96
+ return Boolean(user.roles.find((r) => r.name === RoleType.CSM));
97
+ };
98
+
99
+ static isSuperAdmin = (user: User): boolean => {
100
+ if (!user || !user.roles) return false;
101
+
102
+ return Boolean(user.roles.find((r) => r.name === RoleType.SUPER_ADMIN));
103
+ };
104
+ }