mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 22:33:35 +00:00
Remove EnableNewCardCombinedExpiryAutofill feature flag (#16131)
This commit is contained in:
@@ -14,7 +14,7 @@ import { UserNotificationSettingsServiceAbstraction } from "@bitwarden/common/au
|
|||||||
import { InlineMenuVisibilitySetting } from "@bitwarden/common/autofill/types";
|
import { InlineMenuVisibilitySetting } from "@bitwarden/common/autofill/types";
|
||||||
import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service";
|
import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service";
|
||||||
import { EventType } from "@bitwarden/common/enums";
|
import { EventType } from "@bitwarden/common/enums";
|
||||||
import { FeatureFlag, FeatureFlagValueType } from "@bitwarden/common/enums/feature-flag.enum";
|
import { FeatureFlagValueType } from "@bitwarden/common/enums/feature-flag.enum";
|
||||||
import { UriMatchStrategy } from "@bitwarden/common/models/domain/domain-service";
|
import { UriMatchStrategy } from "@bitwarden/common/models/domain/domain-service";
|
||||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
||||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||||
@@ -2987,12 +2987,6 @@ describe("AutofillService", () => {
|
|||||||
options.cipher.card.expMonth = "5";
|
options.cipher.card.expMonth = "5";
|
||||||
}
|
}
|
||||||
|
|
||||||
const enableNewCardCombinedExpiryAutofill = await configService.getFeatureFlag(
|
|
||||||
FeatureFlag.EnableNewCardCombinedExpiryAutofill,
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(enableNewCardCombinedExpiryAutofill).toEqual(false);
|
|
||||||
|
|
||||||
const value = await autofillService["generateCardFillScript"](
|
const value = await autofillService["generateCardFillScript"](
|
||||||
fillScript,
|
fillScript,
|
||||||
pageDetails,
|
pageDetails,
|
||||||
@@ -3003,23 +2997,6 @@ describe("AutofillService", () => {
|
|||||||
expect(value.script[2]).toStrictEqual(["fill_by_opid", "expirationDate", dateFormat[1]]);
|
expect(value.script[2]).toStrictEqual(["fill_by_opid", "expirationDate", dateFormat[1]]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("returns an expiration date format matching `yyyy-mm` if no valid format can be identified", async () => {
|
|
||||||
const value = await autofillService["generateCardFillScript"](
|
|
||||||
fillScript,
|
|
||||||
pageDetails,
|
|
||||||
filledFields,
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
|
|
||||||
const enableNewCardCombinedExpiryAutofill = await configService.getFeatureFlag(
|
|
||||||
FeatureFlag.EnableNewCardCombinedExpiryAutofill,
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(enableNewCardCombinedExpiryAutofill).toEqual(false);
|
|
||||||
|
|
||||||
expect(value.script[2]).toStrictEqual(["fill_by_opid", "expirationDate", "2024-05"]);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const extraExpectedDateFormats = [
|
const extraExpectedDateFormats = [
|
||||||
@@ -3092,12 +3069,6 @@ describe("AutofillService", () => {
|
|||||||
options.cipher.card.expMonth = "05";
|
options.cipher.card.expMonth = "05";
|
||||||
}
|
}
|
||||||
|
|
||||||
const enableNewCardCombinedExpiryAutofill = await configService.getFeatureFlag(
|
|
||||||
FeatureFlag.EnableNewCardCombinedExpiryAutofill,
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(enableNewCardCombinedExpiryAutofill).toEqual(true);
|
|
||||||
|
|
||||||
const value = await autofillService["generateCardFillScript"](
|
const value = await autofillService["generateCardFillScript"](
|
||||||
fillScript,
|
fillScript,
|
||||||
pageDetails,
|
pageDetails,
|
||||||
@@ -3108,23 +3079,6 @@ describe("AutofillService", () => {
|
|||||||
expect(value.script[2]).toStrictEqual(["fill_by_opid", "expirationDate", dateFormat[1]]);
|
expect(value.script[2]).toStrictEqual(["fill_by_opid", "expirationDate", dateFormat[1]]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("feature-flagged logic returns an expiration date format matching `mm/yy` if no valid format can be identified", async () => {
|
|
||||||
const value = await autofillService["generateCardFillScript"](
|
|
||||||
fillScript,
|
|
||||||
pageDetails,
|
|
||||||
filledFields,
|
|
||||||
options,
|
|
||||||
);
|
|
||||||
|
|
||||||
const enableNewCardCombinedExpiryAutofill = await configService.getFeatureFlag(
|
|
||||||
FeatureFlag.EnableNewCardCombinedExpiryAutofill,
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(enableNewCardCombinedExpiryAutofill).toEqual(true);
|
|
||||||
|
|
||||||
expect(value.script[2]).toStrictEqual(["fill_by_opid", "expirationDate", "05/24"]);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import { InlineMenuVisibilitySetting } from "@bitwarden/common/autofill/types";
|
|||||||
import { normalizeExpiryYearFormat } from "@bitwarden/common/autofill/utils";
|
import { normalizeExpiryYearFormat } from "@bitwarden/common/autofill/utils";
|
||||||
import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service";
|
import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service";
|
||||||
import { EventType } from "@bitwarden/common/enums";
|
import { EventType } from "@bitwarden/common/enums";
|
||||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
|
||||||
import {
|
import {
|
||||||
UriMatchStrategySetting,
|
UriMatchStrategySetting,
|
||||||
UriMatchStrategy,
|
UriMatchStrategy,
|
||||||
@@ -1212,161 +1211,7 @@ export default class AutofillService implements AutofillServiceInterface {
|
|||||||
AutofillService.hasValue(card.expMonth) &&
|
AutofillService.hasValue(card.expMonth) &&
|
||||||
AutofillService.hasValue(card.expYear)
|
AutofillService.hasValue(card.expYear)
|
||||||
) {
|
) {
|
||||||
let combinedExpiryFillValue = null;
|
const combinedExpiryFillValue = this.generateCombinedExpiryValue(card, fillFields.exp);
|
||||||
|
|
||||||
const enableNewCardCombinedExpiryAutofill = await this.configService.getFeatureFlag(
|
|
||||||
FeatureFlag.EnableNewCardCombinedExpiryAutofill,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (enableNewCardCombinedExpiryAutofill) {
|
|
||||||
combinedExpiryFillValue = this.generateCombinedExpiryValue(card, fillFields.exp);
|
|
||||||
} else {
|
|
||||||
const fullMonth = ("0" + card.expMonth).slice(-2);
|
|
||||||
|
|
||||||
let fullYear: string = card.expYear;
|
|
||||||
let partYear: string = null;
|
|
||||||
if (fullYear.length === 2) {
|
|
||||||
partYear = fullYear;
|
|
||||||
fullYear = normalizeExpiryYearFormat(fullYear);
|
|
||||||
} else if (fullYear.length === 4) {
|
|
||||||
partYear = fullYear.substr(2, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < CreditCardAutoFillConstants.MonthAbbr.length; i++) {
|
|
||||||
if (
|
|
||||||
// mm/yyyy
|
|
||||||
this.fieldAttrsContain(
|
|
||||||
fillFields.exp,
|
|
||||||
CreditCardAutoFillConstants.MonthAbbr[i] +
|
|
||||||
"/" +
|
|
||||||
CreditCardAutoFillConstants.YearAbbrLong[i],
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
combinedExpiryFillValue = fullMonth + "/" + fullYear;
|
|
||||||
} else if (
|
|
||||||
// mm/yy
|
|
||||||
this.fieldAttrsContain(
|
|
||||||
fillFields.exp,
|
|
||||||
CreditCardAutoFillConstants.MonthAbbr[i] +
|
|
||||||
"/" +
|
|
||||||
CreditCardAutoFillConstants.YearAbbrShort[i],
|
|
||||||
) &&
|
|
||||||
partYear != null
|
|
||||||
) {
|
|
||||||
combinedExpiryFillValue = fullMonth + "/" + partYear;
|
|
||||||
} else if (
|
|
||||||
// yyyy/mm
|
|
||||||
this.fieldAttrsContain(
|
|
||||||
fillFields.exp,
|
|
||||||
CreditCardAutoFillConstants.YearAbbrLong[i] +
|
|
||||||
"/" +
|
|
||||||
CreditCardAutoFillConstants.MonthAbbr[i],
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
combinedExpiryFillValue = fullYear + "/" + fullMonth;
|
|
||||||
} else if (
|
|
||||||
// yy/mm
|
|
||||||
this.fieldAttrsContain(
|
|
||||||
fillFields.exp,
|
|
||||||
CreditCardAutoFillConstants.YearAbbrShort[i] +
|
|
||||||
"/" +
|
|
||||||
CreditCardAutoFillConstants.MonthAbbr[i],
|
|
||||||
) &&
|
|
||||||
partYear != null
|
|
||||||
) {
|
|
||||||
combinedExpiryFillValue = partYear + "/" + fullMonth;
|
|
||||||
} else if (
|
|
||||||
// mm-yyyy
|
|
||||||
this.fieldAttrsContain(
|
|
||||||
fillFields.exp,
|
|
||||||
CreditCardAutoFillConstants.MonthAbbr[i] +
|
|
||||||
"-" +
|
|
||||||
CreditCardAutoFillConstants.YearAbbrLong[i],
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
combinedExpiryFillValue = fullMonth + "-" + fullYear;
|
|
||||||
} else if (
|
|
||||||
// mm-yy
|
|
||||||
this.fieldAttrsContain(
|
|
||||||
fillFields.exp,
|
|
||||||
CreditCardAutoFillConstants.MonthAbbr[i] +
|
|
||||||
"-" +
|
|
||||||
CreditCardAutoFillConstants.YearAbbrShort[i],
|
|
||||||
) &&
|
|
||||||
partYear != null
|
|
||||||
) {
|
|
||||||
combinedExpiryFillValue = fullMonth + "-" + partYear;
|
|
||||||
} else if (
|
|
||||||
// yyyy-mm
|
|
||||||
this.fieldAttrsContain(
|
|
||||||
fillFields.exp,
|
|
||||||
CreditCardAutoFillConstants.YearAbbrLong[i] +
|
|
||||||
"-" +
|
|
||||||
CreditCardAutoFillConstants.MonthAbbr[i],
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
combinedExpiryFillValue = fullYear + "-" + fullMonth;
|
|
||||||
} else if (
|
|
||||||
// yy-mm
|
|
||||||
this.fieldAttrsContain(
|
|
||||||
fillFields.exp,
|
|
||||||
CreditCardAutoFillConstants.YearAbbrShort[i] +
|
|
||||||
"-" +
|
|
||||||
CreditCardAutoFillConstants.MonthAbbr[i],
|
|
||||||
) &&
|
|
||||||
partYear != null
|
|
||||||
) {
|
|
||||||
combinedExpiryFillValue = partYear + "-" + fullMonth;
|
|
||||||
} else if (
|
|
||||||
// yyyymm
|
|
||||||
this.fieldAttrsContain(
|
|
||||||
fillFields.exp,
|
|
||||||
CreditCardAutoFillConstants.YearAbbrLong[i] +
|
|
||||||
CreditCardAutoFillConstants.MonthAbbr[i],
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
combinedExpiryFillValue = fullYear + fullMonth;
|
|
||||||
} else if (
|
|
||||||
// yymm
|
|
||||||
this.fieldAttrsContain(
|
|
||||||
fillFields.exp,
|
|
||||||
CreditCardAutoFillConstants.YearAbbrShort[i] +
|
|
||||||
CreditCardAutoFillConstants.MonthAbbr[i],
|
|
||||||
) &&
|
|
||||||
partYear != null
|
|
||||||
) {
|
|
||||||
combinedExpiryFillValue = partYear + fullMonth;
|
|
||||||
} else if (
|
|
||||||
// mmyyyy
|
|
||||||
this.fieldAttrsContain(
|
|
||||||
fillFields.exp,
|
|
||||||
CreditCardAutoFillConstants.MonthAbbr[i] +
|
|
||||||
CreditCardAutoFillConstants.YearAbbrLong[i],
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
combinedExpiryFillValue = fullMonth + fullYear;
|
|
||||||
} else if (
|
|
||||||
// mmyy
|
|
||||||
this.fieldAttrsContain(
|
|
||||||
fillFields.exp,
|
|
||||||
CreditCardAutoFillConstants.MonthAbbr[i] +
|
|
||||||
CreditCardAutoFillConstants.YearAbbrShort[i],
|
|
||||||
) &&
|
|
||||||
partYear != null
|
|
||||||
) {
|
|
||||||
combinedExpiryFillValue = fullMonth + partYear;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (combinedExpiryFillValue != null) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If none of the previous cases applied, set as default
|
|
||||||
if (combinedExpiryFillValue == null) {
|
|
||||||
combinedExpiryFillValue = fullYear + "-" + fullMonth;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.makeScriptActionWithValue(
|
this.makeScriptActionWithValue(
|
||||||
fillScript,
|
fillScript,
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ export enum FeatureFlag {
|
|||||||
PM14938_BrowserExtensionLoginApproval = "pm-14938-browser-extension-login-approvals",
|
PM14938_BrowserExtensionLoginApproval = "pm-14938-browser-extension-login-approvals",
|
||||||
|
|
||||||
/* Autofill */
|
/* Autofill */
|
||||||
EnableNewCardCombinedExpiryAutofill = "enable-new-card-combined-expiry-autofill",
|
|
||||||
NotificationRefresh = "notification-refresh",
|
NotificationRefresh = "notification-refresh",
|
||||||
UseTreeWalkerApiForPageDetailsCollection = "use-tree-walker-api-for-page-details-collection",
|
UseTreeWalkerApiForPageDetailsCollection = "use-tree-walker-api-for-page-details-collection",
|
||||||
MacOsNativeCredentialSync = "macos-native-credential-sync",
|
MacOsNativeCredentialSync = "macos-native-credential-sync",
|
||||||
@@ -74,7 +73,6 @@ export const DefaultFeatureFlagValue = {
|
|||||||
[FeatureFlag.CreateDefaultLocation]: FALSE,
|
[FeatureFlag.CreateDefaultLocation]: FALSE,
|
||||||
|
|
||||||
/* Autofill */
|
/* Autofill */
|
||||||
[FeatureFlag.EnableNewCardCombinedExpiryAutofill]: FALSE,
|
|
||||||
[FeatureFlag.NotificationRefresh]: FALSE,
|
[FeatureFlag.NotificationRefresh]: FALSE,
|
||||||
[FeatureFlag.UseTreeWalkerApiForPageDetailsCollection]: FALSE,
|
[FeatureFlag.UseTreeWalkerApiForPageDetailsCollection]: FALSE,
|
||||||
[FeatureFlag.MacOsNativeCredentialSync]: FALSE,
|
[FeatureFlag.MacOsNativeCredentialSync]: FALSE,
|
||||||
|
|||||||
Reference in New Issue
Block a user