1 import { createAction } from '@reduxjs/toolkit';
3 import { type GeneratePasswordConfig } from '@proton/pass/lib/password/generator';
4 import { withCache } from '@proton/pass/store/actions/enhancers/cache';
5 import { withSettings } from '@proton/pass/store/actions/enhancers/settings';
6 import type { PasswordHistoryEntry } from '@proton/pass/store/reducers';
7 import { pipe } from '@proton/pass/utils/fp/pipe';
9 export const passwordSave = createAction('password::save', (payload: PasswordHistoryEntry) => withCache({ payload }));
10 export const passwordDelete = createAction('password::delete', (payload: { id: string }) => withCache({ payload }));
11 export const passwordHistoryClear = createAction('password::history::clear', () => withCache({ payload: {} }));
12 export const passwordHistoryGarbageCollect = createAction('password::history::gc');
14 export const passwordOptionsEdit = createAction('password::options::edit', (payload: GeneratePasswordConfig) =>
15 pipe(withCache, withSettings)({ payload })