1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-10 05:30:01 +00:00

rename filter to trigger

This commit is contained in:
✨ Audrey ✨
2025-03-17 12:16:59 -04:00
parent 0f7f6eb7aa
commit 9a69d5c54e
3 changed files with 7 additions and 7 deletions

View File

@@ -22,7 +22,7 @@ function achievements(
withLatestFrom(validators$),
// narrow the list of all live monitors to just those that may produce new logs
map(([action, monitors]) => {
const triggered = monitors.filter((m) => m.filter(action));
const triggered = monitors.filter((m) => m.trigger(action));
return [action, triggered] as const;
}),
withLatestFrom(captured$),

View File

@@ -17,7 +17,7 @@ const TotallyAttachedValidator = {
validator: Type.HasTag,
active: "until-earned",
hidden: false,
filter(item) {
trigger(item) {
return item.tags?.includes("with-attachment") ?? false;
},
award(progress) {
@@ -39,7 +39,7 @@ const ItemCreatedTracker = {
validator: Type.Threshold,
active: { metric: ItemCreatedProgress, high: 1 },
hidden: true,
filter(item) {
trigger(item) {
return item.action === "vault-item-added";
},
measure(item, progress) {
@@ -55,7 +55,7 @@ const ItemCreatedValidator = {
validator: Type.Threshold,
active: { metric: ItemCreatedProgress, high: 1 },
hidden: false,
filter(item) {
trigger(item) {
return item.action === "vault-item-added";
},
measure(item, progress) {
@@ -73,7 +73,7 @@ const ThreeItemsCreatedValidator = {
validator: Type.Threshold,
active: { metric: ItemCreatedProgress, low: 2, high: 3 },
hidden: false,
filter(item) {
trigger(item) {
return item.action === "vault-item-added";
},
measure(_item, progress) {
@@ -93,7 +93,7 @@ const FiveItemsCreatedValidator = {
validator: Type.Threshold,
active: { metric: ItemCreatedProgress, low: 4, high: 5 },
hidden: false,
filter(item) {
trigger(item) {
return item.action === "vault-item-added";
},
measure(_item, progress) {

View File

@@ -56,7 +56,7 @@ export type Achievement = {
// consumed by validator
export type AchievementValidator = Achievement & {
// when the watch triggers on incoming user events
filter: (item: UserActionEvent) => boolean;
trigger: (item: UserActionEvent) => boolean;
// observe data from the event stream and produces measurements
measure?: (item: UserActionEvent, metrics: Map<MetricId, number>) => AchievementProgressEvent[];