Commit 617a40f6 authored by redwane mahjoubi's avatar redwane mahjoubi

Initial commit

parents
Pipeline #438 failed with stages
# SkyidAngularDemo
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.1.5.
## Development server
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
## Code scaffolding
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
## Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
## Running unit tests
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"skyid-angular-demo": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/skyid-angular-demo",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": [
"zone.js"
],
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "skyid-angular-demo:build:production"
},
"development": {
"browserTarget": "skyid-angular-demo:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "skyid-angular-demo:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "tsconfig.spec.json",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"scripts": []
}
}
}
}
}
}
This diff is collapsed.
{
"name": "skyid-angular-demo",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular/animations": "^15.1.0",
"@angular/common": "^15.1.0",
"@angular/compiler": "^15.1.0",
"@angular/core": "^15.1.0",
"@angular/forms": "^15.1.0",
"@angular/platform-browser": "^15.1.0",
"@angular/platform-browser-dynamic": "^15.1.0",
"@angular/router": "^15.1.0",
"rxjs": "~7.8.0",
"skyid-sdk-web-win": "^1.1.2",
"tslib": "^2.3.0",
"zone.js": "~0.12.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^15.1.5",
"@angular/cli": "~15.1.5",
"@angular/compiler-cli": "^15.1.0",
"@types/jasmine": "~4.3.0",
"jasmine-core": "~4.5.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.0.0",
"typescript": "~4.9.4"
}
}
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
const routes: Routes = [];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
<app-skyid></app-skyid>
\ No newline at end of file
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
RouterTestingModule
],
declarations: [
AppComponent
],
}).compileComponents();
});
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
it(`should have as title 'skyid-angular-demo'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('skyid-angular-demo');
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('.content span')?.textContent).toContain('skyid-angular-demo app is running!');
});
});
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
title = 'skyid-angular-demo';
}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { SkyidComponent } from './skyid/skyid.component';
@NgModule({
declarations: [
AppComponent,
SkyidComponent
],
imports: [
BrowserModule,
AppRoutingModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
<div class="wrapper">
<div id="skyid_fa_document_container">
<div id="skyid_document_browser">
<label For="file-upload" class="custom-file-upload" id="doc_file_label">
Charger votre document ici
</label>
<input id="file-upload" type="file" value="" accept="image/png, image/jpeg"/>
<button id="skyid_da_smart_ocr_button" class="button-36" role="button">Extraire les information de document</button>
<button id="skyid_fa_next" class="button-36" role="button">Suivant</button>
<br/><br/>
<img id="doc_img" src='../assets/no-img-placeholder.png' width="640px" height="480px" alt=""/>
<p id="extracted_feilds"></p>
</div>
<div id="liveness_frame">
<div id="skyid_liveness" ></div>
<br/><br/>
<button id="skyid_fa_start_button" class="button-36" role="button">Démarrer</button>
<br/>
<div id="msg"></div>
</div>
</div>
\ No newline at end of file
html, body {
height: 100%;
width: 100%;
margin: 0;
background-color: #f5f5f5;
display: table;
}
footer {
background-color: black;
font-size:12px;
display: table-row;
padding: 20px;
height: 0;
font-family: Arial, Helvetica, sans-serif;
}
.column {
float: left;
padding: 20px;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
.button-36 {
background-image: linear-gradient(92.88deg, #455EB5 9.16%, #5643CC 43.89%, #673FD7 64.72%);
border-radius: 8px;
border-style: none;
box-sizing: border-box;
color: #FFFFFF;
cursor: pointer;
flex-shrink: 0;
font-family: "Inter UI","SF Pro Display",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif;
font-size: 16px;
font-weight: 500;
height: 4rem;
padding: 0 1.6rem;
text-align: center;
text-shadow: rgba(0, 0, 0, 0.25) 0 3px 8px;
transition: all .5s;
user-select: none;
-webkit-user-select: none;
touch-action: manipulation;
}
.button-36:hover {
box-shadow: rgba(80, 63, 205, 0.5) 0 1px 30px;
transition-duration: .1s;
}
@media (min-width: 768px) {
.button-36 {
padding: 0 2.6rem;
}
}
input[type="file"] {
display: none;
}
.custom-file-upload {
border: 1px solid #ccc;
background-image: linear-gradient(92.88deg, #455EB5 9.16%, #5643CC 43.89%, #673FD7 64.72%);
border-radius: 8px;
color: #FFFFFF;
flex-shrink: 0;
font-family: "Inter UI","SF Pro Display",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif;
display: inline-block;
padding: 6px 12px;
cursor: pointer;
}
.custom-file-upload:hover {
box-shadow: rgba(80, 63, 205, 0.5) 0 1px 30px;
transition-duration: .1s;
}
#skyid_fa_document_container{
margin: auto;
width: 90%;
text-align: center;
}
#skyid_da_smart_ocr_button, #skyid_fa_next,#skyid_fa_document_container,#skyid_fa_start_button{
display: none;
}
#extracted_feilds{
display:none;
border: 2px solid #000;
overflow: scroll;
}
#liveness_frame{
display: none;
text-align: center;
}
#skyid_liveness{
display: flex;
justify-content: center;
}
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SkyidComponent } from './skyid.component';
describe('SkyidComponent', () => {
let component: SkyidComponent;
let fixture: ComponentFixture<SkyidComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ SkyidComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(SkyidComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component,AfterViewInit } from '@angular/core';
//@ts-ignore
import * as $ from 'jquery' ;
//@ts-ignore
import * as skyid_imp from '../../assets/skyid_impl_v1.js'; //Location of 'skyid_impl_v1.js' file
@Component({
selector: 'app-skyid',
templateUrl: './skyid.component.html',
styleUrls: ['./skyid.component.scss']
})
export class SkyidComponent implements AfterViewInit {
ngAfterViewInit(): void {
skyid_imp.initViewComponent()
// init SDK
skyid_imp.skyid_fa_remote_sdk_initialization()
$( document ).ready(function() {
$("#skyid_fa_document_container").show(500);
$( "#skyid_da_smart_ocr_button" ).click(function() {
skyid_imp.skyid_fa_auth_request_smart_ocr();
$("#skyid_da_smart_ocr_button").prop('disabled', true);
$("#skyid_da_smart_ocr_button").html("extraction d'information en cours ...");
});
$( "#skyid_fa_next" ).click(function() {
$( "#skyid_fa_start_button" ).show()
skyid_imp.show_matching_step();
});
$( "#skyid_fa_start_button" ).click(function() {
// start SDK face analysis
skyid_imp.start_face_scan() ;
$( "#skyid_fa_start_button" ).hide();
$( "#msg" ).html("Scanne de visage en cours ....");
});
});
const fileSelector = document.getElementById('file-upload');
fileSelector!.addEventListener('change', (event) => {
if(event.target instanceof HTMLInputElement) {
const myimage: File | null = event.target.files ? event.target.files[0] : null;
if(myimage) {
skyid_imp.readImage(myimage);
}
}
});
// demo call
skyid_imp.skyid_fa_auth_request_smart_ocr_recover("1671122267893033679")
}
}
This diff is collapsed.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>SkyidAngularDemo</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
</html>
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
/* You can add global styles to this file, and also import other style files */
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts"
],
"include": [
"src/**/*.d.ts"
]
}
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "ES2022",
"module": "ES2022",
"useDefineForClassFields": false,
"lib": [
"ES2022",
"dom"
]
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"types": [
"jasmine"
]
},
"include": [
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment