local-id-scan-journey
v2.0.8
Published
A React component for GBG ID verification and document scanning with bundled SDK
Maintainers
Readme
Local ID Scan Journey
A React component for GBG ID verification and document scanning with bundled SDK files.
Installation
npm install local-id-scan-journeyTypeScript 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.jsOr using the npm script:
npm run copy-sdk --prefix node_modules/local-id-scan-journeyManual Setup
If automatic setup fails, manually copy these files from node_modules/local-id-scan-journey/dist/ to your public/ directory:
idesmicro_asm.wasmidesmicro_asm.js- Any
vendor.*.jsfiles - Any
idscan-jcs-*.jsfiles - Any
ides-micro.*.jsfiles
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.tsexists 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.*.jsRun the SDK copy script manually:
npx local-id-scan-journey/scripts/postinstall.jsVerify 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 buildTo watch for changes:
npm run devLicense
MIT
