1 import { c } from 'ttag';
3 import { useNotifications } from '@proton/components';
4 import { usePassCore } from '@proton/pass/components/Core/PassCoreProvider';
5 import { logger } from '@proton/pass/utils/logger';
7 export const useCopyToClipboard = () => {
8 const { createNotification } = useNotifications();
9 const { writeToClipboard } = usePassCore();
11 return async (value: string) => {
13 await writeToClipboard(value);
14 createNotification({ type: 'success', text: c('Info').t`Copied to clipboard`, showCloseButton: false });
16 createNotification({ type: 'error', text: c('Info').t`Unable to copy to clipboard` });
17 logger.error(`[Popup] unable to copy to clipboard`);