@checkstack/notification-frontend 0.2.22 → 0.2.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # @checkstack/notification-frontend
2
2
 
3
+ ## 0.2.23
4
+
5
+ ### Patch Changes
6
+
7
+ - d1a2796: Enforce stricter code quality standards and eliminate AI slop anti-patterns.
8
+
9
+ **New utility**
10
+
11
+ - `extractErrorMessage(error, fallback?)` in `@checkstack/common` for consistent error extraction
12
+
13
+ **ESLint rules**
14
+
15
+ - `react-hooks/rules-of-hooks` and `exhaustive-deps` for hook correctness
16
+ - `no-console` in frontend packages — forces `toast` over silent `console.error`
17
+ - `no-restricted-syntax` banning `instanceof Error` — forces `extractErrorMessage`
18
+ - Custom `no-eslint-disable-any` rule preventing `@typescript-eslint/no-explicit-any` circumvention
19
+
20
+ **Refactoring**
21
+
22
+ - Replace 141 `instanceof Error` boilerplate patterns across the codebase
23
+ - Replace swallowed `console.error` with user-visible `toast.error()` feedback
24
+ - Remove 15 redundant `as` type casts in IntegrationsPage and ProviderConnectionsPage
25
+ - Consolidate 3 identical callback handlers into `handleDialogClose`
26
+ - Fix conditional React hook call in `FormField.tsx`
27
+ - Fix unstable useMemo deps in `Dashboard.tsx`
28
+ - Replace `useEffect`→`setState` with derived `useMemo` in `RegisterPage.tsx`
29
+ - Rewrite `keystore.test.ts` with typed `DrizzleMockChain` (eliminating 7 `any` suppressions)
30
+ - Delete obvious comments in `encryption.ts` and Teams `provider.ts`
31
+
32
+ - Updated dependencies [d1a2796]
33
+ - @checkstack/common@0.6.5
34
+ - @checkstack/ui@1.2.1
35
+ - @checkstack/auth-frontend@0.5.18
36
+ - @checkstack/frontend-api@0.3.9
37
+ - @checkstack/notification-common@0.2.8
38
+ - @checkstack/signal-frontend@0.0.15
39
+
3
40
  ## 0.2.22
4
41
 
5
42
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/notification-frontend",
3
- "version": "0.2.22",
3
+ "version": "0.2.23",
4
4
  "type": "module",
5
5
  "main": "src/index.tsx",
6
6
  "checkstack": {
@@ -14,10 +14,10 @@
14
14
  "dependencies": {
15
15
  "@checkstack/notification-common": "0.2.7",
16
16
  "@checkstack/frontend-api": "0.3.8",
17
- "@checkstack/auth-frontend": "0.5.13",
17
+ "@checkstack/auth-frontend": "0.5.17",
18
18
  "@checkstack/signal-frontend": "0.0.14",
19
19
  "@checkstack/common": "0.6.4",
20
- "@checkstack/ui": "1.1.3",
20
+ "@checkstack/ui": "1.2.0",
21
21
  "react": "^18.2.0",
22
22
  "react-router-dom": "^6.22.0",
23
23
  "lucide-react": "^0.344.0"
@@ -25,7 +25,7 @@
25
25
  "devDependencies": {
26
26
  "typescript": "^5.0.0",
27
27
  "@types/react": "^18.2.0",
28
- "@checkstack/tsconfig": "0.0.4",
28
+ "@checkstack/tsconfig": "0.0.5",
29
29
  "@checkstack/scripts": "0.1.2"
30
30
  }
31
31
  }
@@ -10,6 +10,7 @@ import {
10
10
  DropdownMenuSeparator,
11
11
  Button,
12
12
  stripMarkdown,
13
+ useToast,
13
14
  } from "@checkstack/ui";
14
15
  import { useApi, usePluginClient } from "@checkstack/frontend-api";
15
16
  import { useSignal } from "@checkstack/signal-frontend";
@@ -28,6 +29,7 @@ export const NotificationBell = () => {
28
29
  const authApi = useApi(authApiRef);
29
30
  const { data: session, isPending: isAuthLoading } = authApi.useSession();
30
31
  const notificationClient = usePluginClient(NotificationApi);
32
+ const toast = useToast();
31
33
 
32
34
  const [isOpen, setIsOpen] = useState(false);
33
35
 
@@ -130,8 +132,8 @@ export const NotificationBell = () => {
130
132
  await markAsReadMutation.mutateAsync({});
131
133
  setSignalUnreadCount(0);
132
134
  setSignalNotifications([]);
133
- } catch (error) {
134
- console.error("Failed to mark all as read:", error);
135
+ } catch {
136
+ toast.error("Failed to mark all as read");
135
137
  }
136
138
  };
137
139
 
@@ -26,6 +26,7 @@ import {
26
26
  UserChannelCard,
27
27
  type UserDeliveryChannel,
28
28
  } from "../components/UserChannelCard";
29
+ import { extractErrorMessage } from "@checkstack/common";
29
30
 
30
31
  export const NotificationSettingsPage = () => {
31
32
  const notificationClient = usePluginClient(NotificationApi);
@@ -97,7 +98,7 @@ export const NotificationSettingsPage = () => {
97
98
  },
98
99
  onError: (error) => {
99
100
  toast.error(
100
- error instanceof Error ? error.message : "Failed to save settings",
101
+ extractErrorMessage(error, "Failed to save settings"),
101
102
  );
102
103
  },
103
104
  });
@@ -109,7 +110,7 @@ export const NotificationSettingsPage = () => {
109
110
  },
110
111
  onError: (error) => {
111
112
  toast.error(
112
- error instanceof Error ? error.message : "Failed to unsubscribe",
113
+ extractErrorMessage(error, "Failed to unsubscribe"),
113
114
  );
114
115
  },
115
116
  });
@@ -123,7 +124,7 @@ export const NotificationSettingsPage = () => {
123
124
  },
124
125
  onError: (error) => {
125
126
  toast.error(
126
- error instanceof Error ? error.message : "Failed to update channel",
127
+ extractErrorMessage(error, "Failed to update channel"),
127
128
  );
128
129
  setStrategySaving(undefined);
129
130
  },
@@ -138,9 +139,7 @@ export const NotificationSettingsPage = () => {
138
139
  },
139
140
  onError: (error) => {
140
141
  toast.error(
141
- error instanceof Error
142
- ? error.message
143
- : "Failed to update preference",
142
+ extractErrorMessage(error, "Failed to update preference"),
144
143
  );
145
144
  setChannelSaving(undefined);
146
145
  },
@@ -155,7 +154,7 @@ export const NotificationSettingsPage = () => {
155
154
  },
156
155
  onError: (error) => {
157
156
  toast.error(
158
- error instanceof Error ? error.message : "Failed to disconnect",
157
+ extractErrorMessage(error, "Failed to disconnect"),
159
158
  );
160
159
  setChannelSaving(undefined);
161
160
  },
@@ -168,7 +167,7 @@ export const NotificationSettingsPage = () => {
168
167
  },
169
168
  onError: (error) => {
170
169
  toast.error(
171
- error instanceof Error ? error.message : "Failed to start OAuth flow",
170
+ extractErrorMessage(error, "Failed to start OAuth flow"),
172
171
  );
173
172
  setChannelConnecting(undefined);
174
173
  },
@@ -16,6 +16,7 @@ import {
16
16
  import { usePluginClient } from "@checkstack/frontend-api";
17
17
  import type { Notification } from "@checkstack/notification-common";
18
18
  import { NotificationApi } from "@checkstack/notification-common";
19
+ import { extractErrorMessage } from "@checkstack/common";
19
20
 
20
21
  export const NotificationsPage = () => {
21
22
  const notificationClient = usePluginClient(NotificationApi);
@@ -48,7 +49,7 @@ export const NotificationsPage = () => {
48
49
  },
49
50
  onError: (error) => {
50
51
  toast.error(
51
- error instanceof Error ? error.message : "Failed to mark as read",
52
+ extractErrorMessage(error, "Failed to mark as read"),
52
53
  );
53
54
  },
54
55
  });
@@ -61,9 +62,7 @@ export const NotificationsPage = () => {
61
62
  },
62
63
  onError: (error) => {
63
64
  toast.error(
64
- error instanceof Error
65
- ? error.message
66
- : "Failed to delete notification",
65
+ extractErrorMessage(error, "Failed to delete notification"),
67
66
  );
68
67
  },
69
68
  });
@@ -76,7 +75,7 @@ export const NotificationsPage = () => {
76
75
  },
77
76
  onError: (error) => {
78
77
  toast.error(
79
- error instanceof Error ? error.message : "Failed to mark all as read",
78
+ extractErrorMessage(error, "Failed to mark all as read"),
80
79
  );
81
80
  },
82
81
  });