@movalib/movalib-commons 1.68.20 → 1.68.22

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.
@@ -13,7 +13,5 @@ type PLVComponentProps = {
13
13
  export declare class PLVComponent extends React.Component<PLVComponentProps> {
14
14
  render(): import("react/jsx-runtime").JSX.Element;
15
15
  }
16
- export declare class PLVComponentV2 extends React.Component<PLVComponentProps> {
17
- render(): import("react/jsx-runtime").JSX.Element;
18
- }
16
+ export declare const PLVComponentV2: React.ForwardRefExoticComponent<PLVComponentProps & React.RefAttributes<HTMLDivElement>>;
19
17
  export {};
@@ -127,20 +127,13 @@ var PLVComponent = /** @class */ (function (_super) {
127
127
  return PLVComponent;
128
128
  }(react_1.default.Component));
129
129
  exports.PLVComponent = PLVComponent;
130
- var PLVComponentV2 = /** @class */ (function (_super) {
131
- __extends(PLVComponentV2, _super);
132
- function PLVComponentV2() {
133
- return _super !== null && _super.apply(this, arguments) || this;
134
- }
135
- PLVComponentV2.prototype.render = function () {
136
- return ((0, jsx_runtime_1.jsx)("div", { className: 'printable-content', style: {
137
- width: this.props.printSize === PrintSize.A4 ? '210mm' : this.props.printSize === PrintSize.A3 ? '297mm' : '0mm',
138
- height: this.props.printSize === PrintSize.A4 ? '297mm' : this.props.printSize === PrintSize.A3 ? '420mm' : '0mm',
139
- }, children: (0, jsx_runtime_1.jsx)(material_1.Grid, { container: true, children: (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 12, children: (0, jsx_runtime_1.jsx)("img", { src: this.props.url, style: { display: 'block', width: '100%', height: '100%', objectFit: 'cover' } }) }) }) }));
140
- };
141
- return PLVComponentV2;
142
- }(react_1.default.Component));
143
- exports.PLVComponentV2 = PLVComponentV2;
130
+ exports.PLVComponentV2 = react_1.default.forwardRef(function (_a, ref) {
131
+ var url = _a.url, printSize = _a.printSize;
132
+ return ((0, jsx_runtime_1.jsx)("div", { ref: ref, className: 'printable-content', style: {
133
+ width: printSize === PrintSize.A4 ? '210mm' : printSize === PrintSize.A3 ? '297mm' : '0mm',
134
+ height: printSize === PrintSize.A4 ? '297mm' : printSize === PrintSize.A3 ? '420mm' : '0mm',
135
+ }, children: (0, jsx_runtime_1.jsx)(material_1.Grid, { container: true, children: (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 12, children: (0, jsx_runtime_1.jsx)("img", { src: url, style: { display: 'block', width: '100%', height: '100%', objectFit: 'cover' } }) }) }) }));
136
+ });
144
137
  // CSS pour cacher le contenu à l'écran mais le rendre imprimable
145
138
  var css = "\nbody {\n margin: 0;\n }\n .highlight {\n background-color: #BCD46C; /* Couleur de surlignage */\n margin: 4px 4px; /* Espacement autour du texte surlign\u00E9 */\n padding-left : 8px;\n padding-right: 8px;\n font-weight: 500;\n color: white;\n }\n .not-highlight {\n margin: 4px 4px; /* Espacement autour du texte surlign\u00E9 */\n padding-left : 8px;\n padding-right: 8px;\n color: #BCD46C;\n }\n\n .printable-content {\n margin: 0;\n padding: 0;\n visibility: hidden;\n position: absolute;\n left: -10000px;\n top: -10000px;\n\n }\n @media print {\n body {\n margin: 0;\n }\n .printable-content {\n margin: 0;\n padding: 0;\n visibility: visible;\n position: static;\n }\n }\n";
146
139
  var styleSheet = document.createElement('style');
@@ -76,3 +76,4 @@ export default class Garage {
76
76
  }
77
77
  export declare function isStockActive(g: Garage): boolean;
78
78
  export declare function getSetting(settings: Settings[], code: string): string | null;
79
+ export declare function getSettingBool(settings: Settings[], code: string): boolean;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isStockActive = isStockActive;
4
4
  exports.getSetting = getSetting;
5
+ exports.getSettingBool = getSettingBool;
5
6
  var Settings_1 = require("./Settings");
6
7
  var Garage = /** @class */ (function () {
7
8
  function Garage(id, adminId, name, address, workforce, prestations, schedules, contactPhone, secondaryContactPhone, prestationCategories, dayPeriodFastServiceExcluded, loanerVehicleFastServiceExcluded, fastServiceThreshold, timezone, settings, vehicles, contactEmail, logo, suppliers, documents, subscriptions, loanerVehicleActive, loanerVehicleRequestActive, customStyle, subscription, partialWorkforce, mailCustomization, billingActive, billingToken, legacyQuoteActive, appId, establishmentRegistrationNumber, companyRegistrationNumber, reopeningDate, targetMargin, demoBillingActive, onlyBilling, newDocumentEditor, googleReviewUrl, isOnlineAppointment, isOnlineQuote) {
@@ -63,3 +64,7 @@ function getSetting(settings, code) {
63
64
  var _a, _b;
64
65
  return (_b = (_a = settings.find(function (s) { return s.code === code; })) === null || _a === void 0 ? void 0 : _a.valueText) !== null && _b !== void 0 ? _b : null;
65
66
  }
67
+ function getSettingBool(settings, code) {
68
+ var _a, _b;
69
+ return (_b = (_a = settings.find(function (s) { return s.code === code; })) === null || _a === void 0 ? void 0 : _a.valueBoolean) !== null && _b !== void 0 ? _b : false;
70
+ }
@@ -1,5 +1,6 @@
1
1
  export declare enum SettingsEnumCode {
2
- STOCK_MODULE_ENABLED = "STOCK_MODULE_ENABLED"
2
+ STOCK_MODULE_ENABLED = "STOCK_MODULE_ENABLED",
3
+ NO_PHONE_CUSTOMER_CREATION = "NO_PHONE_CUSTOMER_CREATION"
3
4
  }
4
5
  export default class Settings {
5
6
  code: SettingsEnumCode;
@@ -4,6 +4,7 @@ exports.SettingsEnumCode = void 0;
4
4
  var SettingsEnumCode;
5
5
  (function (SettingsEnumCode) {
6
6
  SettingsEnumCode["STOCK_MODULE_ENABLED"] = "STOCK_MODULE_ENABLED";
7
+ SettingsEnumCode["NO_PHONE_CUSTOMER_CREATION"] = "NO_PHONE_CUSTOMER_CREATION";
7
8
  })(SettingsEnumCode || (exports.SettingsEnumCode = SettingsEnumCode = {}));
8
9
  var Settings = /** @class */ (function () {
9
10
  function Settings(code, valueBoolean, valueText, valueNumber) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movalib/movalib-commons",
3
- "version": "1.68.20",
3
+ "version": "1.68.22",
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",
@@ -181,28 +181,26 @@ export class PLVComponent extends React.Component<PLVComponentProps> {
181
181
 
182
182
 
183
183
 
184
- export class PLVComponentV2 extends React.Component<PLVComponentProps> {
185
- render() {
184
+ export const PLVComponentV2 = React.forwardRef<HTMLDivElement, PLVComponentProps>(
185
+ ({ url, printSize }, ref) => {
186
186
  return (
187
187
  <div
188
+ ref={ref}
188
189
  className='printable-content'
189
190
  style={{
190
- width:
191
- this.props.printSize === PrintSize.A4 ? '210mm' : this.props.printSize === PrintSize.A3 ? '297mm' : '0mm',
192
- height:
193
- this.props.printSize === PrintSize.A4 ? '297mm' : this.props.printSize === PrintSize.A3 ? '420mm' : '0mm',
191
+ width: printSize === PrintSize.A4 ? '210mm' : printSize === PrintSize.A3 ? '297mm' : '0mm',
192
+ height: printSize === PrintSize.A4 ? '297mm' : printSize === PrintSize.A3 ? '420mm' : '0mm',
194
193
  }}
195
194
  >
196
- <Grid container>
195
+ <Grid container>
197
196
  <Grid item xs={12}>
198
- <img src={this.props.url} style={{ display: 'block', width: '100%', height: '100%', objectFit: 'cover' }} />
197
+ <img src={url} style={{ display: 'block', width: '100%', height: '100%', objectFit: 'cover' }} />
199
198
  </Grid>
200
199
  </Grid>
201
200
  </div>
202
201
  );
203
202
  }
204
- }
205
-
203
+ );
206
204
  // CSS pour cacher le contenu à l'écran mais le rendre imprimable
207
205
  const css = `
208
206
  body {
@@ -37,8 +37,8 @@ export const QrCodePLVContainer = ({ data }: { data: string }) => {
37
37
 
38
38
  const qrCodeRef = useRef<HTMLDivElement>(null);
39
39
  const theme = useTheme();
40
- const PLVrefA4 = useRef<PLVComponentV2>(null);
41
- const PLVrefA3 = useRef<PLVComponentV2>(null);
40
+ const PLVrefA4 = useRef<HTMLDivElement>(null);
41
+ const PLVrefA3 = useRef<HTMLDivElement>(null);
42
42
  //si sur l'impression des PLV en A4 ou A3 le Qrcode est flou,
43
43
  //il faut modifier la width et height, imageSize du qrCodeOptions et mettre les mêmes valeurs que dans le optionQrcode de la fonction printPLV
44
44
  const qrCodeOptions: Options = useMemo(
@@ -234,17 +234,15 @@ const blob = new Blob([modifiedPdfBytes.buffer as ArrayBuffer], { type: "applica
234
234
  }
235
235
  setSelectedChoice(e.target.value as SelectChoice);
236
236
  };
237
+ const printA3PLV = useReactToPrint({
238
+ contentRef: PLVrefA3,
239
+ documentTitle: "Movalib_PLV_A3",
240
+ });
237
241
 
238
- const printA3PLV = useReactToPrint({
239
- contentRef: PLVrefA3 as unknown as React.RefObject<HTMLElement>,
240
- documentTitle: "Movalib_PLV_A3",
241
- });
242
-
243
- const printA4PLV = useReactToPrint({
244
- contentRef: PLVrefA4 as unknown as React.RefObject<HTMLElement>,
245
- documentTitle: "Movalib_PLV_A4",
246
- });
247
-
242
+ const printA4PLV = useReactToPrint({
243
+ contentRef: PLVrefA4,
244
+ documentTitle: "Movalib_PLV_A4",
245
+ });
248
246
  const onClickDownload = useMemo(() => {
249
247
  switch (selectedChoice) {
250
248
  case "A3":
@@ -169,4 +169,8 @@ export function isStockActive (g: Garage): boolean {
169
169
  }
170
170
  export function getSetting(settings: Settings[], code: string): string | null {
171
171
  return settings.find((s) => s.code === code)?.valueText ?? null;
172
+
173
+ }
174
+ export function getSettingBool(settings: Settings[], code: string): boolean {
175
+ return settings.find((s) => s.code === code)?.valueBoolean ?? false;
172
176
  }
@@ -1,5 +1,6 @@
1
1
  export enum SettingsEnumCode {
2
- STOCK_MODULE_ENABLED = "STOCK_MODULE_ENABLED"
2
+ STOCK_MODULE_ENABLED = "STOCK_MODULE_ENABLED",
3
+ NO_PHONE_CUSTOMER_CREATION = "NO_PHONE_CUSTOMER_CREATION"
3
4
  }
4
5
  export default class Settings {
5
6