@digigov/ui 1.1.2-fd2cea11 → 1.1.2
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/CHANGELOG.md +9 -1
- package/app/QrCodeScanner/index.d.ts +1 -1
- package/app/QrCodeScanner/index.js +11 -8
- package/cjs/app/QrCodeScanner/index.js +11 -8
- package/index.js +1 -1
- package/package.json +6 -5
- package/src/app/QrCodeScanner/index.tsx +14 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
# Change Log - @digigov/ui
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 16 Feb 2024 09:57:32 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 1.1.2
|
|
6
|
+
Fri, 16 Feb 2024 09:57:32 GMT
|
|
7
|
+
|
|
8
|
+
### Patches
|
|
9
|
+
|
|
10
|
+
- Change empty array with results data add click event to arrow for all values option
|
|
11
|
+
- Improve URL parsing for QRCodeScanner when using dataType=`url`
|
|
4
12
|
|
|
5
13
|
## 1.1.1
|
|
6
14
|
Mon, 29 Jan 2024 17:45:11 GMT
|
|
@@ -5,7 +5,7 @@ export interface QrCodeScannerProps {
|
|
|
5
5
|
legacyMode?: boolean;
|
|
6
6
|
validate?: (...args: any[]) => boolean;
|
|
7
7
|
onScan: (...args: any[]) => void;
|
|
8
|
-
onError: (err: any) => void;
|
|
8
|
+
onError: (err: any, data: any) => void;
|
|
9
9
|
onLoad?: (...args: any[]) => void;
|
|
10
10
|
onImageLoad?: (...args: any[]) => void;
|
|
11
11
|
delay?: number;
|
|
@@ -38,18 +38,21 @@ export var QrCodeScanner = function QrCodeScanner(_ref) {
|
|
|
38
38
|
}
|
|
39
39
|
var handleOnScan = function handleOnScan(data) {
|
|
40
40
|
if (data) {
|
|
41
|
+
debugger;
|
|
41
42
|
if (dataType === 'url') {
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
try {
|
|
44
|
+
new URL(data);
|
|
45
|
+
} catch (e) {
|
|
46
|
+
return onError(new Error('@digigov-ui XSS Validation failed: qr code payload should follow the pattern `https://dilosi.services.gov.gr/show/:reference_code`'), data);
|
|
44
47
|
}
|
|
45
48
|
}
|
|
46
|
-
// run a validator function provided by the application code
|
|
47
|
-
if (validate && !validate(data)) {
|
|
48
|
-
return onError(new Error('Custom QR Code payload validation failed'));
|
|
49
|
-
}
|
|
50
|
-
// proceed with application defined callback function
|
|
51
|
-
onScan(data);
|
|
52
49
|
}
|
|
50
|
+
// run a validator function provided by the application code
|
|
51
|
+
if (validate && !validate(data)) {
|
|
52
|
+
return onError(new Error('Custom QR Code payload validation failed'), data);
|
|
53
|
+
}
|
|
54
|
+
// proceed with application defined callback function
|
|
55
|
+
onScan(data);
|
|
53
56
|
};
|
|
54
57
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(QrReader, _extends({
|
|
55
58
|
delay: 100,
|
|
@@ -50,18 +50,21 @@ var QrCodeScanner = exports.QrCodeScanner = function QrCodeScanner(_ref) {
|
|
|
50
50
|
}
|
|
51
51
|
var handleOnScan = function handleOnScan(data) {
|
|
52
52
|
if (data) {
|
|
53
|
+
debugger;
|
|
53
54
|
if (dataType === 'url') {
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
try {
|
|
56
|
+
new URL(data);
|
|
57
|
+
} catch (e) {
|
|
58
|
+
return onError(new Error('@digigov-ui XSS Validation failed: qr code payload should follow the pattern `https://dilosi.services.gov.gr/show/:reference_code`'), data);
|
|
56
59
|
}
|
|
57
60
|
}
|
|
58
|
-
// run a validator function provided by the application code
|
|
59
|
-
if (validate && !validate(data)) {
|
|
60
|
-
return onError(new Error('Custom QR Code payload validation failed'));
|
|
61
|
-
}
|
|
62
|
-
// proceed with application defined callback function
|
|
63
|
-
onScan(data);
|
|
64
61
|
}
|
|
62
|
+
// run a validator function provided by the application code
|
|
63
|
+
if (validate && !validate(data)) {
|
|
64
|
+
return onError(new Error('Custom QR Code payload validation failed'), data);
|
|
65
|
+
}
|
|
66
|
+
// proceed with application defined callback function
|
|
67
|
+
onScan(data);
|
|
65
68
|
};
|
|
66
69
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(QrReader, (0, _extends2["default"])({
|
|
67
70
|
delay: 100,
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digigov/ui",
|
|
3
|
-
"version": "1.1.2
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "@digigov reusable components toolkit",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./index.js",
|
|
7
7
|
"dependencies": {
|
|
8
|
+
"google-libphonenumber": "3.2.8",
|
|
8
9
|
"@uides/react-qr-reader": "3.0.0",
|
|
10
|
+
"react-query": "2.26.4",
|
|
9
11
|
"yup": "0.32.11",
|
|
10
12
|
"publint": "0.1.8",
|
|
11
|
-
"@digigov/react-icons": "1.1.2
|
|
13
|
+
"@digigov/react-icons": "1.1.2",
|
|
12
14
|
"dompurify": "3.0.6"
|
|
13
15
|
},
|
|
14
16
|
"peerDependencies": {
|
|
15
|
-
"react-query": "2.26.4",
|
|
16
17
|
"@material-ui/core": "4.11.3",
|
|
17
18
|
"@material-ui/icons": "4.11.2",
|
|
18
19
|
"clsx": "1.1.1",
|
|
19
20
|
"react": "^16.8.0 || ^17.0.0",
|
|
20
21
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
21
|
-
"@digigov/react-core": "1.2.0
|
|
22
|
-
"@digigov/css": "1.2.0
|
|
22
|
+
"@digigov/react-core": "1.2.0",
|
|
23
|
+
"@digigov/css": "1.2.0"
|
|
23
24
|
},
|
|
24
25
|
"gitHead": "c903a46306f77f55ad7fc4d2e274006f39a6c871",
|
|
25
26
|
"private": false,
|
|
@@ -8,7 +8,7 @@ export interface QrCodeScannerProps {
|
|
|
8
8
|
legacyMode?: boolean;
|
|
9
9
|
validate?: (...args) => boolean;
|
|
10
10
|
onScan: (...args) => void;
|
|
11
|
-
onError: (err: any) => void;
|
|
11
|
+
onError: (err: any, data: any) => void;
|
|
12
12
|
onLoad?: (...args) => void;
|
|
13
13
|
onImageLoad?: (...args) => void;
|
|
14
14
|
delay?: number;
|
|
@@ -57,27 +57,26 @@ In order to be safe, you can:
|
|
|
57
57
|
}
|
|
58
58
|
const handleOnScan = (data) => {
|
|
59
59
|
if (data) {
|
|
60
|
+
debugger;
|
|
60
61
|
if (dataType === 'url') {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
)
|
|
65
|
-
) {
|
|
62
|
+
try {
|
|
63
|
+
new URL(data);
|
|
64
|
+
} catch (e) {
|
|
66
65
|
return onError(
|
|
67
66
|
new Error(
|
|
68
|
-
'@digigov-ui XSS Validation failed: qr code payload should follow the pattern `https://
|
|
69
|
-
)
|
|
67
|
+
'@digigov-ui XSS Validation failed: qr code payload should follow the pattern `https://dilosi.services.gov.gr/show/:reference_code`'
|
|
68
|
+
), data
|
|
70
69
|
);
|
|
71
70
|
}
|
|
72
71
|
}
|
|
73
|
-
// run a validator function provided by the application code
|
|
74
|
-
if (validate && !validate(data)) {
|
|
75
|
-
return onError(new Error('Custom QR Code payload validation failed'));
|
|
76
|
-
}
|
|
77
|
-
// proceed with application defined callback function
|
|
78
|
-
onScan(data);
|
|
79
72
|
}
|
|
80
|
-
|
|
73
|
+
// run a validator function provided by the application code
|
|
74
|
+
if (validate && !validate(data)) {
|
|
75
|
+
return onError(new Error('Custom QR Code payload validation failed'), data);
|
|
76
|
+
}
|
|
77
|
+
// proceed with application defined callback function
|
|
78
|
+
onScan(data);
|
|
79
|
+
}
|
|
81
80
|
return (
|
|
82
81
|
<>
|
|
83
82
|
<QrReader
|