@naniteninja/profile-comparison-lib 1.0.19 → 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import * as i2 from '@angular/common';
|
|
|
5
5
|
import * as i3 from '@angular/common/http';
|
|
6
6
|
import { HttpClient } from '@angular/common/http';
|
|
7
7
|
import * as i4 from '@angular/forms';
|
|
8
|
-
import * as i5 from '@naniteninja/ionic-lib';
|
|
9
8
|
|
|
10
9
|
/** Backend mode for the profile comparison component. */
|
|
11
10
|
declare enum BackendMode {
|
|
@@ -36,13 +35,13 @@ declare const PROFILE_COMPARISON_VERBOSE_LOGGING: InjectionToken<() => boolean>;
|
|
|
36
35
|
declare function resolveBackendUrl(backendUrl: string | null | undefined, backendMode: BackendMode, legacyTokenUrl: string | null | undefined): string | null;
|
|
37
36
|
|
|
38
37
|
interface IProfileConfig {
|
|
38
|
+
person1Name?: string;
|
|
39
|
+
person2Name?: string;
|
|
39
40
|
person1Interests: string[];
|
|
40
41
|
person2Interests: string[];
|
|
41
42
|
person3Interests: string[];
|
|
42
43
|
user1Image: string;
|
|
43
44
|
user2Image: string;
|
|
44
|
-
edgeShading?: boolean;
|
|
45
|
-
shadingColor?: string;
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
interface IBoundingBox {
|
|
@@ -206,10 +205,8 @@ interface IComparisonPayload {
|
|
|
206
205
|
alignedPerson1Interests: string[];
|
|
207
206
|
alignedPerson2Interests: string[];
|
|
208
207
|
centerItem: string[];
|
|
209
|
-
similarities: number[];
|
|
210
208
|
matrixData: IMatrixData | null;
|
|
211
209
|
rawLLMOutput?: string;
|
|
212
|
-
debug?: any;
|
|
213
210
|
}
|
|
214
211
|
|
|
215
212
|
declare const STORE_NAMES: readonly ["openai-spacer", "openai-alignment", "openai-similarity", "openai-embeddings", "profile-face", "profile-compare"];
|
|
@@ -246,6 +243,8 @@ declare class FileConversionService {
|
|
|
246
243
|
private static readonly FILE_EXTENSION_PNG;
|
|
247
244
|
private static readonly FILE_EXTENSION_WEBP;
|
|
248
245
|
urlToFile(url: string, fileName: string, mimeType: string): Observable<File>;
|
|
246
|
+
fetchUrlToDataUrl(url: string): Observable<string>;
|
|
247
|
+
private loadImageViaCanvas;
|
|
249
248
|
isDataUrl(str: string): boolean;
|
|
250
249
|
dataUrlToFile(dataUrl: string, fileName: string): File;
|
|
251
250
|
getMimeFromFilename(fileName: string): string;
|
|
@@ -411,6 +410,7 @@ declare class ProfileComparisonLibComponent implements OnInit, AfterViewInit, On
|
|
|
411
410
|
private imageCompressionService;
|
|
412
411
|
private cdr;
|
|
413
412
|
private getVerboseLogging?;
|
|
413
|
+
private static readonly DEFAULT_OBJECT_POSITION;
|
|
414
414
|
private static readonly DEFAULT_EYE_ALIGNMENT_BIAS_PX;
|
|
415
415
|
private static readonly DEFAULT_IMAGE_FORMAT;
|
|
416
416
|
private static readonly DEFAULT_IMAGE_QUALITY_START;
|
|
@@ -424,15 +424,14 @@ declare class ProfileComparisonLibComponent implements OnInit, AfterViewInit, On
|
|
|
424
424
|
private static readonly DEFAULT_MAX_HEIGHT;
|
|
425
425
|
private static readonly SPACER_SMALL;
|
|
426
426
|
private static readonly SPACER_LARGE;
|
|
427
|
-
private static readonly PLACEHOLDER;
|
|
428
427
|
private static readonly CONSOLIDATION_SEPARATOR_X;
|
|
429
428
|
private static readonly CONSOLIDATION_SEPARATOR_SLASH;
|
|
430
429
|
private static readonly FACEPP_RATE_LIMIT_DELAY_MS;
|
|
431
430
|
private static readonly DEFAULT_PROFILE_IMAGE_NAME;
|
|
432
431
|
private static readonly SHAPE_BG_HEIGHT;
|
|
433
432
|
private static readonly SHAPE_BG_OBJECT_FIT;
|
|
434
|
-
private static readonly
|
|
435
|
-
private static readonly
|
|
433
|
+
private static readonly SHAPE_BG1_OBJECT_POSITION;
|
|
434
|
+
private static readonly SHAPE_BG2_OBJECT_POSITION;
|
|
436
435
|
private static readonly DRAG_MIN_WIDTH;
|
|
437
436
|
private static readonly DRAG_MAX_WIDTH;
|
|
438
437
|
private static readonly MAX_DRAG_DISTANCE;
|
|
@@ -443,25 +442,32 @@ declare class ProfileComparisonLibComponent implements OnInit, AfterViewInit, On
|
|
|
443
442
|
private static readonly TRANSFORM_RESET;
|
|
444
443
|
private static readonly TRANSITION_RESET_DELAY_MS;
|
|
445
444
|
config: IProfileConfig;
|
|
445
|
+
user1File: File | null;
|
|
446
|
+
user2File: File | null;
|
|
446
447
|
backendMode: BackendMode;
|
|
447
448
|
backendUrl: string | null;
|
|
448
449
|
fadeAllEdges: boolean;
|
|
450
|
+
person1Name: string;
|
|
451
|
+
person2Name: string;
|
|
452
|
+
imageProxyPath: string;
|
|
449
453
|
matrixDataChange: EventEmitter<IMatrixData>;
|
|
450
454
|
rawLLMOutputChange: EventEmitter<string>;
|
|
451
455
|
viewProfileClick: EventEmitter<{
|
|
452
456
|
side: "left" | "right";
|
|
453
457
|
}>;
|
|
454
|
-
/** Fires when the user drags a frame to its maximum displacement and
|
|
455
|
-
* continues pulling past the edge. The parent can use this to swipe to
|
|
456
|
-
* the next/previous prospect in its own swiper. */
|
|
457
|
-
edgeDrag: EventEmitter<"left" | "right">;
|
|
458
458
|
selectedFile: File | null;
|
|
459
459
|
firstImageData: FaceDetectionData | null;
|
|
460
460
|
secondImageData: FaceDetectionData | null;
|
|
461
461
|
user1Transform: string;
|
|
462
462
|
user2Transform: string;
|
|
463
|
+
user1Top: string;
|
|
464
|
+
user1Height: string;
|
|
465
|
+
user2Top: string;
|
|
466
|
+
user2Height: string;
|
|
463
467
|
alignmentCalculated: boolean;
|
|
464
468
|
isAligning: boolean;
|
|
469
|
+
/** Set when backend returns an error (e.g. 503 API keys not configured). */
|
|
470
|
+
backendError: string | null;
|
|
465
471
|
user1ObjectPosition: string;
|
|
466
472
|
user2ObjectPosition: string;
|
|
467
473
|
private user1NaturalWidth;
|
|
@@ -487,12 +493,6 @@ declare class ProfileComparisonLibComponent implements OnInit, AfterViewInit, On
|
|
|
487
493
|
alignedPerson2Interests: string[];
|
|
488
494
|
leftProfileClicked: boolean;
|
|
489
495
|
rightProfileClicked: boolean;
|
|
490
|
-
leftShapeAnimating: boolean;
|
|
491
|
-
rightShapeAnimating: boolean;
|
|
492
|
-
similarities: number[];
|
|
493
|
-
get viewProfileLeftX(): number;
|
|
494
|
-
get viewProfileRightX(): number;
|
|
495
|
-
onResize(): void;
|
|
496
496
|
sortedA: {
|
|
497
497
|
item: string;
|
|
498
498
|
score: number;
|
|
@@ -512,19 +512,21 @@ declare class ProfileComparisonLibComponent implements OnInit, AfterViewInit, On
|
|
|
512
512
|
backendConfigured: boolean;
|
|
513
513
|
/** The resolved backend URL computed from inputs and legacy token. */
|
|
514
514
|
private resolvedBackendUrl;
|
|
515
|
-
/** Flag to prevent click animations after a drag. */
|
|
516
|
-
private wasDragging;
|
|
517
515
|
compressionConfig: IImageCompressionConfig;
|
|
518
516
|
private computeSub?;
|
|
519
517
|
/** Incremented on each fetchComparison(); used to ignore stale success/error from an older request. */
|
|
520
518
|
private fetchRequestId;
|
|
521
519
|
leftContainer: ElementRef;
|
|
522
520
|
rightContainer: ElementRef;
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
rightBgFrame: ElementRef<HTMLElement>;
|
|
521
|
+
profileFlex: ElementRef<HTMLElement>;
|
|
522
|
+
profileImgLeft: ElementRef<HTMLElement>;
|
|
523
|
+
profileImgRight: ElementRef<HTMLElement>;
|
|
527
524
|
shapeContainer: ElementRef<HTMLElement>;
|
|
525
|
+
shapeBg: ElementRef<HTMLElement>;
|
|
526
|
+
shapeBg1: ElementRef<SVGElement>;
|
|
527
|
+
shapeBg2: ElementRef<SVGElement>;
|
|
528
|
+
shapeTextLeft: ElementRef<HTMLElement>;
|
|
529
|
+
shapeTextRight: ElementRef<HTMLElement>;
|
|
528
530
|
shapeTextCenter: ElementRef<HTMLElement>;
|
|
529
531
|
constructor(backendService: ProfileComparisonBackendService, renderer: Renderer2, fileConversionService: FileConversionService, imageCompressionService: ImageCompressionService, cdr: ChangeDetectorRef, getVerboseLogging?: (() => boolean) | undefined);
|
|
530
532
|
private log;
|
|
@@ -533,13 +535,8 @@ declare class ProfileComparisonLibComponent implements OnInit, AfterViewInit, On
|
|
|
533
535
|
ngOnInit(): void;
|
|
534
536
|
ngAfterViewInit(): void;
|
|
535
537
|
ngOnChanges(changes: SimpleChanges): void;
|
|
536
|
-
/**
|
|
537
|
-
|
|
538
|
-
* - 'high': Very similar (Short single dash, 0.5 opacity)
|
|
539
|
-
* - 'medium': Almost similar (Standard 1 dash)
|
|
540
|
-
* - 'low': Very dissimilar (4 small dashes)
|
|
541
|
-
*/
|
|
542
|
-
getDashType(index: number): 'high' | 'medium' | 'low';
|
|
538
|
+
/** Use for template: hide left/right item when it's a shared (center) item. Compares case-insensitively. */
|
|
539
|
+
isInCenter(interest: string): boolean;
|
|
543
540
|
private fetchComparison;
|
|
544
541
|
private updateConfigProperties;
|
|
545
542
|
private buildConfigWithDefaults;
|
|
@@ -549,16 +546,14 @@ declare class ProfileComparisonLibComponent implements OnInit, AfterViewInit, On
|
|
|
549
546
|
private getOverlapSizeCssPx;
|
|
550
547
|
private setOverlapSizeCssPx;
|
|
551
548
|
waitForImagesAndInitDrag(): void;
|
|
552
|
-
/**
|
|
553
|
-
* Toggles .edge-at-left-border / .edge-at-right-border classes on both
|
|
554
|
-
* interactive and background frames based on their outer edge position
|
|
555
|
-
* relative to the container boundary.
|
|
556
|
-
*/
|
|
557
|
-
private updateEdgeMasks;
|
|
558
549
|
initDrag(): void;
|
|
550
|
+
private getSimilarity;
|
|
551
|
+
private reorderInterestsByMatrix;
|
|
559
552
|
onViewProfile(side: 'left' | 'right'): void;
|
|
560
|
-
|
|
561
|
-
|
|
553
|
+
getPerson1UniqueInterests(): string[];
|
|
554
|
+
getPerson2UniqueInterests(): string[];
|
|
555
|
+
getChipOffset(index: number, column: 'left' | 'center' | 'right'): number;
|
|
556
|
+
private compressInputImages;
|
|
562
557
|
private compressImageStringToDataUrl;
|
|
563
558
|
getEyeCoordinatesFromBBox(bbox: IBoundingBox): {
|
|
564
559
|
leftEye: IPoint;
|
|
@@ -582,12 +577,12 @@ declare class ProfileComparisonLibComponent implements OnInit, AfterViewInit, On
|
|
|
582
577
|
applyDefaultAlignment(): void;
|
|
583
578
|
isValidFaceData(face: IBoundingBox): boolean;
|
|
584
579
|
static ɵfac: i0.ɵɵFactoryDeclaration<ProfileComparisonLibComponent, [null, null, null, null, null, { optional: true; }]>;
|
|
585
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ProfileComparisonLibComponent, "lib-profile-comparison", never, { "config": { "alias": "config"; "required": false; }; "backendMode": { "alias": "backendMode"; "required": false; }; "backendUrl": { "alias": "backendUrl"; "required": false; }; "fadeAllEdges": { "alias": "fadeAllEdges"; "required": false; }; }
|
|
580
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ProfileComparisonLibComponent, "lib-profile-comparison", never, { "config": { "alias": "config"; "required": false; }; "user1File": { "alias": "user1File"; "required": false; }; "user2File": { "alias": "user2File"; "required": false; }; "backendMode": { "alias": "backendMode"; "required": false; }; "backendUrl": { "alias": "backendUrl"; "required": false; }; "fadeAllEdges": { "alias": "fadeAllEdges"; "required": false; }; "person1Name": { "alias": "person1Name"; "required": false; }; "person2Name": { "alias": "person2Name"; "required": false; }; "imageProxyPath": { "alias": "imageProxyPath"; "required": false; }; }, { "matrixDataChange": "matrixDataChange"; "rawLLMOutputChange": "rawLLMOutputChange"; "viewProfileClick": "viewProfileClick"; }, never, never, false, never>;
|
|
586
581
|
}
|
|
587
582
|
|
|
588
583
|
declare class ProfileComparisonLibModule {
|
|
589
584
|
static ɵfac: i0.ɵɵFactoryDeclaration<ProfileComparisonLibModule, never>;
|
|
590
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<ProfileComparisonLibModule, [typeof ProfileComparisonLibComponent], [typeof i2.CommonModule, typeof i3.HttpClientModule, typeof i4.FormsModule, typeof i4.ReactiveFormsModule
|
|
585
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<ProfileComparisonLibModule, [typeof ProfileComparisonLibComponent], [typeof i2.CommonModule, typeof i3.HttpClientModule, typeof i4.FormsModule, typeof i4.ReactiveFormsModule], [typeof ProfileComparisonLibComponent]>;
|
|
591
586
|
static ɵinj: i0.ɵɵInjectorDeclaration<ProfileComparisonLibModule>;
|
|
592
587
|
}
|
|
593
588
|
|