@movalib/movalib-commons 1.55.2 → 1.55.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.
- package/dist/src/components/QrCodePLVContainer/QrCodePLVContainer.js +1 -1
- package/dist/src/helpers/ApiHelper.js +2 -1
- package/package.json +2 -2
- package/src/components/QrCodePLVContainer/QrCodePLVContainer.tsx +2 -3
- package/src/helpers/ApiHelper.ts +3 -1
- /package/dist/src/{style → style/QRCode.css} +0 -0
|
@@ -132,7 +132,7 @@ var QrCodePLVContainer = function (_a) {
|
|
|
132
132
|
return function () { };
|
|
133
133
|
}
|
|
134
134
|
}, [selectedChoice, printA3PLV, printA4PLV, downloadQRCodeHeadless, downloadQrCodeWithCTA]);
|
|
135
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: '24px' }, { children: [(0, jsx_runtime_1.jsx)(PLVComponent_1.PLVComponent, { ref: PLVrefA4, url: data, printSize: PLVComponent_1.PrintSize.A4 }), (0, jsx_runtime_1.jsx)(PLVComponent_1.PLVComponent, { ref: PLVrefA3, url: data, printSize: PLVComponent_1.PrintSize.A3 }), (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, alignItems: 'center' }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 7 }, { children: (0, jsx_runtime_1.jsxs)(material_1.FormControl, __assign({ fullWidth: true, size: 'small' }, { children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, __assign({ id: 'qrcode-plv-select' }, { children: "Choisissez votre support" })), (0, jsx_runtime_1.jsxs)(material_1.Select, __assign({ labelId: 'qrcode-plv-select', label: 'Choisissez votre support', id: 'qrcode-plv-select', onChange: onChangeSelectedChoice, value: selectedChoice }, { children: [(0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 'A3' }, { children: "\uD83E\uDDFE\u00A0\u00A0PLV format A4" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 'A4' }, { children: "\uD83E\uDDFE\u00A0\u00A0PLV format A3" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 'QR_Google' }, { children: "QR Code format GoogleMyBusiness" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 'QR_Headless' }, { children: "QR Code seul" }))] }))] })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs:
|
|
135
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: '24px' }, { children: [(0, jsx_runtime_1.jsx)(PLVComponent_1.PLVComponent, { ref: PLVrefA4, url: data, printSize: PLVComponent_1.PrintSize.A4 }), (0, jsx_runtime_1.jsx)(PLVComponent_1.PLVComponent, { ref: PLVrefA3, url: data, printSize: PLVComponent_1.PrintSize.A3 }), (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, justifyContent: 'center', alignItems: 'center' }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 7 }, { children: (0, jsx_runtime_1.jsxs)(material_1.FormControl, __assign({ fullWidth: true, size: 'small' }, { children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, __assign({ id: 'qrcode-plv-select' }, { children: "Choisissez votre support" })), (0, jsx_runtime_1.jsxs)(material_1.Select, __assign({ labelId: 'qrcode-plv-select', label: 'Choisissez votre support', id: 'qrcode-plv-select', onChange: onChangeSelectedChoice, value: selectedChoice }, { children: [(0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 'A3' }, { children: "\uD83E\uDDFE\u00A0\u00A0PLV format A4" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 'A4' }, { children: "\uD83E\uDDFE\u00A0\u00A0PLV format A3" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 'QR_Google' }, { children: "QR Code format GoogleMyBusiness" })), (0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: 'QR_Headless' }, { children: "QR Code seul" }))] }))] })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 4, marginLeft: 3 }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ startIcon: selectedChoice === 'A3' || selectedChoice === 'A4' ? (0, jsx_runtime_1.jsx)(icons_material_1.DocumentScanner, {}) : (0, jsx_runtime_1.jsx)(icons_material_1.QrCode2, {}), onClick: onClickDownload, variant: 'outlined', disabled: !selectedChoice, sx: { color: (0, material_1.darken)(theme.palette.primary.main, 0.2), borderRadius: '10rem' } }, { children: selectedChoice === 'A3' || selectedChoice === 'A4' ? 'Imprimer' : 'Télécharger' })) }))] })), (0, jsx_runtime_1.jsx)("div", __assign({ id: 'qr-code-container', style: Tools_1.flexCenter }, { children: (0, jsx_runtime_1.jsx)("div", { ref: qrCodeRef, style: {
|
|
136
136
|
height: '300px',
|
|
137
137
|
width: '300px',
|
|
138
138
|
maxWidth: '300px !important',
|
|
@@ -19,6 +19,7 @@ function handleResponse(response) {
|
|
|
19
19
|
var contentType = response.headers.get("content-type");
|
|
20
20
|
var isJson = contentType && contentType.includes("application/json");
|
|
21
21
|
var dataPromise = isJson ? response.json() : response.text();
|
|
22
|
+
var location = response.headers.get('location');
|
|
22
23
|
return dataPromise.then(function (data) {
|
|
23
24
|
if (!response.ok) {
|
|
24
25
|
Logger_1.default.error(data);
|
|
@@ -39,7 +40,7 @@ function handleResponse(response) {
|
|
|
39
40
|
}
|
|
40
41
|
return { success: false, error: errorMsg };
|
|
41
42
|
}
|
|
42
|
-
return { success: true, data: data };
|
|
43
|
+
return { success: true, data: data, location: location };
|
|
43
44
|
});
|
|
44
45
|
}
|
|
45
46
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@movalib/movalib-commons",
|
|
3
|
-
"version": "1.55.
|
|
3
|
+
"version": "1.55.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",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"scripts": {
|
|
9
9
|
"start": "webpack-dev-server --entry ./devIndex.tsx --open",
|
|
10
10
|
"build": "rm -rf dist && tsc && npm run copy-assets",
|
|
11
|
-
"copy-assets": "cp -r src/assets/ dist/src/assets/ && cp -r src/style
|
|
11
|
+
"copy-assets": "cp -r src/assets/ dist/src/assets/ && cp -r src/style/ dist/src/style/",
|
|
12
12
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
13
13
|
"clean": "rm -rf dist node_modules package-lock.json"
|
|
14
14
|
},
|
|
@@ -154,7 +154,7 @@ export const QrCodePLVContainer = ({ data }: { data: string }) => {
|
|
|
154
154
|
<PLVComponent ref={PLVrefA4} url={data} printSize={PrintSize.A4} />
|
|
155
155
|
<PLVComponent ref={PLVrefA3} url={data} printSize={PrintSize.A3} />
|
|
156
156
|
|
|
157
|
-
<Grid container alignItems='center'>
|
|
157
|
+
<Grid container justifyContent='center' alignItems='center'>
|
|
158
158
|
<Grid item xs={7}>
|
|
159
159
|
<FormControl fullWidth size='small'>
|
|
160
160
|
<InputLabel id='qrcode-plv-select'>Choisissez votre support</InputLabel>
|
|
@@ -172,8 +172,7 @@ export const QrCodePLVContainer = ({ data }: { data: string }) => {
|
|
|
172
172
|
</Select>
|
|
173
173
|
</FormControl>
|
|
174
174
|
</Grid>
|
|
175
|
-
<Grid item xs={
|
|
176
|
-
<Grid item xs={4}>
|
|
175
|
+
<Grid item xs={4} marginLeft={3}>
|
|
177
176
|
<Button
|
|
178
177
|
startIcon={selectedChoice === 'A3' || selectedChoice === 'A4' ? <DocumentScanner /> : <QrCode2 />}
|
|
179
178
|
onClick={onClickDownload}
|
package/src/helpers/ApiHelper.ts
CHANGED
|
@@ -7,6 +7,7 @@ export const API_BASE_URL = process.env.REACT_APP_API_URL || 'https://localhost:
|
|
|
7
7
|
type APISuccess<T> = {
|
|
8
8
|
success: true;
|
|
9
9
|
data: T;
|
|
10
|
+
location: string
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
type APIError = {
|
|
@@ -44,6 +45,7 @@ function handleResponse(response: Response): Promise<APIResponse<any>> {
|
|
|
44
45
|
const contentType = response.headers.get("content-type");
|
|
45
46
|
const isJson = contentType && contentType.includes("application/json");
|
|
46
47
|
const dataPromise = isJson ? response.json() : response.text();
|
|
48
|
+
const location = response.headers.get('location');
|
|
47
49
|
|
|
48
50
|
return dataPromise.then(data => {
|
|
49
51
|
|
|
@@ -67,7 +69,7 @@ function handleResponse(response: Response): Promise<APIResponse<any>> {
|
|
|
67
69
|
return { success: false, error: errorMsg };
|
|
68
70
|
}
|
|
69
71
|
|
|
70
|
-
return { success: true, data };
|
|
72
|
+
return { success: true, data, location };
|
|
71
73
|
});
|
|
72
74
|
}
|
|
73
75
|
|
|
File without changes
|