@firestitch/2fa 12.0.6 → 12.0.7
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/app/components/2fa-verification/2fa-verification.component.d.ts +32 -26
- package/app/components/2fa-verification-code/2fa-verification-code.component.d.ts +18 -11
- package/app/components/2fa-verification-methods/2fa-verification-methods.component.d.ts +23 -23
- package/app/enums/verification-method-type.enum.d.ts +5 -6
- package/app/fs-2fa.module.d.ts +23 -23
- package/app/interfaces/verification-method.interface.d.ts +11 -11
- package/app/interfaces/verification-provider.interface.d.ts +8 -8
- package/app/tokens/verification.token.d.ts +3 -3
- package/bundles/firestitch-2fa.umd.js +289 -292
- package/bundles/firestitch-2fa.umd.js.map +1 -1
- package/esm2015/app/components/2fa-verification/2fa-verification.component.js +106 -91
- package/esm2015/app/components/2fa-verification-code/2fa-verification-code.component.js +60 -45
- package/esm2015/app/components/2fa-verification-methods/2fa-verification-methods.component.js +73 -73
- package/esm2015/app/enums/verification-method-type.enum.js +7 -8
- package/esm2015/app/fs-2fa.module.js +88 -91
- package/esm2015/app/interfaces/verification-method.interface.js +1 -1
- package/esm2015/app/interfaces/verification-provider.interface.js +1 -1
- package/esm2015/app/tokens/verification.token.js +2 -2
- package/esm2015/firestitch-2fa.js +4 -4
- package/esm2015/public_api.js +8 -8
- package/fesm2015/firestitch-2fa.js +273 -274
- package/fesm2015/firestitch-2fa.js.map +1 -1
- package/firestitch-2fa.d.ts +5 -5
- package/package.json +1 -1
- package/public_api.d.ts +6 -6
- package/app/components/2fa-verification-otp/2fa-verification-otp.component.d.ts +0 -12
- package/esm2015/app/components/2fa-verification-otp/2fa-verification-otp.component.js +0 -33
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firestitch-2fa.js","sources":["../../src/app/tokens/verification.token.ts","../../src/app/enums/verification-method-type.enum.ts","../../src/app/components/2fa-verification-methods/2fa-verification-methods.component.ts","../../src/app/components/2fa-verification-methods/2fa-verification-methods.component.html","../../src/app/components/2fa-verification-otp/2fa-verification-otp.component.ts","../../src/app/components/2fa-verification-otp/2fa-verification-otp.component.html","../../src/app/components/2fa-verification-code/2fa-verification-code.component.ts","../../src/app/components/2fa-verification-code/2fa-verification-code.component.html","../../src/app/components/2fa-verification/2fa-verification.component.ts","../../src/app/components/2fa-verification/2fa-verification.component.html","../../src/app/fs-2fa.module.ts","../../src/public_api.ts","../../src/firestitch-2fa.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nimport { IFsVerificationProvider } from '../interfaces/verification-provider.interface';\n\nexport const FS_2FA_VERIFICATION_PROVIDER = new InjectionToken<IFsVerificationProvider>(\n 'Provider for Verification service',\n);\n","export enum FsVerificationMethodType {\n Sms = 'sms',\n Email = 'email',\n Authenticator = 'authenticator',\n Code = 'code',\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n Inject,\n} from '@angular/core';\n\nimport { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';\n\nimport { Observable } from 'rxjs';\nimport { map, shareReplay, tap } from 'rxjs/operators';\n\nimport { FS_2FA_VERIFICATION_PROVIDER } from '../../tokens/verification.token';\nimport { FsVerificationMethodType } from '../../enums/verification-method-type.enum';\nimport { IFsVerificationProvider } from '../../interfaces/verification-provider.interface';\nimport { IFsVerificationMethod } from '../../interfaces/verification-method.interface';\n\n\n@Component({\n templateUrl: './2fa-verification-methods.component.html',\n styleUrls: [\n './2fa-verification-methods.component.scss',\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class Fs2FaVerificationMethodsComponent {\n\n public method: IFsVerificationMethod;\n public phone: string;\n public code: string;\n public methods$: Observable<Record<string, IFsVerificationMethod[]>>;\n public readonly verificationMethodType = FsVerificationMethodType;\n\n constructor(\n @Inject(FS_2FA_VERIFICATION_PROVIDER)\n private _verificationProvider: IFsVerificationProvider,\n @Inject(MAT_DIALOG_DATA)\n private _dialogData: any,\n private _dialogRef: MatDialogRef<Fs2FaVerificationMethodsComponent>,\n ) {\n this._setActiveMethod();\n this._initMethods();\n }\n\n public compareWith(o1, o2) {\n return o1 && o2 && o1.id === o2.id\n }\n\n public setVerificationMethod = () => {\n return this._verificationProvider\n .updateVerificationMethod(this.method.id)\n .pipe(\n tap((method: IFsVerificationMethod) => {\n this._dialogRef.close(method);\n })\n );\n };\n\n private _setActiveMethod(): void {\n this.method = this._dialogData?.method;\n }\n\n private _initMethods(): void {\n this.methods$ = this._verificationProvider\n .methods()\n .pipe(\n map((methods) => {\n return methods\n .reduce((acc, method) => {\n if (!acc[method.type]) {\n acc[method.type] = [];\n }\n\n acc[method.type].push(method);\n\n return acc;\n }, {});\n }),\n shareReplay(1),\n );\n }\n}\n","<fs-dialog>\n <h1 mat-dialog-title>\n Verification Methods\n </h1>\n <form fsForm [submit]=\"setVerificationMethod\" [dirtySubmitButton]=\"false\">\n <mat-dialog-content>\n <ng-container *fsSkeleton=\"methods$ | async as methods\">\n <fs-radio-group [(ngModel)]=\"method\" name=\"method\" [compareWith]=\"compareWith\">\n <ng-container *ngFor=\"let methodMap of methods | keyvalue\">\n <div class=\"method\">\n <ng-container [ngSwitch]=\"methodMap.key\">\n <ng-container *ngSwitchCase=\"verificationMethodType.Sms\">\n <div class=\"method-header\">\n <div class=\"method-icon\">\n <mat-icon>\n smartphone\n </mat-icon>\n </div>\n <div class=\"method-name\">\n <div class=\"method-title\">Text Message</div>\n <div class=\"method-subtitle\">\n Verification code send to one of following mobile number\n </div>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"verificationMethodType.Email\">\n <div class=\"method-header\">\n <div class=\"method-icon\">\n <mat-icon>\n mail\n </mat-icon>\n </div>\n <div class=\"method-name\">\n <div class=\"method-title\">Email</div>\n <div class=\"method-subtitle\">\n Verification code send to one of following email\n </div>\n </div>\n </div>\n </ng-container>\n </ng-container>\n\n <ng-container [ngSwitch]=\"methodMap.key\">\n <ng-container *ngSwitchCase=\"verificationMethodType.Sms\">\n <mat-radio-button class=\"method-item\" *ngFor=\"let method of methodMap.value\" [value]=\"method\">\n {{ method.phoneNumber }}\n </mat-radio-button>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"verificationMethodType.Email\">\n <mat-radio-button class=\"method-item\" *ngFor=\"let method of methodMap.value\" [value]=\"method\">\n {{ method.email }}\n </mat-radio-button>\n </ng-container>\n </ng-container>\n </div>\n </ng-container>\n </fs-radio-group>\n </ng-container>\n </mat-dialog-content>\n <mat-dialog-actions>\n <div class=\"actions\">\n <ng-container *ngIf=\"methods$ | async\">\n <button mat-button type=\"submit\" color=\"primary\">Next</button>\n </ng-container>\n <button mat-button type=\"button\" [mat-dialog-close]=\"null\">Cancel</button>\n </div>\n </mat-dialog-actions>\n </form>\n</fs-dialog>\n","import {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n Output,\n} from '@angular/core';\n\nimport { FsFormDirective } from '@firestitch/form';\n\n\n@Component({\n selector: 'fs-2fa-verification-otp',\n templateUrl: './2fa-verification-otp.component.html',\n styleUrls: [\n './2fa-verification-otp.component.scss'\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class Fs2FAVerificationOTPComponent {\n\n @Output()\n public codeChange = new EventEmitter<string>();\n\n constructor(\n public form: FsFormDirective,\n ) {}\n\n public codeChanged(event: string): void {\n this.codeChange.emit(event);\n this.form.dirty();\n }\n\n public codeCompleted(): void {\n this.form.triggerSubmit();\n }\n}\n","<p class=\"description\">\n Enter the verification code generated by your 2 factor authenticator\n app to verify it's you\n</p>\n\n<!--\n<code-input [initialFocusField]=\"0\"\n [codeLength]=\"6\"\n (codeChanged)=\"codeChanged($event)\"\n (codeCompleted)=\"codeCompleted()\">>\n</code-input>\n-->\n","import {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n Input,\n Output,\n} from '@angular/core';\nimport { ControlContainer, NgForm } from '@angular/forms';\n\nimport { IFsVerificationMethod } from '../../interfaces/verification-method.interface';\n\n\n@Component({\n selector: 'fs-2fa-verification-code',\n templateUrl: './2fa-verification-code.component.html',\n styleUrls: [\n './2fa-verification-code.component.scss',\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n viewProviders: [\n {\n provide: ControlContainer,\n useExisting: NgForm,\n },\n ],\n})\nexport class Fs2FAVerificationSMSComponent {\n\n @Input()\n public method: IFsVerificationMethod;\n\n @Output()\n public codeChange = new EventEmitter<string>();\n\n public code: string;\n\n public codeChanged(): void {\n this.codeChange.emit(this.code);\n }\n\n}\n","<p class=\"description\">\n <ng-container *ngIf=\"method.phoneNumber && method.type === 'sms'\">\n A text message with a verification code was just\n sent to <span style=\"white-space: nowrap;\">{{ method.phoneNumber }}</span> to verify it's you.\n </ng-container>\n\n <ng-container *ngIf=\"method.type === 'email'\">\n A email with a verification code was just sent to {{ method.email }} to verify it's you.\n </ng-container>\n\n <ng-container *ngIf=\"false\">\n Enter the one time code generated by the app administrator to verify it's you.\n </ng-container>\n</p>\n\n<mat-form-field>\n <mat-label>Code</mat-label>\n <input type=\"text\"\n matInput\n name=\"code\"\n autocomplete=\"one-time-code\"\n [(ngModel)]=\"code\"\n (ngModelChange)=\"codeChanged()\"\n required\n placeholder=\"Enter the code\"\n inputmode=\"numeric\">\n</mat-form-field>\n","import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n EventEmitter,\n Inject,\n Input,\n OnDestroy,\n Output,\n} from '@angular/core';\n\nimport { FsDialog } from '@firestitch/dialog';\n\nimport { filter, takeUntil, tap } from 'rxjs/operators';\n\nimport { IFsVerificationMethod } from '../../interfaces/verification-method.interface';\nimport { Fs2FaVerificationMethodsComponent } from '../2fa-verification-methods/2fa-verification-methods.component';\nimport { Subject } from 'rxjs';\nimport { FS_2FA_VERIFICATION_PROVIDER } from '../../tokens/verification.token';\nimport { IFsVerificationProvider } from '../../interfaces/verification-provider.interface';\n\n\n@Component({\n selector: 'fs-2fa-verification',\n templateUrl: './2fa-verification.component.html',\n styleUrls: [\n './2fa-verification.component.scss',\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class Fs2FAVerificationComponent implements OnDestroy {\n\n @Input()\n public method: IFsVerificationMethod;\n\n @Output()\n public verified = new EventEmitter<unknown>();\n\n @Output()\n public backToSignIn = new EventEmitter<void>();\n\n\n public resendInProgress = false;\n public trustedDevice = false;\n\n private _code: string;\n private _destroy$ = new Subject<void>();\n\n constructor(\n @Inject(FS_2FA_VERIFICATION_PROVIDER)\n public verificationProvider: IFsVerificationProvider,\n private _cdRef: ChangeDetectorRef,\n private _dialog: FsDialog,\n ) {}\n\n public ngOnDestroy(): void {\n this._destroy$.next();\n this._destroy$.complete();\n }\n\n public verify = () => {\n return this.verificationProvider\n .verify(this._code, this.trustedDevice)\n .pipe(\n tap((response) => {\n this.verified.emit(response);\n }),\n );\n };\n\n public codeChanged(code: string): void {\n this._code = code;\n }\n\n public resend(): void {\n this.resendInProgress = true;\n\n this.verificationProvider\n .resend()\n .pipe(\n takeUntil(this._destroy$),\n )\n .subscribe(() => {\n this.resendInProgress = false;\n\n this._cdRef.markForCheck();\n })\n }\n\n public showVerificationMethods(): void {\n this._dialog.open(\n Fs2FaVerificationMethodsComponent,\n {\n data: {\n method: this.method,\n }\n }\n )\n .afterClosed()\n .pipe(\n filter((method) => !!method),\n )\n .subscribe((method) => {\n this.method = method;\n\n this._cdRef.markForCheck();\n });\n }\n\n public toSignIn(): void {\n this.backToSignIn.emit();\n }\n\n}\n","<form fsForm [submit]=\"verify\" [dirtySubmitButton]=\"false\">\n <h2>2-Step Verification</h2>\n\n <div class=\"code-container\">\n <ng-container *ngIf=\"method.type === 'authenticator' else code\">\n <fs-2fa-verification-otp class=\"otp\"></fs-2fa-verification-otp>\n </ng-container>\n\n <ng-template #code>\n <fs-2fa-verification-code\n [method]=\"method\"\n (codeChange)=\"codeChanged($event)\">\n </fs-2fa-verification-code>\n </ng-template>\n </div>\n\n <div class=\"additional\">\n <mat-checkbox\n name=\"trust-device\"\n [(ngModel)]=\"trustedDevice\">\n Trust this device\n </mat-checkbox>\n\n <span class=\"resend-code-btn\">\n <ng-container *ngIf=\"!resendInProgress else sending\">\n <a (click)=\"resend()\">\n Resend Code\n </a>\n </ng-container>\n <ng-template #sending>\n <mat-spinner [diameter]=\"12\"></mat-spinner> Sending\n </ng-template>\n </span>\n </div>\n\n <div class=\"actions\">\n <button mat-raised-button\n color=\"primary\"\n type=\"submit\">\n Verify\n </button>\n\n <button mat-button type=\"button\" (click)=\"showVerificationMethods()\">\n Try other ways to verify\n </button>\n\n <button mat-button type=\"button\" (click)=\"toSignIn()\">\n Back to signin\n </button>\n </div>\n</form>\n","import { NgModule } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { CommonModule } from '@angular/common';\n\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatRadioModule } from '@angular/material/radio';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\n\nimport { FsFormModule } from '@firestitch/form';\nimport { FsSkeletonModule } from '@firestitch/skeleton';\nimport { FsRadioGroupModule } from '@firestitch/radiogroup';\nimport { FsDialogModule } from '@firestitch/dialog';\n\n// import { CodeInputModule } from 'angular-code-input';\n\nimport { Fs2FAVerificationComponent } from './components/2fa-verification/2fa-verification.component';\nimport { Fs2FAVerificationSMSComponent } from './components/2fa-verification-code/2fa-verification-code.component';\nimport { Fs2FAVerificationOTPComponent } from './components/2fa-verification-otp/2fa-verification-otp.component';\nimport { Fs2FaVerificationMethodsComponent } from './components/2fa-verification-methods/2fa-verification-methods.component';\n\n\n@NgModule({\n imports: [\n CommonModule,\n FormsModule,\n\n MatFormFieldModule,\n MatInputModule,\n MatButtonModule,\n\n FsFormModule,\n FsRadioGroupModule,\n FsDialogModule,\n\n // CodeInputModule,\n MatCheckboxModule,\n MatProgressSpinnerModule,\n FsSkeletonModule,\n FsSkeletonModule,\n MatIconModule,\n MatRadioModule,\n ],\n declarations: [\n Fs2FAVerificationComponent,\n\n Fs2FAVerificationSMSComponent,\n Fs2FAVerificationOTPComponent,\n Fs2FaVerificationMethodsComponent,\n ],\n exports: [\n Fs2FAVerificationComponent,\n ],\n providers: [],\n})\nexport class Fs2FaModule {}\n","/*\n * Public API Surface of fs-2fa\n */\n\nexport { Fs2FaModule } from './app/fs-2fa.module';\n\n// Components\nexport { Fs2FAVerificationComponent } from './app/components/2fa-verification/2fa-verification.component';\n\nexport { IFsVerificationProvider } from './app/interfaces/verification-provider.interface';\nexport { IFsVerificationMethod } from './app/interfaces/verification-method.interface';\n\nexport { FsVerificationMethodType } from './app/enums/verification-method-type.enum';\n\nexport { FS_2FA_VERIFICATION_PROVIDER } from './app/tokens/verification.token';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAIa,4BAA4B,GAAG,IAAI,cAAc,CAC5D,mCAAmC;;ICLzB;AAAZ,WAAY,wBAAwB;IAClC,uCAAW,CAAA;IACX,2CAAe,CAAA;IACf,2DAA+B,CAAA;IAC/B,yCAAa,CAAA;AACf,CAAC,EALW,wBAAwB,KAAxB,wBAAwB;;MCwBvB,iCAAiC;IAQ5C,YAEU,qBAA8C,EAE9C,WAAgB,EAChB,UAA2D;QAH3D,0BAAqB,GAArB,qBAAqB,CAAyB;QAE9C,gBAAW,GAAX,WAAW,CAAK;QAChB,eAAU,GAAV,UAAU,CAAiD;QAPrD,2BAAsB,GAAG,wBAAwB,CAAC;QAiB3D,0BAAqB,GAAG;YAC7B,OAAO,IAAI,CAAC,qBAAqB;iBAC9B,wBAAwB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;iBACxC,IAAI,CACH,GAAG,CAAC,CAAC,MAA6B;gBAChC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;aAC/B,CAAC,CACH,CAAC;SACL,CAA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iBAAiB;wBACjB,wBAAwB;wBACxB,gBAAgB;wBAChB,gBAAgB;wBAChB,aAAa;wBACb,cAAc;qBACf;oBACD,YAAY,EAAE;wBACZ,0BAA0B;wBAE1B,6BAA6B;wBAC7B,6BAA6B;wBAC7B,iCAAiC;qBAClC;oBACD,OAAO,EAAE;wBACP,0BAA0B;qBAC3B;oBACD,SAAS,EAAE,EAAE;iBACd;;;ACzDD;;;;ACAA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"firestitch-2fa.js","sources":["../../src/app/tokens/verification.token.ts","../../src/app/enums/verification-method-type.enum.ts","../../src/app/components/2fa-verification-methods/2fa-verification-methods.component.ts","../../src/app/components/2fa-verification-methods/2fa-verification-methods.component.html","../../src/app/components/2fa-verification-code/2fa-verification-code.component.ts","../../src/app/components/2fa-verification-code/2fa-verification-code.component.html","../../src/app/components/2fa-verification/2fa-verification.component.ts","../../src/app/components/2fa-verification/2fa-verification.component.html","../../src/app/fs-2fa.module.ts","../../src/public_api.ts","../../src/firestitch-2fa.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nimport { IFsVerificationProvider } from '../interfaces/verification-provider.interface';\n\nexport const FS_2FA_VERIFICATION_PROVIDER = new InjectionToken<IFsVerificationProvider>(\n 'Provider for Verification service',\n);\n","export enum FsVerificationMethodType {\n Sms = 'sms',\n Email = 'email',\n App = 'app',\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n Inject,\n} from '@angular/core';\n\nimport { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';\n\nimport { Observable } from 'rxjs';\nimport { map, shareReplay, tap } from 'rxjs/operators';\n\nimport { FS_2FA_VERIFICATION_PROVIDER } from '../../tokens/verification.token';\nimport { FsVerificationMethodType } from '../../enums/verification-method-type.enum';\nimport { IFsVerificationProvider } from '../../interfaces/verification-provider.interface';\nimport { IFsVerificationMethod } from '../../interfaces/verification-method.interface';\n\n\n@Component({\n templateUrl: './2fa-verification-methods.component.html',\n styleUrls: [\n './2fa-verification-methods.component.scss',\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class Fs2FaVerificationMethodsComponent {\n\n public method: IFsVerificationMethod;\n public phone: string;\n public code: string;\n public methods$: Observable<Record<string, IFsVerificationMethod[]>>;\n public readonly verificationMethodType = FsVerificationMethodType;\n\n constructor(\n @Inject(FS_2FA_VERIFICATION_PROVIDER)\n private _verificationProvider: IFsVerificationProvider,\n @Inject(MAT_DIALOG_DATA)\n private _dialogData: any,\n private _dialogRef: MatDialogRef<Fs2FaVerificationMethodsComponent>,\n ) {\n this._setActiveMethod();\n this._initMethods();\n }\n\n public compareWith(o1, o2) {\n return o1 && o2 && o1.id === o2.id\n }\n\n public setVerificationMethod = () => {\n return this._verificationProvider\n .updateVerificationMethod(this.method.id)\n .pipe(\n tap((method: IFsVerificationMethod) => {\n this._dialogRef.close(method);\n })\n );\n };\n\n private _setActiveMethod(): void {\n this.method = this._dialogData?.method;\n }\n\n private _initMethods(): void {\n this.methods$ = this._verificationProvider\n .methods()\n .pipe(\n map((methods) => {\n return methods\n .reduce((acc, method) => {\n if (!acc[method.type]) {\n acc[method.type] = [];\n }\n\n acc[method.type].push(method);\n\n return acc;\n }, {});\n }),\n shareReplay(1),\n );\n }\n}\n","<fs-dialog>\n <h1 mat-dialog-title>\n Verification Methods\n </h1>\n <form fsForm [submit]=\"setVerificationMethod\" [dirtySubmitButton]=\"false\">\n <mat-dialog-content>\n <ng-container *fsSkeleton=\"methods$ | async as methods\">\n <fs-radio-group [(ngModel)]=\"method\" name=\"method\" [compareWith]=\"compareWith\">\n <ng-container *ngFor=\"let methodMap of methods | keyvalue\">\n <div class=\"method\">\n <ng-container [ngSwitch]=\"methodMap.key\">\n <ng-container *ngSwitchCase=\"verificationMethodType.Sms\">\n <div class=\"method-header\">\n <div class=\"method-icon\">\n <mat-icon>\n textsms\n </mat-icon>\n </div>\n <div class=\"method-name\">\n <div class=\"method-title\">Text Message</div>\n <div class=\"method-subtitle\">\n Verification code send to one of following mobile number\n </div>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"verificationMethodType.Email\">\n <div class=\"method-header\">\n <div class=\"method-icon\">\n <mat-icon>\n mail\n </mat-icon>\n </div>\n <div class=\"method-name\">\n <div class=\"method-title\">Email</div>\n <div class=\"method-subtitle\">\n Verification code send to one of following email\n </div>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"verificationMethodType.App\">\n <div class=\"method-header\">\n <div class=\"method-icon\">\n <mat-icon>\n phone_iphone\n </mat-icon>\n </div>\n <div class=\"method-name\">\n <div class=\"method-title\">Authenticator App</div>\n <div class=\"method-subtitle\">\n Verification code generated by an authenticator app\n </div>\n </div>\n </div>\n </ng-container> \n </ng-container>\n\n <mat-radio-button class=\"method-item\" *ngFor=\"let method of methodMap.value\" [value]=\"method\">\n <ng-container [ngSwitch]=\"methodMap.key\">\n <ng-container *ngSwitchCase=\"verificationMethodType.Sms\">\n {{ method.phoneNumber }}\n </ng-container>\n <ng-container *ngSwitchCase=\"verificationMethodType.Email\">\n {{ method.email }}\n </ng-container>\n <ng-container *ngSwitchCase=\"verificationMethodType.App\">\n Authenticator App\n </ng-container> \n </ng-container>\n </mat-radio-button>\n </div>\n </ng-container>\n </fs-radio-group>\n </ng-container>\n </mat-dialog-content>\n <mat-dialog-actions>\n <div class=\"actions\">\n <ng-container *ngIf=\"methods$ | async\">\n <button mat-button type=\"submit\" color=\"primary\">Next</button>\n </ng-container>\n <button mat-button type=\"button\" [mat-dialog-close]=\"null\">Cancel</button>\n </div>\n </mat-dialog-actions>\n </form>\n</fs-dialog>\n","import {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n Input,\n Output,\n ViewChild,\n} from '@angular/core';\nimport { ControlContainer, NgForm } from '@angular/forms';\nimport { MatInput } from '@angular/material/input';\nimport { CodeInputComponent } from 'angular-code-input';\nimport { FsVerificationMethodType } from '../../enums/verification-method-type.enum';\n\nimport { IFsVerificationMethod } from '../../interfaces/verification-method.interface';\n\n\n@Component({\n selector: 'fs-2fa-verification-code',\n templateUrl: './2fa-verification-code.component.html',\n styleUrls: [\n './2fa-verification-code.component.scss',\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n viewProviders: [\n {\n provide: ControlContainer,\n useExisting: NgForm,\n },\n ],\n})\nexport class Fs2FAVerificationCodeComponent {\n\n @ViewChild(CodeInputComponent)\n public codeInputComponent: CodeInputComponent;\n\n @Input()\n public method: IFsVerificationMethod;\n\n @Input()\n public code;\n\n @Output()\n public codeChange = new EventEmitter<string>();\n\n @Output()\n public codeComplete = new EventEmitter<void>();\n\n public FsVerificationMethodType = FsVerificationMethodType;\n\n public codeChanged(code): void {\n this.code = code;\n this.codeChange.emit(this.code);\n }\n\n public codeCompleted(): void {\n this.codeComplete.emit();\n }\n\n public focus(): void {\n this.codeInputComponent.focusOnField(0);\n }\n\n}\n","<ng-container *ngIf=\"method.phoneNumber && method.type === FsVerificationMethodType.Sms\">\n <p class=\"description\">\n A text message with a verification code was just\n sent to <span style=\"white-space: nowrap;\">{{ method.phoneNumber }}</span> to verify it's you.\n </p>\n\n <ng-container *ngTemplateOutlet=\"input\"></ng-container>\n</ng-container>\n\n<ng-container *ngIf=\"method.type === FsVerificationMethodType.Email\">\n <p class=\"description\">\n A email with a verification code was just sent to {{ method.email }} to verify it's you.\n </p>\n <ng-container *ngTemplateOutlet=\"input\"></ng-container>\n</ng-container>\n\n<ng-container *ngIf=\"method.type === FsVerificationMethodType.App\">\n <p class=\"description\">\n Enter the verification code generated by your 2 factor authenticator app to verify it's you.\n </p>\n <ng-container *ngTemplateOutlet=\"input\"></ng-container>\n</ng-container>\n\n\n<ng-template #input> \n <code-input \n [code]=\"code\"\n [initialFocusField]=\"0\"\n [codeLength]=\"6\"\n (codeChanged)=\"codeChanged($event)\"\n (codeCompleted)=\"codeCompleted()\">\n </code-input> \n</ng-template> ","import {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n EventEmitter,\n Inject,\n Input,\n OnDestroy,\n OnInit,\n Optional,\n Output,\n ViewChild,\n} from '@angular/core';\n\nimport { FsDialog } from '@firestitch/dialog';\n\nimport { filter, takeUntil, tap } from 'rxjs/operators';\n\nimport { IFsVerificationMethod } from '../../interfaces/verification-method.interface';\nimport { Fs2FaVerificationMethodsComponent } from '../2fa-verification-methods/2fa-verification-methods.component';\nimport { Subject } from 'rxjs';\nimport { FS_2FA_VERIFICATION_PROVIDER } from '../../tokens/verification.token';\nimport { IFsVerificationProvider } from '../../interfaces/verification-provider.interface';\nimport { FsVerificationMethodType } from '../../enums/verification-method-type.enum';\nimport { Fs2FAVerificationCodeComponent } from '../2fa-verification-code/2fa-verification-code.component';\nimport { NgControl, NgForm } from '@angular/forms';\n\n\n@Component({\n selector: 'fs-2fa-verification',\n templateUrl: './2fa-verification.component.html',\n styleUrls: [\n './2fa-verification.component.scss',\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class Fs2FAVerificationComponent implements OnDestroy, AfterViewInit {\n\n @ViewChild(Fs2FAVerificationCodeComponent)\n public verificationCodeComponent: Fs2FAVerificationCodeComponent;\n\n @Input()\n public method: IFsVerificationMethod;\n\n @Output()\n public verified = new EventEmitter<unknown>();\n\n public resendInProgress = false;\n public code = '';\n public trustedDevice = true;\n public FsVerificationMethodType = FsVerificationMethodType;\n\n private _destroy$ = new Subject<void>();\n\n constructor(\n @Inject(FS_2FA_VERIFICATION_PROVIDER)\n public verificationProvider: IFsVerificationProvider,\n private _cdRef: ChangeDetectorRef,\n private _dialog: FsDialog,\n @Optional() private _form: NgForm,\n ) {\n }\n\n public ngOnDestroy(): void {\n this._destroy$.next();\n this._destroy$.complete();\n }\n\n public verify = () => {\n return this.verificationProvider\n .verify(this.code, this.trustedDevice)\n .pipe(\n tap((response) => {\n this.verified.emit(response);\n }),\n );\n };\n\n public ngAfterViewInit(): void {\n this.verificationCodeComponent.focus(); \n }\n\n public codeChange(code: string): void {\n this.code = code;\n }\n\n public codeComplete(): void {\n if(this._form) {\n this._form.ngSubmit.next();\n }\n }\n\n public resend(): void {\n this.resendInProgress = true;\n this.code = '';\n \n this.verificationProvider\n .resend()\n .pipe(\n takeUntil(this._destroy$),\n )\n .subscribe(() => {\n this.resendInProgress = false; \n this._cdRef.markForCheck();\n })\n }\n\n public showVerificationMethods(): void {\n this._dialog.open(\n Fs2FaVerificationMethodsComponent,\n {\n data: {\n method: this.method,\n }\n }\n )\n .afterClosed()\n .pipe(\n filter((method) => !!method),\n )\n .subscribe((method) => {\n this.method = method;\n this.code = '';\n\n this._cdRef.markForCheck();\n\n setTimeout(() => {\n this.verificationCodeComponent.focus();\n });\n });\n }\n\n}\n","<div class=\"code-container\">\n <fs-2fa-verification-code\n [method]=\"method\"\n [code]=\"code\"\n (codeChange)=\"codeChange($event)\"\n (codeComplete)=\"codeComplete()\">\n </fs-2fa-verification-code>\n</div>\n\n<div class=\"additional\">\n <mat-checkbox\n name=\"trust-device\"\n [(ngModel)]=\"trustedDevice\">\n Trust this device\n </mat-checkbox>\n\n <span class=\"resend-code-btn\">\n <ng-container *ngIf=\"!resendInProgress else sending\">\n <a (click)=\"resend()\">\n Resend Code\n </a>\n </ng-container>\n <ng-template #sending>\n <mat-spinner [diameter]=\"12\"></mat-spinner> Sending\n </ng-template>\n </span>\n</div>","import { NgModule } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { CommonModule } from '@angular/common';\n\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatRadioModule } from '@angular/material/radio';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\n\nimport { FsFormModule } from '@firestitch/form';\nimport { FsSkeletonModule } from '@firestitch/skeleton';\nimport { FsRadioGroupModule } from '@firestitch/radiogroup';\nimport { FsDialogModule } from '@firestitch/dialog';\n\nimport { CodeInputModule } from 'angular-code-input';\n\nimport { Fs2FAVerificationComponent } from './components/2fa-verification/2fa-verification.component';\nimport { Fs2FAVerificationCodeComponent } from './components/2fa-verification-code/2fa-verification-code.component';\nimport { Fs2FaVerificationMethodsComponent } from './components/2fa-verification-methods/2fa-verification-methods.component';\n\n\n@NgModule({\n imports: [\n CommonModule,\n FormsModule,\n\n MatFormFieldModule,\n MatInputModule,\n MatButtonModule,\n\n FsFormModule,\n FsRadioGroupModule,\n FsDialogModule,\n\n CodeInputModule,\n MatCheckboxModule,\n MatProgressSpinnerModule,\n FsSkeletonModule,\n FsSkeletonModule,\n MatIconModule,\n MatRadioModule,\n ],\n declarations: [\n Fs2FAVerificationComponent,\n Fs2FAVerificationCodeComponent,\n Fs2FaVerificationMethodsComponent,\n ],\n exports: [\n Fs2FAVerificationComponent,\n ],\n providers: [],\n})\nexport class Fs2FaModule {}\n","/*\n * Public API Surface of fs-2fa\n */\n\nexport { Fs2FaModule } from './app/fs-2fa.module';\n\n// Components\nexport { Fs2FAVerificationComponent } from './app/components/2fa-verification/2fa-verification.component';\n\nexport { IFsVerificationProvider } from './app/interfaces/verification-provider.interface';\nexport { IFsVerificationMethod } from './app/interfaces/verification-method.interface';\n\nexport { FsVerificationMethodType } from './app/enums/verification-method-type.enum';\n\nexport { FS_2FA_VERIFICATION_PROVIDER } from './app/tokens/verification.token';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAIa,4BAA4B,GAAG,IAAI,cAAc,CAC5D,mCAAmC;;ICLzB;AAAZ,WAAY,wBAAwB;IAClC,uCAAW,CAAA;IACX,2CAAe,CAAA;IACf,uCAAW,CAAA;AACb,CAAC,EAJW,wBAAwB,KAAxB,wBAAwB;;MCwBvB,iCAAiC;IAQ5C,YAEU,qBAA8C,EAE9C,WAAgB,EAChB,UAA2D;QAH3D,0BAAqB,GAArB,qBAAqB,CAAyB;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c;QACd,eAAe;QAEf,YAAY;QACZ,kBAAkB;QAClB,cAAc;QAEd,eAAe;QACf,iBAAiB;QACjB,wBAAwB;QACxB,gBAAgB;QAChB,gBAAgB;QAChB,aAAa;QACb,cAAc,aAQd,0BAA0B;0GAIjB,WAAW,aAFX,EAAE,YA5BJ;YACP,YAAY;YACZ,WAAW;YAEX,kBAAkB;YAClB,cAAc;YACd,eAAe;YAEf,YAAY;YACZ,kBAAkB;YAClB,cAAc;YAEd,eAAe;YACf,iBAAiB;YACjB,wBAAwB;YACxB,gBAAgB;YAChB,gBAAgB;YAChB,aAAa;YACb,cAAc;SACf;4FAWU,WAAW;kBA/BvB,QAAQ;mBAAC;oBACR,OAAO,EAAE;wBACP,YAAY;wBACZ,WAAW;wBAEX,kBAAkB;wBAClB,cAAc;wBACd,eAAe;wBAEf,YAAY;wBACZ,kBAAkB;wBAClB,cAAc;wBAEd,eAAe;wBACf,iBAAiB;wBACjB,wBAAwB;wBACxB,gBAAgB;wBAChB,gBAAgB;wBAChB,aAAa;wBACb,cAAc;qBACf;oBACD,YAAY,EAAE;wBACZ,0BAA0B;wBAC1B,8BAA8B;wBAC9B,iCAAiC;qBAClC;oBACD,OAAO,EAAE;wBACP,0BAA0B;qBAC3B;oBACD,SAAS,EAAE,EAAE;iBACd;;;ACtDD;;;;ACAA;;;;;;"}
|
package/firestitch-2fa.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated bundle index. Do not edit.
|
|
3
|
-
*/
|
|
4
|
-
/// <amd-module name="@firestitch/2fa" />
|
|
5
|
-
export * from './public_api';
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
/// <amd-module name="@firestitch/2fa" />
|
|
5
|
+
export * from './public_api';
|
package/package.json
CHANGED
package/public_api.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { Fs2FaModule } from './app/fs-2fa.module';
|
|
2
|
-
export { Fs2FAVerificationComponent } from './app/components/2fa-verification/2fa-verification.component';
|
|
3
|
-
export { IFsVerificationProvider } from './app/interfaces/verification-provider.interface';
|
|
4
|
-
export { IFsVerificationMethod } from './app/interfaces/verification-method.interface';
|
|
5
|
-
export { FsVerificationMethodType } from './app/enums/verification-method-type.enum';
|
|
6
|
-
export { FS_2FA_VERIFICATION_PROVIDER } from './app/tokens/verification.token';
|
|
1
|
+
export { Fs2FaModule } from './app/fs-2fa.module';
|
|
2
|
+
export { Fs2FAVerificationComponent } from './app/components/2fa-verification/2fa-verification.component';
|
|
3
|
+
export { IFsVerificationProvider } from './app/interfaces/verification-provider.interface';
|
|
4
|
+
export { IFsVerificationMethod } from './app/interfaces/verification-method.interface';
|
|
5
|
+
export { FsVerificationMethodType } from './app/enums/verification-method-type.enum';
|
|
6
|
+
export { FS_2FA_VERIFICATION_PROVIDER } from './app/tokens/verification.token';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from '@angular/core';
|
|
2
|
-
import { FsFormDirective } from '@firestitch/form';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export declare class Fs2FAVerificationOTPComponent {
|
|
5
|
-
form: FsFormDirective;
|
|
6
|
-
codeChange: EventEmitter<string>;
|
|
7
|
-
constructor(form: FsFormDirective);
|
|
8
|
-
codeChanged(event: string): void;
|
|
9
|
-
codeCompleted(): void;
|
|
10
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<Fs2FAVerificationOTPComponent, never>;
|
|
11
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<Fs2FAVerificationOTPComponent, "fs-2fa-verification-otp", never, {}, { "codeChange": "codeChange"; }, never, never>;
|
|
12
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component, EventEmitter, Output, } from '@angular/core';
|
|
2
|
-
import { FsFormDirective } from '@firestitch/form';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
import * as i1 from "@firestitch/form";
|
|
5
|
-
export class Fs2FAVerificationOTPComponent {
|
|
6
|
-
constructor(form) {
|
|
7
|
-
this.form = form;
|
|
8
|
-
this.codeChange = new EventEmitter();
|
|
9
|
-
}
|
|
10
|
-
codeChanged(event) {
|
|
11
|
-
this.codeChange.emit(event);
|
|
12
|
-
this.form.dirty();
|
|
13
|
-
}
|
|
14
|
-
codeCompleted() {
|
|
15
|
-
this.form.triggerSubmit();
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
Fs2FAVerificationOTPComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Fs2FAVerificationOTPComponent, deps: [{ token: i1.FsFormDirective }], target: i0.ɵɵFactoryTarget.Component });
|
|
19
|
-
Fs2FAVerificationOTPComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: Fs2FAVerificationOTPComponent, selector: "fs-2fa-verification-otp", outputs: { codeChange: "codeChange" }, ngImport: i0, template: "<p class=\"description\">\n Enter the verification code generated by your 2 factor authenticator\n app to verify it's you\n</p>\n\n<!--\n<code-input [initialFocusField]=\"0\"\n [codeLength]=\"6\"\n (codeChanged)=\"codeChanged($event)\"\n (codeCompleted)=\"codeCompleted()\">>\n</code-input>\n-->\n", styles: [":host{display:block}code-input{--item-spacing: 10px;--item-height: 20px;--item-border: none;--item-border-bottom: 2px solid #949494;--item-border-has-value: none;--item-border-bottom-has-value: 2px solid #949494;--item-border-focused: none;--item-border-bottom-focused: 2px solid #0061AF;--item-shadow-focused: none;--item-border-radius: 0px}code-input ::ng-deep span:first-child{padding-left:0!important}code-input ::ng-deep span:last-child{padding-right:0!important}code-input ::ng-deep input{font-size:20px!important;height:40px!important;padding:0!important}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
20
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Fs2FAVerificationOTPComponent, decorators: [{
|
|
21
|
-
type: Component,
|
|
22
|
-
args: [{
|
|
23
|
-
selector: 'fs-2fa-verification-otp',
|
|
24
|
-
templateUrl: './2fa-verification-otp.component.html',
|
|
25
|
-
styleUrls: [
|
|
26
|
-
'./2fa-verification-otp.component.scss'
|
|
27
|
-
],
|
|
28
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
29
|
-
}]
|
|
30
|
-
}], ctorParameters: function () { return [{ type: i1.FsFormDirective }]; }, propDecorators: { codeChange: [{
|
|
31
|
-
type: Output
|
|
32
|
-
}] } });
|
|
33
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMmZhLXZlcmlmaWNhdGlvbi1vdHAuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vc3JjL2FwcC9jb21wb25lbnRzLzJmYS12ZXJpZmljYXRpb24tb3RwLzJmYS12ZXJpZmljYXRpb24tb3RwLmNvbXBvbmVudC50cyIsIi4uLy4uLy4uLy4uLy4uL3NyYy9hcHAvY29tcG9uZW50cy8yZmEtdmVyaWZpY2F0aW9uLW90cC8yZmEtdmVyaWZpY2F0aW9uLW90cC5jb21wb25lbnQuaHRtbCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQ0wsdUJBQXVCLEVBQ3ZCLFNBQVMsRUFDVCxZQUFZLEVBQ1osTUFBTSxHQUNQLE1BQU0sZUFBZSxDQUFDO0FBRXZCLE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQzs7O0FBV25ELE1BQU0sT0FBTyw2QkFBNkI7SUFLeEMsWUFDUyxJQUFxQjtRQUFyQixTQUFJLEdBQUosSUFBSSxDQUFpQjtRQUh2QixlQUFVLEdBQUcsSUFBSSxZQUFZLEVBQVUsQ0FBQztJQUk1QyxDQUFDO0lBRUcsV0FBVy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