@movalib/movalib-commons 1.38.0 → 1.40.0

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.
@@ -1,15 +1,13 @@
1
1
  import React, { FunctionComponent } from 'react';
2
- import { SxProps, Theme } from '@mui/material';
3
- interface ConfirmationDialogProps {
4
- open: boolean;
5
- onClose: () => void;
2
+ import { type DialogProps } from '@mui/material/Dialog';
3
+ type ConfirmationDialogProps = DialogProps & {
4
+ onClose?: () => void;
6
5
  onConfirm?: () => void;
7
6
  showConfirm?: boolean;
8
7
  confirmLabel?: string;
9
8
  closeLabel?: string;
10
9
  title?: React.ReactNode;
11
10
  message?: React.ReactNode;
12
- sx?: SxProps<Theme>;
13
- }
11
+ };
14
12
  declare const ConfirmationDialog: FunctionComponent<ConfirmationDialogProps>;
15
13
  export default ConfirmationDialog;
@@ -10,6 +10,17 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
13
24
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
25
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
26
  };
@@ -24,13 +35,13 @@ var Button_1 = __importDefault(require("@mui/material/Button"));
24
35
  var material_1 = require("@mui/material");
25
36
  var Tools_1 = require("./helpers/Tools");
26
37
  var ConfirmationDialog = function (_a) {
27
- var open = _a.open, onClose = _a.onClose, onConfirm = _a.onConfirm, title = _a.title, message = _a.message, _b = _a.showConfirm, showConfirm = _b === void 0 ? true : _b, confirmLabel = _a.confirmLabel, closeLabel = _a.closeLabel, sx = _a.sx;
38
+ var open = _a.open, onClose = _a.onClose, onConfirm = _a.onConfirm, title = _a.title, message = _a.message, _b = _a.showConfirm, showConfirm = _b === void 0 ? true : _b, confirmLabel = _a.confirmLabel, closeLabel = _a.closeLabel, dialogProps = __rest(_a, ["open", "onClose", "onConfirm", "title", "message", "showConfirm", "confirmLabel", "closeLabel"]);
28
39
  var theme = (0, material_1.useTheme)();
29
40
  var defaultMessage = "Êtes-vous sûr de vouloir continuer ?";
30
41
  var defaultTitle = "Confirmation";
31
42
  var defaultConfirmLabel = "Oui";
32
43
  var defaultCloseLabel = "Non";
33
- return ((0, jsx_runtime_1.jsxs)(Dialog_1.default, __assign({ open: open, onClose: onClose, "aria-labelledby": "alert-dialog-title", "aria-describedby": "alert-dialog-description", sx: __assign({}, sx) }, { children: [(0, jsx_runtime_1.jsx)(DialogTitle_1.default, __assign({ id: "alert-dialog-title", sx: {
44
+ return ((0, jsx_runtime_1.jsxs)(Dialog_1.default, __assign({ open: open, onClose: onClose, "aria-labelledby": "alert-dialog-title", "aria-describedby": "alert-dialog-description" }, dialogProps, { children: [(0, jsx_runtime_1.jsx)(DialogTitle_1.default, __assign({ id: "alert-dialog-title", sx: {
34
45
  backgroundColor: theme.palette.grey[200]
35
46
  }, style: Tools_1.flexLeftRow }, { children: title || defaultTitle })), (0, jsx_runtime_1.jsx)(DialogContent_1.default, __assign({ sx: { textAlign: 'center' } }, { children: (0, jsx_runtime_1.jsx)(DialogContentText_1.default, __assign({ id: "alert-dialog-description", sx: { pt: 2 } }, { children: message || defaultMessage })) })), (0, jsx_runtime_1.jsxs)(DialogActions_1.default, __assign({ sx: {
36
47
  py: 1,
@@ -31,4 +31,7 @@ export default class GarageService {
31
31
  static createGarageSupplier(garageId: string, req: any): Promise<APIResponse<string>>;
32
32
  static updateGarage(garageId: string, req: any): Promise<APIResponse<string>>;
33
33
  static getAdministratedGarages(): Promise<APIResponse<Garage[]>>;
34
+ static sendGarageSupportRequest(garageId: string, req: {
35
+ message: string;
36
+ }): Promise<APIResponse<string>>;
34
37
  }
@@ -226,6 +226,14 @@ var GarageService = /** @class */ (function () {
226
226
  appType: Enums_1.MovaAppType.GARAGE
227
227
  });
228
228
  };
229
+ GarageService.sendGarageSupportRequest = function (garageId, req) {
230
+ return (0, ApiHelper_1.request)({
231
+ url: "".concat(ApiHelper_1.API_BASE_URL, "/garage/").concat(garageId, "/support-request"),
232
+ method: Enums_1.APIMethod.POST,
233
+ appType: Enums_1.MovaAppType.GARAGE,
234
+ body: JSON.stringify(req)
235
+ });
236
+ };
229
237
  return GarageService;
230
238
  }());
231
239
  exports.default = GarageService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movalib/movalib-commons",
3
- "version": "1.38.0",
3
+ "version": "1.40.0",
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,27 +1,25 @@
1
1
  import React, { FunctionComponent } from 'react';
2
- import Dialog from '@mui/material/Dialog';
2
+ import Dialog, { type DialogProps } from '@mui/material/Dialog';
3
3
  import DialogActions from '@mui/material/DialogActions';
4
4
  import DialogContent from '@mui/material/DialogContent';
5
5
  import DialogContentText from '@mui/material/DialogContentText';
6
6
  import DialogTitle from '@mui/material/DialogTitle';
7
7
  import Button from '@mui/material/Button';
8
- import { SxProps, Theme, useTheme } from '@mui/material';
8
+ import { useTheme } from '@mui/material';
9
9
  import { flexLeftRow } from './helpers/Tools';
10
10
 
11
- interface ConfirmationDialogProps {
12
- open: boolean;
13
- onClose: () => void;
11
+ type ConfirmationDialogProps = DialogProps & {
12
+ onClose?: () => void;
14
13
  onConfirm?: () => void;
15
14
  showConfirm?: boolean;
16
15
  confirmLabel?: string;
17
16
  closeLabel?: string;
18
17
  title?: React.ReactNode;
19
18
  message?: React.ReactNode;
20
- sx?: SxProps<Theme>;
21
19
  }
22
20
 
23
21
  const ConfirmationDialog: FunctionComponent<ConfirmationDialogProps> = ({ open, onClose, onConfirm, title, message, showConfirm = true,
24
- confirmLabel, closeLabel, sx }) => {
22
+ confirmLabel, closeLabel, ...dialogProps }) => {
25
23
 
26
24
  const theme = useTheme();
27
25
  const defaultMessage = "Êtes-vous sûr de vouloir continuer ?";
@@ -35,7 +33,7 @@ const ConfirmationDialog: FunctionComponent<ConfirmationDialogProps> = ({ open,
35
33
  onClose={onClose}
36
34
  aria-labelledby="alert-dialog-title"
37
35
  aria-describedby="alert-dialog-description"
38
- sx={{ ...sx }}
36
+ {...dialogProps}
39
37
  >
40
38
  <DialogTitle id="alert-dialog-title" sx={{
41
39
  backgroundColor: theme.palette.grey[200]
@@ -64,4 +62,4 @@ const ConfirmationDialog: FunctionComponent<ConfirmationDialogProps> = ({ open,
64
62
  );
65
63
  }
66
64
 
67
- export default ConfirmationDialog;
65
+ export default ConfirmationDialog;
@@ -2,7 +2,6 @@ import { APIResponse, API_BASE_URL, request } from "../helpers/ApiHelper";
2
2
  import { APIMethod, MovaAppType } from "../helpers/Enums";
3
3
  import Employee from "../models/Employee";
4
4
  import Garage from "../models/Garage";
5
- import Subscription from "../models/Subscription";
6
5
 
7
6
  export default class GarageService {
8
7
 
@@ -262,4 +261,13 @@ export default class GarageService {
262
261
  });
263
262
  }
264
263
 
265
- }
264
+ static sendGarageSupportRequest(garageId: string, req: { message: string }): Promise<APIResponse<string>> {
265
+ return request({
266
+ url: `${API_BASE_URL}/garage/${garageId}/support-request`,
267
+ method: APIMethod.POST,
268
+ appType: MovaAppType.GARAGE,
269
+ body: JSON.stringify(req)
270
+ });
271
+ }
272
+
273
+ }