Skip to content

Commit 5f2c6a4

Browse files
Merge pull request #21 from blinkcard/jenkins/stable-build
Automatically built release by Jenkins
2 parents 7ff44f3 + bc1e437 commit 5f2c6a4

File tree

74 files changed

+8902
-6424
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+8902
-6424
lines changed

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
12.18.0
1+
16.3.0

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: node_js
22
node_js:
3-
- "12.18"
3+
- "16.3"
44
script:
55
- npm run prepublishOnly
6-
- npm run build
6+
- npm run build

CHANGELOG.md

Lines changed: 105 additions & 80 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,20 +120,20 @@ Alternatively, it's possible to use UMD builds which can be loaded from public C
120120

121121
However, **we strongly advise** that you host the JavaScript bundles on your infrastructure since there is no guarantee that the public CDN service has satisfactory uptime and availability throughout the world.
122122

123-
For example, it's possible to use UMD builds from [the `dist` folder on Unpkg CDN](https://unpkg.com/@microblink/blinkcard-in-browser-sdk/dist/). The UMD builds make `BlinkCardSDK` available as a `window.BlinkCardSDK` global variable:
123+
For example, it's possible to use UMD builds from [the `dist` folder on the jsDelivr CDN](https://cdn.jsdelivr.net/npm/@microblink/blinkcard-in-browser-sdk/dist/). The UMD builds make `BlinkCardSDK` available as a `window.BlinkCardSDK` global variable:
124124

125125
```html
126126
<!-- IMPORTANT: change "X.Y.Z" to the version number you wish to use! -->
127-
<script src="https://unpkg.com/@microblink/blinkcard-in-browser-sdk@X.Y.Z/dist/blinkcard-sdk.min.js"></script>
127+
<script src="https://cdn.jsdelivr.net/npm/@microblink/blinkcard-in-browser-sdk@X.Y.Z/dist/blinkcard-sdk.min.js"></script>
128128
```
129129

130-
Finally, it's possible to use ES builds, which can be downloaded from [the `es` folder on unpkg](https://unpkg.com/@microblink/blinkcard-in-browser-sdk/es/). ES modules are used in a similar manner as NPM package:
130+
Finally, it's possible to use ES builds, which can be downloaded from [the `es` folder on jsDelivr](https://cdn.jsdelivr.net/npm/@microblink/blinkcard-in-browser-sdk/es/). ES modules are used in a similar manner as NPM package:
131131

132132
```javascript
133133
import * as BlinkCardSDK from "./es/blinkcard-sdk.js";
134134
```
135135

136-
**Important:** Unpkg CDN is used here due to simplicity of usage. It's not intended to be used in production!
136+
**Important:** the jsDelivr CDN is used here due to simplicity of usage. It's not intended to be used in production!
137137

138138
#### WASM Resources
139139

@@ -708,13 +708,13 @@ Requirements:
708708
709709
Minimal browser versions with support for all features required by BlinkCard.
710710
711-
|Chrome|Safari|Edge|Firefox|Opera|iOS Safari|Android Browser|Opera Mobile|Chrome for Android|Firefox for Android|
712-
|------|------|----|-------|-----|----------|---------------|------------|------------------|-------------------|
713-
| 57| 11| 79| 52| 44| 14| 81| 59| 86| 82|
711+
|Chrome|Safari|Edge|Firefox|Opera|iOS Safari|Android Browser|Chrome for Android|Firefox for Android|
712+
|------|------|----|-------|-----|----------|---------------|------------------|-------------------|
713+
| 96| 15| 93| 79| 82| 15| 81| 96| 79|
714714
715715
Internet Explorer is **not supported**.
716716
717-
*Source: [caniuse](https://caniuse.com/wasm)*
717+
*Sources: [caniuse](https://caniuse.com/wasm) and [WebAssembly Roadmap](https://webassembly.org/roadmap/)*
718718
719719
## <a name="camera-devices"></a> Camera devices
720720

examples/blinkcard-camera/javascript/app.js

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ function main()
3232
}
3333

3434
// 1. It's possible to obtain a free trial license key on microblink.com
35-
let licenseKey = "sRwAAAYJbG9jYWxob3N0r/lOPmg/w35CpOHWKeIcyUSz8fDN+kpZwh39JTAYyAQ+7adUFfgptY2QPtEII9rfosGVKtbC/pMs5g8QQIzFmx0voaH4qjuMs7p/Pdnoi7kqPYB6QL9cRIsBMfqJOJmf9jTsUQtHdubYz8Sv3PEoul18uBorUMM86Bw7tFLEcDjfp8xOXM1fuNfgDVG2BvK/UwpVc4k8a3SiQLXgDUU0ItaNXo7yY9au8ZX/R6yDOfbXRw==";
35+
let licenseKey =
36+
"sRwAAAYJbG9jYWxob3N0r/lOPmg/w35CpOHWLcIXyZqx58jBjDQEgc9g8PbxdaaDM+jedRKGXjqKQKz7ocX5/uQ6wvwfkHd4iovo1UDxWg4K+dstSEarVzTkBgKXX7iqpHoOjlU1pXPWbWBGasvjaoC2sKOnT7RozIdO8ljPeJVQO0owX3JzguXvoYK3p2ZtlcV/ndSC43hDJjKy4ACGg4Cul5jogfwPEdtJ7bk0XmtamIvtCVSnqQMfF1EwxCXOHw==";
3637

3738
if (window.location.hostname === "blinkcard.github.io")
3839
{
39-
licenseKey = "sRwAAAYTYmxpbmtjYXJkLmdpdGh1Yi5pby+N7zvpysD9Mbe+K3q5z39+KlTgPQi5ktCkjm2XjBep8tLiy+adpNQombp6cm0Lz64cc8k1XM6Egns2x1pkf1Vp03t+Gd47pfZ17KUzir2xhwcdAsGOA0mQsII3LmuwTBsSCxBkgojShS5dq1tk5Iz4NU2XyvZNj5Tqm6sQkmySVbDi8kGnEEyvu39FxrD3Yq0VqKD2Yxgz+BH4vtzk1HYoF+63++xeEOYaXF0LoD8MNOI=";
40+
licenseKey =
41+
"sRwAAAYTYmxpbmtjYXJkLmdpdGh1Yi5pby+N7zvpysD9Mbe+K36ZxH84iPO5UizTDjd3UMrotMVNG4OWJpwSC8vh+SYmFWkS5v+Biodkzoa6iMHgneLnPJxo1p3rcRal8VYRJuJoo98xSeGaZX90jyjXMsDBoBm3tor+67zWr3fO3Dgl7u921IwGGRmaLiEpdYQXgpZUZRHy3VQDP0khXQ9EaBy48GXsV2xBHuHcnneW/MWmtr/+jp15d/uHRQfsMitmnTYP69uX0iw=";
4042
}
4143

4244
// 2. Create instance of SDK load settings with your license key
@@ -48,22 +50,25 @@ function main()
4850
loadSettings.allowHelloMessage = true;
4951

5052
// In order to provide better UX, display progress bar while loading the SDK
51-
loadSettings.loadProgressCallback = (progress) => progressEl.value = progress;
53+
loadSettings.loadProgressCallback = (progress) =>
54+
progressEl.value = progress;
5255

5356
// Set absolute location of the engine, i.e. WASM and support JS files
5457
loadSettings.engineLocation = "https://blinkcard.github.io/blinkcard-in-browser/resources";
5558

5659
// Set absolute location of the worker file
57-
loadSettings.workerLocation = "https://blinkcard.github.io/blinkcard-in-browser/resources/BlinkCardWasmSDK.worker.min.js";
60+
loadSettings.workerLocation =
61+
"https://blinkcard.github.io/blinkcard-in-browser/resources/BlinkCardWasmSDK.worker.min.js";
5862

5963
// 3. Load SDK
6064
BlinkCardSDK.loadWasmModule(loadSettings).then(
61-
6265
(sdk) =>
6366
{
6467
document.getElementById("screen-initial")?.classList.add("hidden");
6568
document.getElementById("screen-start")?.classList.remove("hidden");
66-
document.getElementById("start-scan")?.addEventListener("click", (ev) =>
69+
document.
70+
getElementById("start-scan")?.
71+
addEventListener("click", (ev) =>
6772
{
6873
ev.preventDefault();
6974
startScan(sdk);
@@ -89,18 +94,19 @@ async function startScan(sdk)
8994
//
9095
// In this example, we create a BlinkCardRecognizer, which knows how to scan Payment cards
9196
// and extract payment information from them.
92-
const blinkCardRecognizer = await BlinkCardSDK.createBlinkCardRecognizer(sdk);
97+
const blinkCardRecognizer = await BlinkCardSDK.createBlinkCardRecognizer(
98+
sdk);
99+
93100

94101
// [OPTIONAL] Create a callbacks object that will receive recognition events, such as detected object location etc.
95102
const callbacks = {
96103
onQuadDetection: (quad) => drawQuad(quad),
97-
onFirstSideResult: () => alert("Flip the document") };
98-
104+
onFirstSideResult: () => alert("Flip the document")
105+
};
99106

100107
// 2. Create a RecognizerRunner object which orchestrates the recognition with one or more
101108
// recognizer objects.
102109
const recognizerRunner = await BlinkCardSDK.createRecognizerRunner(
103-
104110
// SDK instance to use
105111
sdk,
106112
// List of recognizer objects that will be associated with created RecognizerRunner object
@@ -112,8 +118,8 @@ async function startScan(sdk)
112118

113119

114120
// 3. Create a VideoRecognizer object and attach it to HTMLVideoElement that will be used for displaying the camera feed
115-
const videoRecognizer = await BlinkCardSDK.VideoRecognizer.createVideoRecognizerFromCameraStream(
116-
121+
const videoRecognizer =
122+
await BlinkCardSDK.VideoRecognizer.createVideoRecognizerFromCameraStream(
117123
cameraFeed,
118124
recognizerRunner);
119125

@@ -125,19 +131,20 @@ async function startScan(sdk)
125131
if (processResult !== BlinkCardSDK.RecognizerResultState.Empty)
126132
{
127133
const blinkCardResult = await blinkCardRecognizer.getResult();
128-
if (blinkCardResult.state !== BlinkCardSDK.RecognizerResultState.Empty)
134+
if (
135+
blinkCardResult.state !== BlinkCardSDK.RecognizerResultState.Empty)
136+
129137
{
130138
console.log("BlinkCard results", blinkCardResult);
131139

132140
const firstAndLastName = blinkCardResult.owner;
133141
const cardNumber = blinkCardResult.cardNumber;
134142
const dateOfExpiry = {
135143
year: blinkCardResult.expiryDate.year,
136-
month: blinkCardResult.expiryDate.month };
137-
144+
month: blinkCardResult.expiryDate.month
145+
};
138146

139147
alert(
140-
141148
`Hello, ${firstAndLastName}!\n Your payment card with card number ${cardNumber} will expire on ${dateOfExpiry.year}/${dateOfExpiry.month}.`);
142149

143150
}
@@ -219,15 +226,13 @@ function applyTransform(transformMatrix)
219226
drawContext.translate(xOffset, yOffset);
220227
// second, scale the canvas to fit the scaled video
221228
drawContext.scale(
222-
223229
scaledVideoWidth / cameraFeed.videoWidth,
224230
scaledVideoHeight / cameraFeed.videoHeight);
225231

226232

227233
// finally, apply transformation from image coordinate system to
228234
// https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setTransform
229235
drawContext.transform(
230-
231236
transformMatrix[0],
232237
transformMatrix[3],
233238
transformMatrix[1],
@@ -242,13 +247,7 @@ function clearDrawCanvas()
242247
cameraFeedback.width = cameraFeedback.clientWidth;
243248
cameraFeedback.height = cameraFeedback.clientHeight;
244249

245-
drawContext.clearRect(
246-
247-
0,
248-
0,
249-
cameraFeedback.width,
250-
cameraFeedback.height);
251-
250+
drawContext.clearRect(0, 0, cameraFeedback.width, cameraFeedback.height);
252251
}
253252

254253
function setupColor(displayable)

examples/blinkcard-camera/javascript/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ <h1 id="msg">Loading...</h1>
2222
<p id="camera-guides">Point the camera towards Payment cards</p>
2323
</div>
2424
</body>
25-
26-
<!-- Keep in mind that Unpkg CDN is used for demonstration, it's not intended to be used in production! -->
27-
<script type="text/javascript" src="https://unpkg.com/@microblink/blinkcard-in-browser-sdk@2.6.1/dist/blinkcard-sdk.js"></script>
25+
26+
<!-- Keep in mind that the jsDelivr CDN is used for demonstration, it's not intended to be used in production! -->
27+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@microblink/blinkcard-in-browser-sdk@2.7.0/dist/blinkcard-sdk.js"></script>
2828
<script type="text/javascript" src="app.js"></script>
2929
</html>

examples/blinkcard-camera/typescript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
"typescript": "^3.9.5"
2020
},
2121
"dependencies": {
22-
"@microblink/blinkcard-in-browser-sdk": "~2.6.1"
22+
"@microblink/blinkcard-in-browser-sdk": "~2.7.0"
2323
}
2424
}

examples/blinkcard-camera/typescript/rollup.config.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,23 @@ export default [
1414
plugins: [
1515
nodeResolve(),
1616
typescript(),
17-
terser({
17+
terser( {
1818
compress:
1919
{
2020
pure_getters: true,
2121
unsafe: true,
2222
unsafe_comps: true,
2323
warnings: false
2424
}
25-
}),
26-
copy({
25+
} ),
26+
copy( {
2727
targets: [
28-
{ src: "public/*", dest: "dist" },
29-
{ src: "node_modules/@microblink/blinkcard-in-browser-sdk/resources/*", dest: "dist" }
28+
{ src: "public/*",
29+
dest: "dist" },
30+
{ src: "node_modules/@microblink/blinkcard-in-browser-sdk/resources/*",
31+
dest: "dist" }
3032
]
31-
})
33+
} )
3234
]
3335
}
3436
];

examples/blinkcard-camera/typescript/src/app.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function main() {
3030
}
3131

3232
// 1. It's possible to obtain a free trial license key on microblink.com
33-
const licenseKey = "sRwAAAYJbG9jYWxob3N0r/lOPmg/w35CpOHWKeIcyUSz8fDN+kpZwh39JTAYyAQ+7adUFfgptY2QPtEII9rfosGVKtbC/pMs5g8QQIzFmx0voaH4qjuMs7p/Pdnoi7kqPYB6QL9cRIsBMfqJOJmf9jTsUQtHdubYz8Sv3PEoul18uBorUMM86Bw7tFLEcDjfp8xOXM1fuNfgDVG2BvK/UwpVc4k8a3SiQLXgDUU0ItaNXo7yY9au8ZX/R6yDOfbXRw==";
33+
const licenseKey = "sRwAAAYJbG9jYWxob3N0r/lOPmg/w35CpOHWLcIXyZqx58jBjDQEgc9g8PbxdaaDM+jedRKGXjqKQKz7ocX5/uQ6wvwfkHd4iovo1UDxWg4K+dstSEarVzTkBgKXX7iqpHoOjlU1pXPWbWBGasvjaoC2sKOnT7RozIdO8ljPeJVQO0owX3JzguXvoYK3p2ZtlcV/ndSC43hDJjKy4ACGg4Cul5jogfwPEdtJ7bk0XmtamIvtCVSnqQMfF1EwxCXOHw==";
3434

3535
// 2. Create instance of SDK load settings with your license key
3636
const loadSettings = new BlinkCardSDK.WasmSDKLoadSettings(licenseKey);
@@ -41,19 +41,22 @@ function main() {
4141
loadSettings.allowHelloMessage = true;
4242

4343
// In order to provide better UX, display progress bar while loading the SDK
44-
loadSettings.loadProgressCallback = (progress: number) => progressEl!.value = progress;
44+
loadSettings.loadProgressCallback = (progress: number) => (progressEl!.value = progress);
4545

4646
// Set absolute location of the engine, i.e. WASM and support JS files
4747
loadSettings.engineLocation = window.location.origin;
4848

4949
// Set absolute location of the worker file
50-
loadSettings.workerLocation = window.location.origin + "/BlinkCardWasmSDK.worker.min.js";
50+
loadSettings.workerLocation =
51+
window.location.origin + "/BlinkCardWasmSDK.worker.min.js";
5152

5253
// 3. Load SDK
5354
BlinkCardSDK.loadWasmModule(loadSettings).then((sdk: BlinkCardSDK.WasmSDK) => {
5455
document.getElementById("screen-initial")?.classList.add("hidden");
5556
document.getElementById("screen-start")?.classList.remove("hidden");
56-
document.getElementById("start-scan")?.addEventListener("click", (ev: any) => {
57+
document
58+
.getElementById("start-scan")
59+
?.addEventListener("click", (ev: any) => {
5760
ev.preventDefault();
5861
startScan(sdk);
5962
});
@@ -81,7 +84,7 @@ async function startScan(sdk: BlinkCardSDK.WasmSDK) {
8184
// [OPTIONAL] Create a callbacks object that will receive recognition events, such as detected object location etc.
8285
const callbacks = {
8386
onQuadDetection: (quad: BlinkCardSDK.DisplayableQuad) => drawQuad(quad),
84-
onFirstSideResult: () => alert("Flip the document")
87+
onFirstSideResult: () => alert("Flip the document"),
8588
};
8689

8790
// 2. Create a RecognizerRunner object which orchestrates the recognition with one or more
@@ -116,7 +119,7 @@ async function startScan(sdk: BlinkCardSDK.WasmSDK) {
116119
const cardNumber = blinkCardResult.cardNumber;
117120
const dateOfExpiry = {
118121
year: blinkCardResult.expiryDate.year,
119-
month: blinkCardResult.expiryDate.month
122+
month: blinkCardResult.expiryDate.month,
120123
};
121124
alert(`Hello, ${firstAndLastName}!\n Your payment card with card number ${cardNumber} will expire on ${dateOfExpiry.year}/${dateOfExpiry.month}.`);
122125
}

0 commit comments

Comments
 (0)