diff --git a/.changeset/config.json b/.changeset/config.json index 7a672032..c0c52306 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -26,12 +26,12 @@ ] ], "access": "public", - "baseBranch": "master", + "baseBranch": "main", "updateInternalDependencies": "patch", "ignore": [ "@microblink/*-example", "@microblink/*-qa-app", "@microblink/*-test", - "github-release" + "@microblink/public-repo-generator" ] } diff --git a/.gitignore b/.gitignore index 623ce73a..0169d955 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ # Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,macos,conan,cmake,c++,node .turbo + # junk files vite.config.*.timestamp-* @@ -300,8 +301,18 @@ Session.vim # JetBrains IDEs .idea +# Clion bazel plugin files +.clwb + #mise local mise.local.toml # npmrc .npmrc + +# Bazel files +/bazel-* +/external + +automatic.bazelrc +.bazeltargets diff --git a/README.md b/README.md index 349bb48d..135433a7 100644 --- a/README.md +++ b/README.md @@ -10,15 +10,32 @@ Have questions, feedback, or running into issues? We're here to help! Contact us ## Packages +### BlinkID + | Package | Version | Changelog | |---------|---------|-----------| | [@microblink/blinkid](https://github.com/microblink/web-sdks/tree/main/packages/blinkid) | [](https://www.npmjs.com/package/@microblink/blinkid) | [CHANGELOG](https://github.com/microblink/web-sdks/blob/main/packages/blinkid/CHANGELOG.md) | | [@microblink/blinkid-core](https://github.com/microblink/web-sdks/tree/main/packages/blinkid-core) | [](https://www.npmjs.com/package/@microblink/blinkid-core) | [CHANGELOG](https://github.com/microblink/web-sdks/blob/main/packages/blinkid-core/CHANGELOG.md) | | [@microblink/blinkid-ux-manager](https://github.com/microblink/web-sdks/tree/main/packages/blinkid-ux-manager) | [](https://www.npmjs.com/package/@microblink/blinkid-ux-manager) | [CHANGELOG](https://github.com/microblink/web-sdks/blob/main/packages/blinkid-ux-manager/CHANGELOG.md) | -| [@microblink/blinkid-verify](https://github.com/microblink/web-sdks/tree/main/packages/blinkid-verify) | [](https://www.npmjs.com/package/@microblink/blinkid-verify) | [CHANGELOG](https://github.com/microblink/web-sdks/blob/main/packages/blinkid-verify/CHANGELOG.md) | -| [@microblink/blinkid-verify-core](https://github.com/microblink/web-sdks/tree/main/packages/blinkid-verify-core) | [](https://www.npmjs.com/package/@microblink/blinkid-verify-core) | [CHANGELOG](https://github.com/microblink/web-sdks/blob/main/packages/blinkid-verify-core/CHANGELOG.md) | -| [@microblink/blinkid-verify-ux-manager](https://github.com/microblink/web-sdks/tree/main/packages/blinkid-verify-ux-manager) | [](https://www.npmjs.com/package/@microblink/blinkid-verify-ux-manager) | [CHANGELOG](https://github.com/microblink/web-sdks/blob/main/packages/blinkid-verify-ux-manager/CHANGELOG.md) | + +### BlinkCard + +| Package | Version | Changelog | +|---------|---------|-----------| | [@microblink/blinkcard](https://github.com/microblink/web-sdks/tree/main/packages/blinkcard) | [](https://www.npmjs.com/package/@microblink/blinkcard) | [CHANGELOG](https://github.com/microblink/web-sdks/blob/main/packages/blinkcard/CHANGELOG.md) | | [@microblink/blinkcard-core](https://github.com/microblink/web-sdks/tree/main/packages/blinkcard-core) | [](https://www.npmjs.com/package/@microblink/blinkcard-core) | [CHANGELOG](https://github.com/microblink/web-sdks/blob/main/packages/blinkcard-core/CHANGELOG.md) | | [@microblink/blinkcard-ux-manager](https://github.com/microblink/web-sdks/tree/main/packages/blinkcard-ux-manager) | [](https://www.npmjs.com/package/@microblink/blinkcard-ux-manager) | [CHANGELOG](https://github.com/microblink/web-sdks/blob/main/packages/blinkcard-ux-manager/CHANGELOG.md) | + +### BlinkID Verify + +| Package | Version | Changelog | +|---------|---------|-----------| +| [@microblink/blinkid-verify](https://github.com/microblink/web-sdks/tree/main/packages/blinkid-verify) | [](https://www.npmjs.com/package/@microblink/blinkid-verify) | [CHANGELOG](https://github.com/microblink/web-sdks/blob/main/packages/blinkid-verify/CHANGELOG.md) | +| [@microblink/blinkid-verify-core](https://github.com/microblink/web-sdks/tree/main/packages/blinkid-verify-core) | [](https://www.npmjs.com/package/@microblink/blinkid-verify-core) | [CHANGELOG](https://github.com/microblink/web-sdks/blob/main/packages/blinkid-verify-core/CHANGELOG.md) | +| [@microblink/blinkid-verify-ux-manager](https://github.com/microblink/web-sdks/tree/main/packages/blinkid-verify-ux-manager) | [](https://www.npmjs.com/package/@microblink/blinkid-verify-ux-manager) | [CHANGELOG](https://github.com/microblink/web-sdks/blob/main/packages/blinkid-verify-ux-manager/CHANGELOG.md) | + +### Camera Manager + +| Package | Version | Changelog | +|---------|---------|-----------| | [@microblink/camera-manager](https://github.com/microblink/web-sdks/tree/main/packages/camera-manager) | [](https://www.npmjs.com/package/@microblink/camera-manager) | [CHANGELOG](https://github.com/microblink/web-sdks/blob/main/packages/camera-manager/CHANGELOG.md) | \ No newline at end of file diff --git a/apps/examples/README.md b/apps/examples/README.md index 794f9534..02cfeddd 100644 --- a/apps/examples/README.md +++ b/apps/examples/README.md @@ -8,6 +8,7 @@ This directory contains example applications demonstrating the capabilities of t - [BlinkID Simple](./blinkid-simple/): A simple example of how to use the BlinkID SDK. - [BlinkID Advanced Setup](./blinkid-advanced-setup/): Demonstrates advanced setup and customization of the BlinkID SDK. +- [BlinkID OTA Setup](./blinkid-ota-setup/): Demonstrates how to configure over-the-air (OTA) document-support resource updates when initializing BlinkID. - [BlinkID UI Customization](./blinkid-ui-customization/): Shows how to implement custom UI, such as replacing UI for various error states (camera errors, timeouts, unsupported documents, filtered documents). - [BlinkID Photo Upload](./blinkid-photo-upload/): An example of how to use the BlinkID SDK with photo upload functionality. - [BlinkID Core API](./blinkid-core-api/): Shows how to use the core API of the BlinkID SDK. diff --git a/apps/examples/blinkid-advanced-setup/src/App.tsx b/apps/examples/blinkid-advanced-setup/src/App.tsx index 0e975ccb..a68f0912 100644 --- a/apps/examples/blinkid-advanced-setup/src/App.tsx +++ b/apps/examples/blinkid-advanced-setup/src/App.tsx @@ -85,11 +85,6 @@ export const App: Component = () => { * @see https://github.com/microblink/web-sdks/blob/main/packages/blinkid-core/docs/type-aliases/BlinkIdSessionSettings.md */ const session = await blinkIdCore.createScanningSession({ - /* - * For default settings look at defaultSessionSettings - * - * @see https://github.com/microblink/web-sdks/blob/main/packages/blinkid-core/src/defaultSessionSettings.ts - */ scanningSettings: { documentCaptureModule: { passportDataPageScanOnly: false, diff --git a/apps/examples/blinkid-ota-setup/.env.example b/apps/examples/blinkid-ota-setup/.env.example new file mode 100644 index 00000000..86916da8 --- /dev/null +++ b/apps/examples/blinkid-ota-setup/.env.example @@ -0,0 +1,7 @@ +# For development, create a .env.local or a .env.production using this template +# Never put your licence key in this file as it will be committed + +# https://vitejs.dev/guide/env-and-mode.html#env-files + + +VITE_LICENCE_KEY=PLACE_YOUR_LICENCE_KEY_HERE diff --git a/apps/examples/blinkid-ota-setup/.eslintrc.cjs b/apps/examples/blinkid-ota-setup/.eslintrc.cjs new file mode 100644 index 00000000..ed5a0330 --- /dev/null +++ b/apps/examples/blinkid-ota-setup/.eslintrc.cjs @@ -0,0 +1,52 @@ +const { defineConfig } = require("eslint-define-config"); + +module.exports = defineConfig({ + root: true, + + parserOptions: { + ecmaVersion: "2022", + sourceType: "module", + }, + + overrides: [ + { + files: ["src/**/*.{ts,tsx}"], + plugins: ["@typescript-eslint"], + parser: "@typescript-eslint/parser", + // have to duplicate in override... + rules: { + "@typescript-eslint/no-unused-vars": 0, + // the following two are causing errors in vscode. See: + // https://typescript-eslint.io/linting/troubleshooting/#changes-to-one-file-are-not-reflected-when-linting-other-files-in-my-ide + "@typescript-eslint/no-unsafe-assignment": 0, + "@typescript-eslint/no-unsafe-member-access": 0, + // only use in tsx + "@typescript-eslint/no-non-null-assertion": 0, + "@typescript-eslint/consistent-type-definitions": 0, + "prefer-const": 0, + }, + parserOptions: { + tsconfigRootDir: __dirname, + project: ["./tsconfig.json"], + }, + extends: [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended-type-checked", + "plugin:@typescript-eslint/stylistic-type-checked", + "prettier", + ], + }, + { + files: ["**/*.{js,mjs,cjs}"], + env: { + node: true, + browser: true, + es2021: true, + }, + extends: ["eslint:recommended"], + rules: { + "no-unused-vars": 0, + }, + }, + ], +}); diff --git a/apps/examples/blinkid-ota-setup/.gitignore b/apps/examples/blinkid-ota-setup/.gitignore new file mode 100644 index 00000000..dd89a0ea --- /dev/null +++ b/apps/examples/blinkid-ota-setup/.gitignore @@ -0,0 +1,7 @@ +node_modules +dist +public +types +certs +*.local +.env.production \ No newline at end of file diff --git a/apps/examples/blinkid-ota-setup/README.md b/apps/examples/blinkid-ota-setup/README.md new file mode 100644 index 00000000..49446e15 --- /dev/null +++ b/apps/examples/blinkid-ota-setup/README.md @@ -0,0 +1,33 @@ +# BlinkID OTA Setup Example + +This example application demonstrates how to configure over-the-air (OTA) document-support resource updates when initializing BlinkID with `createBlinkId`. OTA lets Microblink add or update supported document resources without requiring a new SDK release or application package update. + +## Functionality + +The application performs the following actions: + +1. **Initializes BlinkID with OTA settings**: It calls `createBlinkId` with an `otaResources` configuration that controls how the SDK loads baseline OTA files and checks for newer resources from an OTA provider. + +2. **Configures OTA behavior**: The example sets: + - `strict: true` — fail initialization if the OTA download fails (instead of falling back to the hosted baseline) + - `checkForUpdates: true` — always query the OTA provider for a newer compatible version + - `otaResourceProviderUrl: undefined` — use Microblink's default OTA service (`https://blinkid-ota.microblink.com`); set a URL to use a proxy or self-hosted provider + - `resourcesLocation: "custom-ota-resources"` — load the hosted/bundled OTA baseline from that path (see `public/custom-ota-resources` for the expected layout) + - `timeoutMilis: 5000` — OTA service request timeout in milliseconds + +3. **Sets up a Result Callback**: It registers a callback that runs when a document is successfully scanned and logs the result to the console. + +4. **Cleans up Resources**: After logging the result, it calls `destroy` to release SDK resources. + +## Key Features Demonstrated + +- **OTA resource bootstrap**: Shows how to pass `otaResources` to `createBlinkId` to customize document-support resource loading at init time. +- **Strict vs fallback behavior**: Demonstrates failing hard on OTA errors (`strict: true`) instead of silently using the hosted baseline. +- **Update checks**: Illustrates enabling provider checks with `checkForUpdates`, and notes that `checkForUpdates: false` skips the provider and uses only the hosted baseline. +- **Custom baseline location**: Points `resourcesLocation` at custom OTA baseline files instead of the default SDK path. +- **Provider / proxy override**: Leaves `otaResourceProviderUrl` unset for Microblink's service, with guidance for pointing it at a proxy or self-hosted endpoint that implements the versions API. +- **High-level API**: Still uses the simple `createBlinkId` flow for scanning, result handling, and cleanup. + +## How to Run + +For detailed instructions on how to install dependencies and run this example, please refer to the [main README file](./../README.md). diff --git a/apps/examples/blinkid-ota-setup/index.html b/apps/examples/blinkid-ota-setup/index.html new file mode 100644 index 00000000..6a43ac3b --- /dev/null +++ b/apps/examples/blinkid-ota-setup/index.html @@ -0,0 +1,20 @@ + + +
+ + + + + +{for(var c=[],d=0;d>2]);return c},lf=a=>{a=a.trim();const b=a.indexOf("(");return-1===b?a:a.slice(0,b)},mb=(a,b,c,d,e,f,g,k)=>{var l=kf(c,d);b=V(b);b=lf(b);f=X(e,f);Ee([],[a],p=>{function q(){gf(`Cannot call ${n} due to unbound types`,l)}p=p[0];var n=`${p.name}.${b}`;b.startsWith("@@")&&(b=Symbol[b.substring(2)]);k&&p.Ya.Zc.push(b);var u=p.Ya.zb,y=u[b];void 0===y||void 0===y.eb&&y.className!==p.name&&y.Bb===c-2?(q.Bb=c-2,q.className=p.name,u[b]=q):(Pe(u,b,
-n),u[b].eb[c-2]=q);Ee([],l,v=>{v=jf(n,v,p,f,g);void 0===u[b].eb?(v.Bb=c-2,u[b]=v):u[b].eb[c-2]=v;return[]});return[]})},mf=(a,b,c)=>{if(!(a instanceof Object))throw new W(`${c} with invalid "this": ${a}`);if(!(a instanceof b.Ya.constructor))throw new W(`${c} incompatible with "this" of type ${a.constructor.name}`);if(!a.Ta.Xa)throw new W(`cannot call emscripten binding method ${c} on deleted object`);return Te(a.Ta.Xa,a.Ta.$a.Ya,b.Ya)},nb=(a,b,c,d,e,f,g,k,l,p)=>{b=V(b);e=X(d,e);Ee([],[a],q=>{q=q[0];
-var n=`${q.name}.${b}`,u={get(){gf(`Cannot access ${n} due to unbound types`,[c,g])},enumerable:!0,configurable:!0};u.set=l?()=>gf(`Cannot access ${n} due to unbound types`,[c,g]):()=>{throw new W(n+" is a read-only property");};Object.defineProperty(q.Ya.zb,b,u);Ee([],l?[c,g]:[c],y=>{var v=y[0],w={get(){var F=mf(this,q,n+" getter");return v.cb(e(f,F))},enumerable:!0};if(l){l=X(k,l);var x=y[1];w.set=function(F){var G=mf(this,q,n+" setter"),K=[];l(p,G,x.gb(K,F));xe(K)}}Object.defineProperty(q.Ya.zb,
-b,w);return[]});return[]})},nf=[],of=[0,1,,1,null,1,!0,1,!1,1],Hb=a=>{9{if(!a)throw new W(`Cannot use deleted val. handle = ${a}`);return of[a]},Xe=a=>{switch(a){case void 0:return 2;case null:return 4;case !0:return 6;case !1:return 8;default:const b=nf.pop()||of.length;of[b]=a;of[b+1]=1;return b}},qf={name:"emscripten::val",cb:a=>{var b=pf(a);Hb(a);return b},gb:(a,b)=>Xe(b),rb:ye,lb:null},ob=a=>De(a,qf),rf=(a,b)=>{switch(b){case 4:return function(c){return this.cb((t(),
-Ga)[c>>2])};case 8:return function(c){return this.cb((t(),Ha)[c>>3])};default:throw new TypeError(`invalid float width (${b}): ${a}`);}},pb=(a,b,c)=>{b=V(b);De(a,{name:b,cb:d=>d,gb:(d,e)=>e,rb:rf(b,c),lb:null})},qb=(a,b,c,d,e,f)=>{var g=kf(b,c);a=V(a);a=lf(a);e=X(d,e);Qe(a,function(){gf(`Cannot call ${a} due to unbound types`,g)},b-1);Ee([],g,k=>{df(a,jf(a,[k[0],null].concat(k.slice(1)),null,e,f),b-1);return[]})},rb=(a,b,c,d,e)=>{b=V(b);let f=k=>k;if(0===d){var g=32-8*c;f=k=>k<