hidglobal / digitalpersona-devices

DigitalPersona Security Devices support library
https://hidglobal.github.io/digitalpersona-devices/index.html
MIT License
64 stars 41 forks source link

Getting Error in Angular 7 #2

Closed navinsaini closed 4 years ago

navinsaini commented 4 years ago

Hi There, I am trying to implement fingerprint into the angular 7 application. I installed the library using npm and when I included the library into the typescript file then it gives me an error. One of them is.

ERROR in ./node_modules/@digitalpersona/devices/dist/es5.bundles/index.umd.js
Module not found: Error: Can't resolve 'WebSdk' in '...\node_modules\@digitalpersona\devices\dist\es5.bundles'

The other errors I got is

ERROR in node_modules/@digitalpersona/devices/dist/typings/devices/cards/reader.d.ts(1,23): error TS2688: Cannot find type definition file for 'websdk'.

node_modules/@digitalpersona/devices/dist/typings/devices/fingerprints/reader.d.ts(1,23): error TS2688: Cannot find type definition file for 'websdk'.

node_modules/@digitalpersona/devices/dist/typings/devices/iwa/device.d.ts(1,23): error TS2688: Cannot find type definition file for 'websdk'.

Please let me know if the library is compatible with angular 2+ and what I need to do fix this problem. Thanks in advance.

a-bronx commented 4 years ago

Hello! The WebSDK is an external dependency (see Browser Support). The DigitalPersona WebSDK is currently a part of DP WebComponents product installation, and it is not yet published as an npm package, so adding @digitalpersona/devices does not pull this dependency automatically. We consider publishing the WebSDK as an npm package in future.

You can get the WebSDK either from the DP WebComponents installation , or you can just copy the WebSDK module from the sample. Copy it in your local "vendor modules" directory (not into node_modules!), add this directory into the module resolution list, then import it as a global module (see an example).

ArmandoPerdomo commented 3 years ago

Hello, can you please guys share the solution in the angular way?

I try the following

  1. Install npm install @digitalpersona/devices
  2. Copy these files into my src/app/core/modules folder
  3. In my angular.json I add the index.js like this
    "scripts": [
              "src/app/core/modules/WebSdk/index.js"
            ],
  4. in my app.component.ts I do this
    
    import {FingerprintReader} from "@digitalpersona/devices";
    ...

private reader: FingerprintReader; constructor() { this.reader = new FingerprintReader(); }


But in my console still getting errors

ERROR in node_modules/@digitalpersona/devices/dist/typings/devices/cards/reader.d.ts:1:23 - error TS2688: Cannot find type definition file for 'websdk'.

1 ///

node_modules/@digitalpersona/devices/dist/typings/devices/fingerprints/reader.d.ts:1:23 - error TS2688: Cannot find type definition file for 'websdk'.

1 /// <reference types="WebSdk" />

node_modules/@digitalpersona/devices/dist/typings/devices/iwa/device.d.ts:1:23 - error TS2688: Cannot find type definition file for 'websdk'.

1 ///



am I missing something?