1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

import ts through node_modules alias

This commit is contained in:
Kyle Spearrin
2018-01-09 14:26:20 -05:00
parent e165b5cc70
commit f51bebd99a
49 changed files with 515 additions and 322 deletions

View File

@@ -1,4 +1,7 @@
import { Abstractions, Enums, Services } from '@bitwarden/jslib';
import {
CipherType,
FieldType,
} from 'jslib/enums';
import AutofillField from '../models/domain/autofillField';
import AutofillPageDetails from '../models/domain/autofillPageDetails';
@@ -8,6 +11,13 @@ import CipherService from './cipher.service';
import TokenService from './token.service';
import TotpService from './totp.service';
import { UtilsService } from 'jslib/services';
import {
PlatformUtilsService,
UtilsService as UtilsServiceAbstraction,
} from 'jslib/abstractions';
const CardAttributes: string[] = ['autoCompleteType', 'data-stripe', 'htmlName', 'htmlID', 'label-tag',
'placeholder', 'label-left', 'label-top'];
@@ -90,8 +100,8 @@ var IsoProvinces: { [id: string]: string; } = {
export default class AutofillService {
constructor(public cipherService: CipherService, public tokenService: TokenService,
public totpService: TotpService, public utilsService: Services.UtilsService,
public platformUtilsService: Abstractions.PlatformUtilsService) {
public totpService: TotpService, public utilsService: UtilsServiceAbstraction,
public platformUtilsService: PlatformUtilsService) {
}
getFormsWithPasswordFields(pageDetails: AutofillPageDetails): any[] {
@@ -165,7 +175,7 @@ export default class AutofillService {
fillScript: fillScript,
}, { frameId: pd.frameId });
if (options.cipher.type !== Enums.CipherType.Login || totpPromise ||
if (options.cipher.type !== CipherType.Login || totpPromise ||
(options.fromBackground && this.platformUtilsService.isFirefox()) || options.skipTotp ||
!options.cipher.login.totp || !this.tokenService.getPremium()) {
return;
@@ -179,7 +189,7 @@ export default class AutofillService {
return null;
}).then((code: string) => {
if (code) {
Services.UtilsService.copyToClipboard(code);
UtilsService.copyToClipboard(code);
}
return code;
@@ -267,7 +277,7 @@ export default class AutofillService {
const matchingIndex = this.findMatchingFieldIndex(field, fieldNames);
if (matchingIndex > -1) {
let val = fields[matchingIndex].value;
if (val == null && fields[matchingIndex].type === Enums.FieldType.Boolean) {
if (val == null && fields[matchingIndex].type === FieldType.Boolean) {
val = 'false';
}
@@ -279,13 +289,13 @@ export default class AutofillService {
}
switch (options.cipher.type) {
case Enums.CipherType.Login:
case CipherType.Login:
fillScript = this.generateLoginFillScript(fillScript, pageDetails, filledFields, options);
break;
case Enums.CipherType.Card:
case CipherType.Card:
fillScript = this.generateCardFillScript(fillScript, pageDetails, filledFields, options);
break;
case Enums.CipherType.Identity:
case CipherType.Identity:
fillScript = this.generateIdentityFillScript(fillScript, pageDetails, filledFields, options);
break;
default: