@uxf/core 11.32.0 → 11.35.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.
- package/README.md +12 -0
- package/package.json +1 -1
- package/qr/index.d.ts +7 -0
- package/qr/index.js +9 -0
- package/qr/index.test.d.ts +1 -0
- package/qr/index.test.js +7 -0
package/README.md
CHANGED
|
@@ -52,6 +52,18 @@ import staticImage from "./path/to/static-image.png";
|
|
|
52
52
|
<img src={resizerImageUrl(staticImage, width, height, params)}/>
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
+
## QR code generator
|
|
56
|
+
|
|
57
|
+
Helper function for qr code generator.
|
|
58
|
+
|
|
59
|
+
https://gitlab.uxf.cz/uxf-internal-projects/qr#qr-code-generator
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
import { qrCodeUrl } from "@uxf/core/qr";
|
|
63
|
+
|
|
64
|
+
qrCodeUrl("https://www.uxf.cz", { width: 200, margin: 5, errorCorrectionLevel: "H" });
|
|
65
|
+
```
|
|
66
|
+
|
|
55
67
|
## Cookie
|
|
56
68
|
|
|
57
69
|
- Cookie options
|
package/package.json
CHANGED
package/qr/index.d.ts
ADDED
package/qr/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.qrCodeUrl = qrCodeUrl;
|
|
4
|
+
const is_not_nil_1 = require("../utils/is-not-nil");
|
|
5
|
+
function qrCodeUrl(url, config) {
|
|
6
|
+
const params = (0, is_not_nil_1.isNotNil)(config) ? { url, config: btoa(JSON.stringify(config)) } : { url };
|
|
7
|
+
const query = new URLSearchParams(params).toString();
|
|
8
|
+
return `https://qr.uxf.cz/v1/qr.svg?${query}`;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/qr/index.test.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const index_1 = require("./index");
|
|
4
|
+
test("qrCodeUrl", () => {
|
|
5
|
+
expect((0, index_1.qrCodeUrl)("https://www.uxf.cz")).toBe("https://qr.uxf.cz/v1/qr.svg?url=https%3A%2F%2Fwww.uxf.cz");
|
|
6
|
+
expect((0, index_1.qrCodeUrl)("https://www.uxf.cz", { margin: 10, width: 200 })).toBe("https://qr.uxf.cz/v1/qr.svg?url=https%3A%2F%2Fwww.uxf.cz&config=eyJtYXJnaW4iOjEwLCJ3aWR0aCI6MjAwfQ%3D%3D");
|
|
7
|
+
});
|