A React component for GBG ID verification and document scanning with bundled SDK
npm install local-id-scan-journeyA React component for GBG ID verification and document scanning with bundled SDK files.
``bash`
npm install local-id-scan-journey
This package includes full TypeScript declarations. After installation, you should be able to import and use the component with full type safety:
`typescript`
import { LocalIdScanJourney, IdScanJourneyProps } from "local-id-scan-journey";
The package includes GBG SDK files that need to be available in your project's public directory.
The package includes a postinstall script that automatically copies SDK files to your public directory. If this doesn't work automatically, you can run:
`bash`
npx local-id-scan-journey/scripts/postinstall.js
Or using the npm script:
`bash`
npm run copy-sdk --prefix node_modules/local-id-scan-journey
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
- vendor.*.js
- Any filesidscan-jcs-*.js
- Any filesides-micro.*.js
- Any files
`typescript
import React from "react";
import { LocalIdScanJourney } from "local-id-scan-journey";
function App() {
const handleScanComplete = (result: any) => {
console.log("Scan completed:", result);
};
return (
export default App;
`
If you see errors like:
``
Could not find a declaration file for module 'local-id-scan-journey'
1. Ensure you're using the latest version of the package
2. Check that dist/index.d.ts exists in node_modules/local-id-scan-journey/`
3. Try clearing your TypeScript cache and rebuilding:
bash`
rm -rf node_modules/.cache
npm run build
If you see errors like:
``
Failed to load script: /vendor.axios.*.js
1. Run the SDK copy script manually:
`bash`
npx local-id-scan-journey/scripts/postinstall.js
2. Verify the files exist in your public/ directory
3. Check your build process isn't excluding these files
For Next.js projects, you may need to add SDK files to your next.config.js:
`javascript
/* @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;
`
To rebuild the package:
`bash`
npm run build
To watch for changes:
`bash``
npm run dev
MIT