feat(sentry): make consent banner non-dismissable
This commit is contained in:
1 parent
9e9218bb00
commit
f624c8d36b
2 files changed
+2
-28
No files matched your search
@@ -52,7 +52,7 @@ describe('TelemetryConsentBanner', () => {
|
||||
render(<TelemetryConsentBanner />);
|
||||
expect(screen.getByRole('button', { name: /enable/i })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: /no thanks/i })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: /dismiss/i })).toBeInTheDocument();
|
||||
expect(screen.queryByRole('button', { name: /dismiss/i })).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('includes a link to the privacy policy', () => {
|
||||
@@ -77,22 +77,6 @@ describe('TelemetryConsentBanner', () => {
|
||||
expect(window.location.reload).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
// ── dismiss (✕) action ────────────────────────────────────────────────────
|
||||
|
||||
it('dismiss button (✕) saves opted-out preference to localStorage', () => {
|
||||
vi.stubEnv('VITE_SENTRY_DSN', TEST_DSN);
|
||||
render(<TelemetryConsentBanner />);
|
||||
fireEvent.click(screen.getByRole('button', { name: /dismiss/i }));
|
||||
expect(localStorage.getItem(SENTRY_KEY)).toBe('false');
|
||||
});
|
||||
|
||||
it('dismiss button does not reload the page', () => {
|
||||
vi.stubEnv('VITE_SENTRY_DSN', TEST_DSN);
|
||||
render(<TelemetryConsentBanner />);
|
||||
fireEvent.click(screen.getByRole('button', { name: /dismiss/i }));
|
||||
expect(window.location.reload).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
// ── "No thanks" action ────────────────────────────────────────────────────
|
||||
|
||||
it('"No thanks" saves opted-out preference to localStorage', () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { Box, Button, Icon, IconButton, Icons, Text } from 'folds';
|
||||
import { Box, Button, Icon, Icons, Text } from 'folds';
|
||||
import * as css from './TelemetryConsentBanner.css';
|
||||
|
||||
const SENTRY_KEY = 'sable_sentry_enabled';
|
||||
@@ -56,16 +56,6 @@ export function TelemetryConsentBanner() {
|
||||
</a>
|
||||
</Text>
|
||||
</div>
|
||||
<IconButton
|
||||
size="300"
|
||||
variant="Surface"
|
||||
fill="None"
|
||||
radii="300"
|
||||
onClick={handleDecline}
|
||||
aria-label="Dismiss"
|
||||
>
|
||||
<Icon size="100" src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</div>
|
||||
<Box className={css.Actions}>
|
||||
<Button variant="Secondary" fill="Soft" size="300" radii="300" onClick={handleDecline}>
|
||||
|
||||
Reference in new issue
Block a user