Local ID Scan Journey
A React component for GBG ID verification and document scanning with bundled SDK files.
Installation
npm install local-id-scan-journey
TypeScript Support
This package includes full TypeScript declarations. After installation, you should be able to import and use the component with full type safety:
import { LocalIdScanJourney, IdScanJourneyProps } from "local-id-scan-journey";
SDK Files Setup
The package includes GBG SDK files that need to be available in your project's public directory.
Automatic Setup (Recommended)
The package includes a postinstall script that automatically copies SDK files to your public directory. If this doesn't work automatically, you can run:
npx local-id-scan-journey/scripts/postinstall.js
Or using the npm script:
npm run copy-sdk --prefix node_modules/local-id-scan-journey
Manual Setup
If automatic setup fails, manually copy these files from node_modules/local-id-scan-journey/dist/
to your public/
directory:
idesmicro_asm.wasm
idesmicro_asm.js
- Any
vendor.*.js
files - Any
idscan-jcs-*.js
files - Any
ides-micro.*.js
files
Usage
import React from "react";
import { LocalIdScanJourney } from "local-id-scan-journey";
function App() {
const handleScanComplete = (result: any) => {
console.log("Scan completed:", result);
};
return (
<div className="App">
<LocalIdScanJourney
onScanComplete={handleScanComplete}
// ... other props
/>
</div>
);
}
export default App;
Troubleshooting
TypeScript Declaration Issues
If you see errors like:
Could not find a declaration file for module 'local-id-scan-journey'
- Ensure you're using the latest version of the package
- Check that
dist/index.d.ts
exists innode_modules/local-id-scan-journey/
- Try clearing your TypeScript cache and rebuilding:
rm -rf node_modules/.cache npm run build
SDK File Loading Errors
If you see errors like:
Failed to load script: /vendor.axios.*.js
Run the SDK copy script manually:
npx local-id-scan-journey/scripts/postinstall.js
Verify the files exist in your
public/
directoryCheck your build process isn't excluding these files
Next.js Configuration
For Next.js projects, you may need to add SDK files to your next.config.js
:
/** @type {import('next').NextConfig} */
const nextConfig = {
webpack: (config) => {
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
};
return config;
},
// Ensure public files are served correctly
async rewrites() {
return [
{
source: "/idesmicro_asm.wasm",
destination: "/idesmicro_asm.wasm",
},
];
},
};
module.exports = nextConfig;
Development
To rebuild the package:
npm run build
To watch for changes:
npm run dev
License
MIT