Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

feat: user-level notification preferences (per-topic email/Slack opt-outs) (#1142)

Naveen Kashyapcee3cd80a9fa
diff --git a/.ai/specs/implemented/2026-07-14-user-notification-preferences.md b/.ai/specs/implemented/2026-07-14-user-notification-preferences.md
new file mode 100644
index 0000000000..2503af7dc3
--- /dev/null
+++ b/.ai/specs/implemented/2026-07-14-user-notification-preferences.md
@@ -0,0 +1,185 @@
+# User-Level Notification Preferences
+
+> Status: implemented
+> Author: naveen (with Claude)
+> Date: 2026-07-14
+> Research: `.ai/research/user-notification-preferences.md` (codebase map), `.ai/research/user-notification-preferences-competitors.md` (industry survey)
+
+## TLDR
+
+Let each user control, per notification **topic** (the 11 persisted `NotificationTopic` buckets) and per outbound **channel** (Email, Slack), whether they receive notification copies on that channel. In-app delivery is never muted. Preferences are stored sparsely in a new `notificationPreference` table (a row exists only for an opt-out; absence = enabled), enforced in one place — the `notify` Inngest function's recipient fan-out — and edited on a new ERP page at `/x/account/notifications`, a route whose path helper and topbar link already exist but were never built. Notification emails gain a "Manage notification settings" footer link to that page.
+
+## Problem Statement
+
+Today notification channel delivery is all-or-nothing at the **company** level: email is gated only by the company's `EMAIL_NOTIFICATIONS` plan feature (`notify.ts:460-466`) and Slack DMs only by the company's Slack integration being active (`notify.ts:578-589`). An individual user who is in a busy notification group (e.g. `supplierQuoteNotificationGroup`) or holds many assignments receives every email and Slack DM with no way to quiet either channel. There is no preference table, no opt-out check anywhere in the pipeline, and the notification bell's "Notification settings" link (`Notifications.tsx:603` → `path.to.notificationSettings`) points at a route that does not exist.
+
+## Proposed Solution
+
+A sparse per-user opt-out table + one enforcement step in the single notification chokepoint + one settings page.
+
+Every optional notification already flows through the `notify` Inngest function (`packages/jobs/src/inngest/functions/notifications/notify.ts`), which resolves recipient userIds and fans out to in-app (always), email, and Slack. After recipient resolution, a new step loads the recipients' `notificationPreference` rows for the notification's topic and removes opted-out users from the email and Slack recipient lists. The in-app insert is untouched. Because enforcement happens before the per-recipient `carbon/send-email` / `carbon/send-slack` events are emitted, the terminal send functions need no changes — and transactional email that calls `carbon/send-email` directly (POs to suppliers, invoices, invites, verification) is structurally unaffected.
+
+### Design Decisions
+
+| Decision | Choice | Rationale |
+|----------|--------|-----------|
+| Granularity | Per **topic** (11 `NotificationTopic` values) × channel | User-resolved. Topics are already persisted on every notification row and computed in `notify.ts`; 30 per-event toggles is a wall of switches. Per-event expansion is additive later (add an `event` column). Matches Linear/ERPNext two-axis convention. |
+| Master toggle | **None** in v1 | User-resolved ("no master"). Just the 11 topic rows × 2 channels. No `'*'` sentinel row, no layered override logic. A "turn all off" affordance can be added later as pure UI (bulk upsert) or as an override row — both additive. |
+| Exemptions / mandatory topics | **All topics mutable** | User-resolved. In-app always delivers, so nothing is silently lost. Security/account email (invites, verification, magic links) already bypasses the notify pipeline via `resend.server.ts` and cannot be muted — the industry "non-suppressible core" exists structurally. |
+| Default state | Opt-out (everything on); rows record opt-outs only | Sparse storage means zero backfill, and notification topics added in future releases default ON for everyone — industry consensus (GitHub/Linear/Slack). |
+| In-app channel | Not user-controllable | Existing design comment (`notifications/src/index.ts:84-85`, `notify.ts:191-192`) and industry consensus: the inbox/bell always receives; preferences govern outbound copies. |
+| Channels covered | `email`, `slack` only | The only outbound channels that exist (`NotificationDestination`). No push channel in Carbon. |
+| Table shape | Surrogate xid `id` PK + `UNIQUE(userId, companyId, channel, topic)` | Follows `userModulePreference` (`20260512174538_menu-customization.sql`) exactly — the canonical per-(user, company) preference table. Composite `("id","companyId")` PK is the convention for *business* entities; user-scoped preference tables follow the `userModulePreference` precedent. |
+| Company-scoped (not user-global) | `companyId` column, per-company preferences | Slack integration, plan gating, and notification rows are all per-company; `user.flags` JSONB is user-global and therefore the wrong home. |
+| RLS | Self-scoped + company-scoped: all four policies require `"userId" = auth.uid()::text` AND membership in the target company (`userToCompany`) | Users manage only their own rows, and only for companies they belong to; no module permission needed. The notify job reads with service role. |
+| Enforcement point | `notify.ts`, immediately after recipient resolution, before email/Slack fan-outs | Single chokepoint covers all ~25 producers (routes, crons, edge function `trigger`). Terminal senders and transactional email untouched. |
+| Explicit `payload.destinations` vs prefs | User preferences always win for email/Slack | The point of the feature; a caller opting a notification *into* a channel does not override a user's opt-out. |
+| Settings surface | ERP only, `/x/account/notifications` | User-resolved. Preferences still govern MES-triggered notifications since enforcement is in the shared job. MES has no account-settings surface today. |
+| Email footer link | Plain "Manage notification settings" link (login required) in `NotificationEmail.tsx` | User-resolved. Recipients are internal users with accounts. One-click signed unsubscribe is a digest/marketing-mail pattern (industry survey takeaway 7) — out of scope. |
+| Slack column visibility | Rendered only when the company's Slack integration is active | No point offering Slack toggles when no DM can be sent; read `companyIntegration` in the loader. |
+| Not an N×M config matrix (lesson check) | Allowed | `.ai/lessons.md` forbids N×M *classification/indirection* config (posting-groups). This is a direct user-preference matrix — the standard notification-settings UX — not indirection to an outcome entity. |
+| Module home | `account` module (`account.models.ts` / `account.service.ts`) | It is a per-user account setting; the route lives under `x+/account+` beside profile/theme. |
+| Topic labels | New `getNotificationTopicLabel(topic)` + ordered `USER_FACING_NOTIFICATION_TOPICS` export in `packages/notifications` | Single source shared by UI (settings rows) and any future consumers. `getNotificationTopicPhrase` is count-based digest copy, not a label. |
+
+## Data Model Changes
+
+One migration (forward-dated — newest timestamp in the repo, per `.ai/lessons.md`), then `pnpm run generate:types`.
+
+```sql
+CREATE TABLE "notificationPreference" (
+ "id" TEXT NOT NULL DEFAULT xid(),
+ "userId" TEXT NOT NULL,
+ "companyId" TEXT NOT NULL,
+ "channel" TEXT NOT NULL,
+ "topic" TEXT NOT NULL,
+ "enabled" BOOLEAN NOT NULL DEFAULT false,
+ "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
+
+ CONSTRAINT "notificationPreference_pkey" PRIMARY KEY ("id"),
+ CONSTRAINT "notificationPreference_userId_fkey" FOREIGN KEY ("userId")
+ REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT "notificationPreference_companyId_fkey" FOREIGN KEY ("companyId")
+ REFERENCES "company"("id") ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT "notificationPreference_channel_check"
+ CHECK ("channel" IN ('email', 'slack')),
+ CONSTRAINT "notificationPreference_unique"
+ UNIQUE ("userId", "companyId", "channel", "topic")
+);
+
+CREATE INDEX "notificationPreference_userId_companyId_idx"
+ ON "notificationPreference" ("userId", "companyId");
+
+ALTER TABLE "notificationPreference" ENABLE ROW LEVEL SECURITY;
+
+-- Every policy scopes by owner AND membership in the target company
+-- (see the migration for the full USING/WITH CHECK bodies):
+-- "userId" = auth.uid()::text
+-- AND "companyId" IN (
+-- SELECT "companyId" FROM "userToCompany" WHERE "userId" = auth.uid()::text
+-- )
+CREATE POLICY "SELECT" ON "notificationPreference" FOR SELECT USING (...);
+CREATE POLICY "INSERT" ON "notificationPreference" FOR INSERT WITH CHECK (...);
+CREATE POLICY "UPDATE" ON "notificationPreference" FOR UPDATE USING (...) WITH CHECK (...);
+CREATE POLICY "DELETE" ON "notificationPreference" FOR DELETE USING (...);
+```
+
+Notes:
+- Semantics: **absence of a row = enabled**. A row with `enabled = false` is an opt-out. (`enabled = true` rows are legal — they result from a user toggling off then back on via upsert — and behave identically to no row.)
+- `topic` is intentionally `TEXT` validated in app code against `NotificationTopic` (matches how `notification.topic` is stored); no enum type, so adding topics needs no migration.
+- No `createdBy`/`customFields`: pure user-owned preference row, following `userModulePreference` which carries neither.
+- xid surrogate PK + UNIQUE follows `userModulePreference`; the composite `("id","companyId")` convention applies to business entities, not user-preference rows (Design Decisions table).
+
+## API / Service Changes
+
+### `packages/notifications/src/index.ts`
+
+- `export const USER_FACING_NOTIFICATION_TOPICS: NotificationTopic[]` — ordered list for the settings page (all 11 topics).
+- `export function getNotificationTopicLabel(topic: NotificationTopic): string` — human labels ("Approvals", "Jobs", "Purchasing", …).
+
+### `packages/jobs/src/inngest/functions/notifications/notify.ts`
+
+New step after recipient resolution (`resolve-recipients`, `:254-273`) and before the email (`:457`) and Slack (`:571`) fan-outs:
+
+```text
+step "filter-recipients-by-preference":
+ prefs = client.from("notificationPreference")
+ .select("userId, channel, enabled")
+ .in("userId", userIds).eq("companyId", companyId).eq("topic", topic)
+ emailRecipients = userIds minus users with (channel='email', enabled=false)
+ slackRecipients = userIds minus users with (channel='slack', enabled=false)
+```
+
+- The email fan-out iterates `emailRecipients`; the Slack fan-out iterates `slackRecipients`; the in-app insert keeps using the full `userIds`.
+- Runs regardless of whether destinations came from `defaultDestinations` or explicit `payload.destinations` (prefs always win).
+- If both filtered lists are empty, the email/Slack fan-outs are skipped entirely (existing empty-list behavior).
+- One indexed query per notification; recipient lists are small (1–20 users).
+
+### `apps/erp/app/modules/account/account.models.ts`
+
+```ts
+export const notificationPreferenceValidator = z.object({
+ topic: z.nativeEnum(NotificationTopic),
+ channel: z.enum(["email", "slack"]),
+ enabled: zfd.checkbox(),
+});
+```
+
+### `apps/erp/app/modules/account/account.service.ts`
+
+- `getNotificationPreferences(client, userId, companyId)` — `client.from("notificationPreference").select("*").eq("userId", userId).eq("companyId", companyId)`; returns `{ data, error }`.
+- `upsertNotificationPreference(client, { userId, companyId, topic, channel, enabled })` — `.upsert(..., { onConflict: "userId,companyId,channel,topic" })` with `updatedAt: now()`; returns `{ data, error }`.
+- Both exported through the module barrel `index.ts`.
+
+## UI Changes
+
+### New route: `apps/erp/app/routes/x+/account+/notifications.tsx`
+
+- **loader**: `requirePermissions(request, {})` (account routes need no module scope — RLS self-scopes the data; `profile.tsx` precedent), then in parallel: `getNotificationPreferences(client, userId, companyId)` and the company's Slack integration active flag (`companyIntegration` where `id = 'slack'`). Also read whether the company plan has `EMAIL_NOTIFICATIONS` to show an informational hint when email notifications are unavailable at the company level.
+- **action**: `assertIsPost` → `validator(notificationPreferenceValidator).validate(formData)` → `upsertNotificationPreference(...)` → `flash` on error. Each switch flip posts one upsert via `fetcher.submit` (same immediate-toggle pattern as the settings-page boolean toggles, e.g. `x+/settings+/sales.tsx`).
+- **UI**: Card titled "Notifications" with a short explanation ("In-app notifications are always delivered. Choose which topics also reach you by email or Slack."). One row per `USER_FACING_NOTIFICATION_TOPICS` entry — label from `getNotificationTopicLabel` — with a `Switch` (`@carbon/react`) per channel. Switch state = no row for (topic, channel) OR `enabled = true`. The Slack column renders only when the Slack integration is active. Optimistic toggle state via the fetcher.
+
+### Navigation
+
+- `apps/erp/app/hooks/useAccountSubmodules.tsx`: add `{ name: "Notifications", to: path.to.notificationSettings }` beside Profile (this also revives the commented-out account sidebar as needed — smallest change that makes both entries reachable).
+- The topbar bell's existing "Notification settings" link (`Notifications.tsx:603`) starts working with no change — `path.to.notificationSettings` already resolves to `/x/account/notifications` (`path.ts:1431`).
+
+### Email footer link
+
+- `packages/documents/src/email/NotificationEmail.tsx`: footer line "Manage notification settings" linking to `{baseUrl}/x/account/notifications`. The base URL comes from the same origin used by `buildNotificationLink` for the email CTA (the existing `/api/link` resolver origin), so no new config.
+
+## Acceptance Criteria
+
+- [ ] A user opens `/x/account/notifications` (via the bell dropdown link or Account nav) and sees 11 topic rows; each has an Email switch, and a Slack switch iff the company's Slack integration is active. All switches default ON for a user with no saved preferences.
+- [ ] Toggling "Purchasing" email OFF, then having another user assign them a purchase order: a `notification` row is created (bell shows it), **no** email is sent to them, and other recipients of the same notification still receive email.
+- [ ] With "Purchasing" Slack OFF and email ON (Slack integration active): the same assignment sends the email but no Slack DM to that user.
+- [ ] Toggling a switch OFF and back ON results in delivery again (upsert flips `enabled`, no duplicate-row error).
+- [ ] Preferences apply to MES-triggered notifications (e.g. a maintenance dispatch created in MES respects a work-center member's Maintenance email opt-out).
+- [ ] Transactional email is unaffected: user invites, email verification, and PO/quote/invoice emails to suppliers/customers send regardless of any preference rows.
+- [ ] A notification email's footer contains a "Manage notification settings" link that opens `/x/account/notifications` after login.
+- [ ] User A cannot read or modify user B's preference rows via the client (RLS: direct Supabase query as A for B's rows returns empty / is rejected).
+- [ ] `pnpm run generate:types` regenerated types; `pnpm exec turbo run typecheck --filter=@carbon/jobs --filter=erp` and `pnpm run lint` pass.
+
+## Risks
+
+| Risk | Severity | Mitigation |
+|------|----------|------------|
+| An approver mutes Approval email and misses a pending PO approval | Low | In-app notification always delivered (bell + unread dot); user-accepted trade-off recorded in Open Questions. Revisit with per-topic "required" flags if it bites. |
+| Preference query adds latency/failure surface to every notification | Low | One indexed query on `(userId, companyId)` per notify run; wrapped in its own Inngest step so it retries independently. On persistent query failure the step fails the run (no silent fail-open/fail-closed drift). |
+| Slack column hidden while integration inactive → user can't pre-mute Slack | Low | When the integration is later activated, defaults are ON — same as today's behavior; user can then mute. Acceptable. |
+| Migration timestamp ordering breaks remote deploy | Med | Generate via `pnpm db:migrate:new` at implementation time so the timestamp is newest on `main` (`.ai/lessons.md`). |
+| New topics added to `NotificationTopic` don't appear on the settings page | Low | `USER_FACING_NOTIFICATION_TOPICS` lives in `packages/notifications` next to the enum; adding a topic without updating the list is caught by an exhaustiveness check in `getNotificationTopicLabel`. |
+
+## Open Questions
+
+> All resolved with the user on 2026-07-14 before this spec was written (spec-writing Step 5).
+
+- [x] Master-toggle semantics — should a per-channel master switch override or bulk-edit topic toggles? — **Answer: no master toggle at all in v1.** Per-topic switches only; a bulk affordance can be layered on later. (User answer "no master"; simplifies schema — no `'*'` sentinel.)
+- [x] Should any topics be exempt from opt-out (e.g. Approvals)? — **Answer: all topics mutable.** In-app always delivers; security/account email already bypasses the pipeline structurally.
+- [x] Granularity: topic (11) vs event (30) vs channel-only? — **Answer: per topic.** Matches persisted `notification.topic` and industry two-axis convention; per-event is additive later.
+- [x] Email footer link: plain settings link vs signed one-click mute? — **Answer: plain settings link** to `/x/account/notifications` (login required). One-click unsubscribe is a digest/marketing pattern; out of scope.
+- [x] Settings surface: ERP only or also MES? — **Answer: ERP only.** Enforcement in the shared notify job covers MES-triggered notifications.
+
+## Changelog
+
+- 2026-07-14: Created after resolving all 5 open questions with the user (grill interview). Research: codebase map + competitor survey linked in header.
+- 2026-07-21: Implemented on branch `naveen/user-notification-settings`; moved to `implemented/`. Follow-up deferred: digest-shaped emails (weekly reminder template) do not yet carry the manage-settings footer link.
diff --git a/apps/erp/app/components/Layout/Topbar/Notifications.tsx b/apps/erp/app/components/Layout/Topbar/Notifications.tsx
index 3e48d434f1..8bde32db55 100644
--- a/apps/erp/app/components/Layout/Topbar/Notifications.tsx
+++ b/apps/erp/app/components/Layout/Topbar/Notifications.tsx
@@ -34,6 +34,7 @@ import {
LuLoader,
LuMailCheck,
LuMessageSquare,
+ LuPackageSearch,
LuShieldAlert,
LuShieldX,
LuShoppingCart,
@@ -301,6 +302,14 @@ function GenericNotification({
{...props}
/>
);
+ case NotificationEvent.PurchasingRfqAssignment:
+ return (
+ <Notification
+ icon={<LuPackageSearch />}
+ to={path.to.purchasingRfq(id)}
+ {...props}
+ />
+ );
case NotificationEvent.PurchaseOrderAssignment:
return (
<Notification
diff --git a/apps/erp/app/components/Layout/Topbar/Search.tsx b/apps/erp/app/components/Layout/Topbar/Search.tsx
index a3827a386f..5d1daedc96 100644
--- a/apps/erp/app/components/Layout/Topbar/Search.tsx
+++ b/apps/erp/app/components/Layout/Topbar/Search.tsx
@@ -507,12 +507,12 @@ function useGroupedSubmodules() {
production,
resources,
settings,
- users
+ users,
+ "my account": account
};
const ungroupedSubmodules: Record<string, { links: Route[] }> = {
- documents,
- "my account": account
+ documents
};
const shortcuts = modules.reduce<
@@ -533,10 +533,7 @@ function useGroupedSubmodules() {
iconElement: route.icon
}))
};
- } else if (
- moduleName in ungroupedSubmodules ||
- moduleName === "my account"
- ) {
+ } else if (moduleName in ungroupedSubmodules) {
acc = {
...acc,
[module.name]: ungroupedSubmodules[moduleName].links.map((link) => ({
diff --git a/apps/erp/app/modules/account/account.models.ts b/apps/erp/app/modules/account/account.models.ts
index f25793c3d8..90dfd8f143 100644
--- a/apps/erp/app/modules/account/account.models.ts
+++ b/apps/erp/app/modules/account/account.models.ts
@@ -1,7 +1,14 @@
import { supportedLanguages } from "@carbon/locale";
+import { NotificationTopic } from "@carbon/notifications";
import { z } from "zod";
import { zfd } from "zod-form-data";
+export const notificationPreferenceValidator = z.object({
+ topic: z.nativeEnum(NotificationTopic),
+ channel: z.enum(["email", "slack"]),
+ enabled: z.enum(["true", "false"])
+});
+
export const onboardingUserValidator = z.object({
firstName: z.string().min(1, { message: "First name is required" }),
lastName: z.string().min(1, { message: "Last name is required" }),
diff --git a/apps/erp/app/modules/account/account.service.ts b/apps/erp/app/modules/account/account.service.ts
index 338d0a0251..d36fcacd50 100644
--- a/apps/erp/app/modules/account/account.service.ts
+++ b/apps/erp/app/modules/account/account.service.ts
@@ -2,6 +2,37 @@ import type { Database } from "@carbon/database";
import type { SupabaseClient } from "@supabase/supabase-js";
import { sanitize } from "~/utils/supabase";
+export async function getNotificationPreferences(
+ client: SupabaseClient<Database>,
+ userId: string,
+ companyId: string
+) {
+ return client
+ .from("notificationPreference")
+ .select("topic, channel, enabled")
+ .eq("userId", userId)
+ .eq("companyId", companyId);
+}
+
+export async function upsertNotificationPreference(
+ client: SupabaseClient<Database>,
+ preference: {
+ userId: string;
+ companyId: string;
+ topic: string;
+ channel: "email" | "slack";
+ enabled: boolean;
+ }
+) {
+ return client.from("notificationPreference").upsert(
+ {
+ ...preference,
+ updatedAt: new Date().toISOString()
+ },
+ { onConflict: "userId,companyId,channel,topic" }
+ );
+}
+
export async function deleteUserAttributeValue(
client: SupabaseClient<Database>,
args: {
diff --git a/apps/erp/app/modules/account/ui/useAccountSubmodules.tsx b/apps/erp/app/modules/account/ui/useAccountSubmodules.tsx
index c2c64c1c33..007e2295fc 100644
--- a/apps/erp/app/modules/account/ui/useAccountSubmodules.tsx
+++ b/apps/erp/app/modules/account/ui/useAccountSubmodules.tsx
@@ -1,16 +1,27 @@
import { useLingui } from "@lingui/react/macro";
import { CgProfile } from "react-icons/cg";
-import type { Route } from "~/types";
+import { LuBell } from "react-icons/lu";
+import type { RouteGroup } from "~/types";
import { path } from "~/utils/path";
export default function useAccountSubmodules() {
const { t } = useLingui();
- const accountRoutes: Route[] = [
+ const accountGroups: RouteGroup[] = [
{
- name: t`Profile`,
- to: path.to.profile,
- icon: <CgProfile />
+ name: t`Account`,
+ routes: [
+ {
+ name: t`Profile`,
+ to: path.to.profile,
+ icon: <CgProfile />
+ },
+ {
+ name: t`Notifications`,
+ to: path.to.notificationSettings,
+ icon: <LuBell />
+ }
+ ]
}
];
- return { links: accountRoutes };
+ return { groups: accountGroups };
}
diff --git a/apps/erp/app/routes/api+/assign.ts b/apps/erp/app/routes/api+/assign.ts
index 5bee07b520..81b17c08b9 100644
--- a/apps/erp/app/routes/api+/assign.ts
+++ b/apps/erp/app/routes/api+/assign.ts
@@ -86,6 +86,8 @@ export async function action({ request }: ActionFunctionArgs) {
function getNotificationEvent(table: string): NotificationEvent | null {
switch (table) {
+ case "purchasingRfq":
+ return NotificationEvent.PurchasingRfqAssignment;
case "salesRfq":
return NotificationEvent.SalesRfqAssignment;
case "quote":
diff --git a/apps/erp/app/routes/api+/link.ts b/apps/erp/app/routes/api+/link.ts
index 1270aa49ff..f40b0df9ed 100644
--- a/apps/erp/app/routes/api+/link.ts
+++ b/apps/erp/app/routes/api+/link.ts
@@ -53,6 +53,8 @@ function resolve(
return path.to.supplierQuote(documentId);
case NotificationEvent.SalesOrderAssignment:
return path.to.salesOrder(documentId);
+ case NotificationEvent.PurchasingRfqAssignment:
+ return path.to.purchasingRfq(documentId);
case NotificationEvent.SalesRfqAssignment:
case NotificationEvent.SalesRfqReady:
return path.to.salesRfq(documentId);
@@ -105,16 +107,22 @@ export async function loader({ request }: LoaderFunctionArgs) {
const documentType = url.searchParams.get(
"documentType"
) as ApprovalDocumentType | null;
+ const page = url.searchParams.get("page");
const companyId = url.searchParams.get("companyId");
- if (!event || !documentId) {
- throw redirect(path.to.authenticatedRoot);
+ let redirectTo: string;
+ if (page === "notification-settings") {
+ // Email footer link — no document, but the company-switch below still applies.
+ redirectTo = path.to.notificationSettings;
+ } else {
+ if (!event || !documentId) {
+ throw redirect(path.to.authenticatedRoot);
+ }
+ const link = resolve(event, documentId, documentType ?? undefined);
+ redirectTo = link ?? path.to.authenticatedRoot;
}
- const link = resolve(event, documentId, documentType ?? undefined);
- const redirectTo = link ?? path.to.authenticatedRoot;
-
// The notification points at a document in a specific company, but the
// recipient may currently be viewing a different one. If the linked company
// is one the user belongs to, switch them into it before redirecting — the
diff --git a/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json b/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json
index 5dd93a33d6..c1c3cfa660 100644
--- a/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json
+++ b/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json
@@ -1,8 +1,64 @@
{
- "generated": "2026-07-22T10:57:38.910Z",
- "totalTools": 1375,
+ "generated": "2026-07-22T14:29:28.322Z",
+ "totalTools": 1377,
"modules": 15,
"tools": [
+ {
+ "name": "account_getNotificationPreferences",
+ "module": "account",
+ "classification": "READ",
+ "description": "get notification preferences",
+ "paramCount": 0,
+ "serviceParams": [
+ "client",
+ "userId",
+ "companyId"
+ ],
+ "injectAuth": [
+ "companyId"
+ ],
+ "schema": {
+ "type": "object",
+ "properties": {}
+ }
+ },
+ {
+ "name": "account_upsertNotificationPreference",
+ "module": "account",
+ "classification": "WRITE",
+ "description": "upsert notification preference",
+ "paramCount": 3,
+ "serviceParams": [
+ "client",
+ "preference"
+ ],
+ "injectAuth": [
+ "companyId"
+ ],
+ "schema": {
+ "type": "object",
+ "properties": {
+ "topic": {
+ "type": "string"
+ },
+ "channel": {
+ "type": "string",
+ "enum": [
+ "email",
+ "slack"
+ ]
+ },
+ "enabled": {
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "topic",
+ "channel",
+ "enabled"
+ ]
+ }
+ },
{
"name": "account_deleteUserAttributeValue",
"module": "account",
diff --git a/apps/erp/app/routes/x+/account+/_layout.tsx b/apps/erp/app/routes/x+/account+/_layout.tsx
index 93b0fc3b49..f3f0b4393b 100644
--- a/apps/erp/app/routes/x+/account+/_layout.tsx
+++ b/apps/erp/app/routes/x+/account+/_layout.tsx
@@ -1,8 +1,10 @@
-import { Heading, VStack } from "@carbon/react";
+import { VStack } from "@carbon/react";
import { msg } from "@lingui/core/macro";
-import { Trans } from "@lingui/react/macro";
import type { MetaFunction } from "react-router";
import { Outlet } from "react-router";
+import { GroupedContentSidebar } from "~/components/Layout";
+import { CollapsibleSidebarProvider } from "~/components/Layout/Navigation";
+import useAccountSubmodules from "~/modules/account/ui/useAccountSubmodules";
import type { Handle } from "~/utils/handle";
import { path } from "~/utils/path";
@@ -17,29 +19,24 @@ export const handle: Handle = {
};
export default function AccountRoute() {
- // const { links } = useAccountSubmodules();
+ const { groups } = useAccountSubmodules();
return (
- <VStack
- className="flex w-full h-full items-center justify-start gap-4 bg-card"
- spacing={0}
- >
- <div className="w-full shrink-0 border-b border-border">
- <div className="mx-auto w-full max-w-[60rem] px-2 py-8">
- <Heading size="h3">
- <Trans>Account Settings</Trans>
- </Heading>
- </div>
- </div>
-
- <div className="mx-auto w-full max-w-[60rem] flex-1 min-h-0 overflow-y-auto px-2">
- <div className="grid w-full grid-cols-1 gap-8">
- {/* <DetailSidebar links={links} /> */}
- <VStack spacing={0} className="h-full w-full">
+ <CollapsibleSidebarProvider>
+ <div className="grid grid-cols-[auto_1fr] w-full h-full bg-card">
+ <GroupedContentSidebar groups={groups} />
+ <VStack
+ spacing={0}
+ className="overflow-y-auto scrollbar-hide h-[calc(100dvh-49px)]"
+ >
+ <VStack
+ spacing={4}
+ className="py-12 px-4 max-w-[60rem] h-full mx-auto"
+ >
<Outlet />
</VStack>
- </div>
+ </VStack>
</div>
- </VStack>
+ </CollapsibleSidebarProvider>
);
}
diff --git a/apps/erp/app/routes/x+/account+/notifications.tsx b/apps/erp/app/routes/x+/account+/notifications.tsx
new file mode 100644
index 0000000000..723e703a54
--- /dev/null
+++ b/apps/erp/app/routes/x+/account+/notifications.tsx
@@ -0,0 +1,235 @@
+import { assertIsPost, error } from "@carbon/auth";
+import { requirePermissions } from "@carbon/auth/auth.server";
+import { getCarbonServiceRole } from "@carbon/auth/client.server";
+import { flash } from "@carbon/auth/session.server";
+import { companyHasPlan } from "@carbon/ee/plan.server";
+import { validationError, validator } from "@carbon/form";
+import {
+ NotificationTopic,
+ USER_FACING_NOTIFICATION_TOPICS
+} from "@carbon/notifications";
+import {
+ Card,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
+ Switch
+} from "@carbon/react";
+import { msg } from "@lingui/core/macro";
+import { Trans, useLingui } from "@lingui/react/macro";
+import type { ActionFunctionArgs, LoaderFunctionArgs } from "react-router";
+import { data, useFetchers, useLoaderData, useSubmit } from "react-router";
+import {
+ getNotificationPreferences,
+ notificationPreferenceValidator,
+ upsertNotificationPreference
+} from "~/modules/account";
+import type { Handle } from "~/utils/handle";
+import { path } from "~/utils/path";
+
+export const handle: Handle = {
+ breadcrumb: msg`Notifications`,
+ to: path.to.notificationSettings
+};
+
+export async function loader({ request }: LoaderFunctionArgs) {
+ const { client, userId, companyId } = await requirePermissions(request, {});
+
+ const [preferences, slackIntegration, emailPlanEnabled] = await Promise.all([
+ getNotificationPreferences(client, userId, companyId),
+ // Service role: companyIntegration SELECT requires settings_view, which
+ // regular employees don't have.
+ getCarbonServiceRole()
+ .from("companyIntegration")
+ .select("active")
+ .eq("companyId", companyId)
+ .eq("id", "slack")
+ .maybeSingle(),
+ companyHasPlan(client, companyId, { feature: "EMAIL_NOTIFICATIONS" })
+ ]);
+
+ return {
+ preferences: preferences.data ?? [],
+ slackActive: slackIntegration.data?.active ?? false,
+ emailPlanEnabled
+ };
+}
+
+export async function action({ request }: ActionFunctionArgs) {
+ assertIsPost(request);
+ const { client, userId, companyId } = await requirePermissions(request, {});
+
+ const validation = await validator(notificationPreferenceValidator).validate(
+ await request.formData()
+ );
+ if (validation.error) {
+ return validationError(validation.error);
+ }
+
+ const { topic, channel, enabled } = validation.data;
+ const upsert = await upsertNotificationPreference(client, {
+ userId,
+ companyId,
+ topic,
+ channel,
+ enabled: enabled === "true"
+ });
+
+ if (upsert.error) {
+ return data(
+ {},
+ await flash(
+ request,
+ error(upsert.error, "Failed to update notification preferences")
+ )
+ );
+ }
+
+ return {};
+}
+
+export default function AccountNotifications() {
+ const { preferences, slackActive, emailPlanEnabled } =
+ useLoaderData<typeof loader>();
+ const submit = useSubmit();
+ const fetchers = useFetchers();
+ const { t } = useLingui();
+
+ // Labels live here rather than @carbon/notifications so Lingui extracts them.
+ const topicLabels: Record<NotificationTopic, string> = {
+ [NotificationTopic.Approval]: t`Approvals`,
+ [NotificationTopic.General]: t`General`,
+ [NotificationTopic.Inventory]: t`Inventory`,
+ [NotificationTopic.Job]: t`Jobs`,
+ [NotificationTopic.Maintenance]: t`Maintenance`,
+ [NotificationTopic.Purchasing]: t`Purchasing`,
+ [NotificationTopic.Quality]: t`Quality`,
+ [NotificationTopic.Quote]: t`Quotes`,
+ [NotificationTopic.Sales]: t`Sales`,
+ [NotificationTopic.Suggestion]: t`Suggestions`,
+ [NotificationTopic.Training]: t`Training`
+ };
+
+ // Absence of a row = enabled; in-flight toggles win over loader data.
+ const isEnabled = (topic: NotificationTopic, channel: "email" | "slack") => {
+ let pending: boolean | undefined;
+ for (const fetcher of fetchers) {
+ if (
+ fetcher.formData?.get("topic") === topic &&
+ fetcher.formData?.get("channel") === channel
+ ) {
+ pending = fetcher.formData.get("enabled") === "true";
+ }
+ }
+ if (pending !== undefined) return pending;
+ const row = preferences.find(
+ (p) => p.topic === topic && p.channel === channel
+ );
+ return row ? row.enabled : true;
+ };
+
+ // A cell with a submission in flight is disabled: overlapping upserts for
+ // the same (topic, channel) would race and last-write-wins in the database.
+ const isPending = (topic: NotificationTopic, channel: "email" | "slack") =>
+ fetchers.some(
+ (fetcher) =>
+ fetcher.state !== "idle" &&
+ fetcher.formData?.get("topic") === topic &&
+ fetcher.formData?.get("channel") === channel
+ );
+
+ const toggle = (
+ topic: NotificationTopic,
+ channel: "email" | "slack",
+ next: boolean
+ ) => {
+ submit(
+ { topic, channel, enabled: String(next) },
+ { method: "post", navigate: false }
+ );
+ };
+
+ return (
+ <Card>
+ <CardHeader>
+ <CardTitle>
+ <Trans>Notifications</Trans>
+ </CardTitle>
+ <CardDescription>
+ {slackActive ? (
+ <Trans>
+ In-app notifications are always delivered. Choose which topics
+ also reach you by email or Slack.
+ </Trans>
+ ) : (
+ <Trans>
+ In-app notifications are always delivered. Choose which topics
+ also reach you by email.
+ </Trans>
+ )}
+ </CardDescription>
+ </CardHeader>
+ <CardContent>
+ {!emailPlanEnabled && (
+ <p className="text-sm text-muted-foreground mb-4">
+ <Trans>
+ Email notifications are not included in your company&apos;s
+ current plan; email preferences will apply if they are enabled.
+ </Trans>
+ </p>
+ )}
+ <table className="w-full">
+ <thead>
+ <tr className="border-b border-border">
+ <th className="text-left text-sm font-medium py-2">
+ <Trans>Topic</Trans>
+ </th>
+ <th className="text-center text-sm font-medium py-2 w-24">
+ <Trans>Email</Trans>
+ </th>
+ {slackActive && (
+ <th className="text-center text-sm font-medium py-2 w-24">
+ <Trans>Slack</Trans>
+ </th>
+ )}
+ </tr>
+ </thead>
+ <tbody>
+ {USER_FACING_NOTIFICATION_TOPICS.map((topic) => (
+ <tr key={topic} className="border-b border-border last:border-0">
+ <td className="text-sm py-3">{topicLabels[topic]}</td>
+ <td className="py-3 w-24">
+ <div className="flex justify-center">
+ <Switch
+ checked={isEnabled(topic, "email")}
+ disabled={isPending(topic, "email")}
+ onCheckedChange={(checked) =>
+ toggle(topic, "email", checked)
+ }
+ aria-label={`${topicLabels[topic]} ${t`email`}`}
+ />
+ </div>
+ </td>
+ {slackActive && (
+ <td className="py-3 w-24">
+ <div className="flex justify-center">
+ <Switch
+ checked={isEnabled(topic, "slack")}
+ disabled={isPending(topic, "slack")}
+ onCheckedChange={(checked) =>
+ toggle(topic, "slack", checked)
+ }
+ aria-label={`${topicLabels[topic]} ${t`Slack`}`}
+ />
+ </div>
+ </td>
+ )}
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ </CardContent>
+ </Card>
+ );
+}
diff --git a/apps/erp/app/routes/x+/consumable+/$itemId.purchasing.$supplierPartId.delete.tsx b/apps/erp/app/routes/x+/consumable+/$itemId.purchasing.$supplierPartId.delete.tsx
index 6e0ecab7d4..81ccdcdfbc 100644
--- a/apps/erp/app/routes/x+/consumable+/$itemId.purchasing.$supplierPartId.delete.tsx
+++ b/apps/erp/app/routes/x+/consumable+/$itemId.purchasing.$supplierPartId.delete.tsx
@@ -16,6 +16,8 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
const { supplierPartId } = params;
if (!supplierPartId) throw notFound("supplierPartId not found");
+ // @ts-ignore TS2589 — Supabase joined-select type instantiation too deep;
+ // whether it fires flips with Database type size, so tolerate both states
const result = await client
.from("supplierPart")
.select("id, supplierId, supplier(name)")
diff --git a/apps/erp/app/routes/x+/part+/$itemId.purchasing.$supplierPartId.delete.tsx b/apps/erp/app/routes/x+/part+/$itemId.purchasing.$supplierPartId.delete.tsx
index 5098767695..317545b7e5 100644
--- a/apps/erp/app/routes/x+/part+/$itemId.purchasing.$supplierPartId.delete.tsx
+++ b/apps/erp/app/routes/x+/part+/$itemId.purchasing.$supplierPartId.delete.tsx
@@ -16,8 +16,8 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
const { supplierPartId } = params;
if (!supplierPartId) throw notFound("supplierPartId not found");
- // @ts-ignore TS2589 — supabase embedded-select inference exceeds the depth
- // limit on this branch; the query is unchanged from main where it checks fine
+ // @ts-ignore TS2589 — Supabase joined-select type instantiation too deep;
+ // whether it fires flips with Database type size, so tolerate both states
const result = await client
.from("supplierPart")
.select("id, supplierId, supplier(name)")
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index 2a39ef228c..d201faf793 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -31603,6 +31603,100 @@ export type Database = {
},
]
}
+ notificationPreference: {
+ Row: {
+ channel: string
+ companyId: string
+ enabled: boolean
+ id: string
+ topic: string
+ updatedAt: string
+ userId: string
+ }
+ Insert: {
+ channel: string
+ companyId: string
+ enabled?: boolean
+ id?: string
+ topic: string
+ updatedAt?: string
+ userId: string
+ }
+ Update: {
+ channel?: string
+ companyId?: string
+ enabled?: boolean
+ id?: string
+ topic?: string
+ updatedAt?: string
+ userId?: string
+ }
+ Relationships: [
+ {
+ foreignKeyName: "notificationPreference_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "companies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "notificationPreference_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "company"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "notificationPreference_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "customFieldTables"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "notificationPreference_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "integrations"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "notificationPreference_userId_fkey"
+ columns: ["userId"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "notificationPreference_userId_fkey"
+ columns: ["userId"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "notificationPreference_userId_fkey"
+ columns: ["userId"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "notificationPreference_userId_fkey"
+ columns: ["userId"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "notificationPreference_userId_fkey"
+ columns: ["userId"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ ]
+ }
oauthClient: {
Row: {
clientId: string
@@ -62645,14 +62739,14 @@ export type Database = {
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["id"]
+ columns: ["supplierLocationId"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["supplierLocationId"]
+ columns: ["id"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
@@ -67678,7 +67772,7 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["shipmentCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index 2a39ef228c..d201faf793 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -31603,6 +31603,100 @@ export type Database = {
},
]
}
+ notificationPreference: {
+ Row: {
+ channel: string
+ companyId: string
+ enabled: boolean
+ id: string
+ topic: string
+ updatedAt: string
+ userId: string
+ }
+ Insert: {
+ channel: string
+ companyId: string
+ enabled?: boolean
+ id?: string
+ topic: string
+ updatedAt?: string
+ userId: string
+ }
+ Update: {
+ channel?: string
+ companyId?: string
+ enabled?: boolean
+ id?: string
+ topic?: string
+ updatedAt?: string
+ userId?: string
+ }
+ Relationships: [
+ {
+ foreignKeyName: "notificationPreference_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "companies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "notificationPreference_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "company"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "notificationPreference_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "customFieldTables"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "notificationPreference_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "integrations"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "notificationPreference_userId_fkey"
+ columns: ["userId"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "notificationPreference_userId_fkey"
+ columns: ["userId"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "notificationPreference_userId_fkey"
+ columns: ["userId"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "notificationPreference_userId_fkey"
+ columns: ["userId"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "notificationPreference_userId_fkey"
+ columns: ["userId"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ ]
+ }
oauthClient: {
Row: {
clientId: string
@@ -62645,14 +62739,14 @@ export type Database = {
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["id"]
+ columns: ["supplierLocationId"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["supplierLocationId"]
+ columns: ["id"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
@@ -67678,7 +67772,7 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["shipmentCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
diff --git a/packages/database/supabase/migrations/20260714095112_notification-preferences.sql b/packages/database/supabase/migrations/20260714095112_notification-preferences.sql
new file mode 100644
index 0000000000..607bb1b3b1
--- /dev/null
+++ b/packages/database/supabase/migrations/20260714095112_notification-preferences.sql
@@ -0,0 +1,58 @@
+-- Per-user, per-company notification channel opt-outs. Absence of a row =
+-- enabled; "enabled" = false is an opt-out for that (topic, channel).
+-- User-owned preference rows (like "userModulePreference"): no composite
+-- companyId PK, no audit columns.
+CREATE TABLE IF NOT EXISTS "notificationPreference" (
+ "id" TEXT NOT NULL DEFAULT xid(),
+ "userId" TEXT NOT NULL,
+ "companyId" TEXT NOT NULL,
+ "channel" TEXT NOT NULL,
+ "topic" TEXT NOT NULL,
+ "enabled" BOOLEAN NOT NULL DEFAULT false,
+ "updatedAt" TIMESTAMPTZ NOT NULL DEFAULT now(),
+
+ CONSTRAINT "notificationPreference_pkey" PRIMARY KEY ("id"),
+ CONSTRAINT "notificationPreference_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT "notificationPreference_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "company"("id") ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT "notificationPreference_channel_check" CHECK ("channel" IN ('email', 'slack')),
+ CONSTRAINT "notificationPreference_userId_companyId_channel_topic_key" UNIQUE ("userId", "companyId", "channel", "topic")
+);
+
+ALTER TABLE "notificationPreference" ENABLE ROW LEVEL SECURITY;
+
+-- Every policy scopes by owner AND membership in the target company.
+CREATE POLICY "SELECT" ON "notificationPreference"
+ FOR SELECT USING (
+ "userId" = auth.uid()::text
+ AND "companyId" IN (
+ SELECT "companyId" FROM "userToCompany" WHERE "userId" = auth.uid()::text
+ )
+ );
+
+CREATE POLICY "INSERT" ON "notificationPreference"
+ FOR INSERT WITH CHECK (
+ "userId" = auth.uid()::text
+ AND "companyId" IN (
+ SELECT "companyId" FROM "userToCompany" WHERE "userId" = auth.uid()::text
+ )
+ );
+
+CREATE POLICY "UPDATE" ON "notificationPreference"
+ FOR UPDATE USING ("userId" = auth.uid()::text)
+ WITH CHECK (
+ "userId" = auth.uid()::text
+ AND "companyId" IN (
+ SELECT "companyId" FROM "userToCompany" WHERE "userId" = auth.uid()::text
+ )
+ );
+
+CREATE POLICY "DELETE" ON "notificationPreference"
+ FOR DELETE USING (
+ "userId" = auth.uid()::text
+ AND "companyId" IN (
+ SELECT "companyId" FROM "userToCompany" WHERE "userId" = auth.uid()::text
+ )
+ );
+
+CREATE INDEX IF NOT EXISTS "notificationPreference_userId_companyId_idx"
+ ON "notificationPreference" ("userId", "companyId");
diff --git a/packages/documents/src/email/NotificationEmail.tsx b/packages/documents/src/email/NotificationEmail.tsx
index e5607a90be..e82ad5c952 100644
--- a/packages/documents/src/email/NotificationEmail.tsx
+++ b/packages/documents/src/email/NotificationEmail.tsx
@@ -3,6 +3,7 @@ import {
Button,
Container,
Heading,
+ Hr,
Link,
Preview,
Section,
@@ -30,6 +31,8 @@ interface Props {
ctaLabel?: string;
ctaUrl?: string;
details?: NotificationDetail[];
+ // When set, renders the "Manage notification settings" footer.
+ settingsUrl?: string;
}
// Dark-mode-aware styles. Backgrounds are intentionally set via CSS classes
@@ -189,7 +192,8 @@ export const NotificationEmail = ({
recipientName,
ctaLabel = "View details",
ctaUrl,
- details
+ details,
+ settingsUrl
}: Props) => {
const themeClasses = getEmailThemeClasses();
@@ -356,15 +360,23 @@ export const NotificationEmail = ({
</>
)}
- {/* <Hr className={`my-[32px] nf-divider ${themeClasses.border}`} />
-
- <Text
- className={`text-[12px] leading-[18px] m-0 nf-fallback ${themeClasses.mutedText}`}
- >
- You're receiving this email because you have email notifications
- enabled on your Carbon account. You can manage your preferences from
- your account settings.
- </Text> */}
+ {settingsUrl && (
+ <>
+ <Hr className={`my-[32px] nf-divider ${themeClasses.border}`} />
+ <Text
+ className={`text-[12px] leading-[18px] m-0 nf-fallback ${themeClasses.mutedText}`}
+ >
+ You&apos;re receiving this email because you have email
+ notifications enabled on your Carbon account.{" "}
+ <Link
+ href={settingsUrl}
+ className={`${themeClasses.mutedText} underline nf-fallback`}
+ >
+ Manage notification settings
+ </Link>
+ </Text>
+ </>
+ )}
</Container>
</Body>
</EmailThemeProvider>
diff --git a/packages/ee/src/slack/lib/service.ts b/packages/ee/src/slack/lib/service.ts
index b8a05899ee..e36bbbd1fc 100644
--- a/packages/ee/src/slack/lib/service.ts
+++ b/packages/ee/src/slack/lib/service.ts
@@ -209,7 +209,7 @@ export async function getSlackAuth(
.eq("companyId", companyId)
.eq("id", "slack")
.maybeSingle();
- if (companyIntegration.error) {
+ if (companyIntegration.error || !companyIntegration.data?.active) {
return null;
}
diff --git a/packages/jobs/src/inngest/functions/notifications/content.ts b/packages/jobs/src/inngest/functions/notifications/content.ts
index 6624949c5a..865c3af13c 100644
--- a/packages/jobs/src/inngest/functions/notifications/content.ts
+++ b/packages/jobs/src/inngest/functions/notifications/content.ts
@@ -27,6 +27,16 @@ export function buildNotificationLink(
return `${ERP_URL}/api/link?${params.toString()}`;
}
+// Routed through /api/link so the company-switch flow runs before landing on
+// the settings page.
+export function buildNotificationSettingsLink(companyId: string): string {
+ const params = new URLSearchParams({
+ page: "notification-settings",
+ companyId
+ });
+ return `${ERP_URL}/api/link?${params.toString()}`;
+}
+
// One document inside a digest-shaped notification. documentId + description
// drive the in-app child rows; the rest renders in the digest email.
export type DigestItem = {
@@ -909,6 +919,35 @@ async function buildEventContent(
};
}
+ case NotificationEvent.PurchasingRfqAssignment: {
+ const purchasingRfq = await client
+ .from("purchasingRfq")
+ .select("*")
+ .eq("id", documentId)
+ .single();
+
+ if (purchasingRfq.error) {
+ console.error("Failed to get purchasing RFQ", purchasingRfq.error);
+ throw purchasingRfq.error;
+ }
+
+ return {
+ description: `Purchasing RFQ ${purchasingRfq?.data?.rfqId} assigned to you`,
+ reference: purchasingRfq?.data?.rfqId ?? undefined,
+ details: buildDetails([
+ {
+ label: "RFQ date",
+ value: formatDetailDate(purchasingRfq.data?.rfqDate)
+ },
+ {
+ label: "Expires",
+ value: formatDetailDate(purchasingRfq.data?.expirationDate)
+ },
+ { label: "Status", value: purchasingRfq.data?.status }
+ ])
+ };
+ }
+
case NotificationEvent.SupplierQuoteAssignment: {
const supplierQuoteAssignment = await client
.from("supplierQuote")
@@ -1208,6 +1247,7 @@ export async function getNotificationContent(
// Template dispatch: add a case to give a notification type its own email;
// everything else renders the generic NotificationEmail card.
export function getNotificationEmailComponent(args: {
+ companyId: string;
content: NotificationContent;
ctaLabel: string;
ctaUrl: string;
@@ -1235,7 +1275,8 @@ export function getNotificationEmailComponent(args: {
message: args.content.description,
preview: args.heading,
recipientName: args.recipientName,
- reference: args.content.reference
+ reference: args.content.reference,
+ settingsUrl: buildNotificationSettingsLink(args.companyId)
});
}
}
diff --git a/packages/jobs/src/inngest/functions/notifications/notify.ts b/packages/jobs/src/inngest/functions/notifications/notify.ts
index c670e5cc76..c534c78e8c 100644
--- a/packages/jobs/src/inngest/functions/notifications/notify.ts
+++ b/packages/jobs/src/inngest/functions/notifications/notify.ts
@@ -138,6 +138,10 @@ const defaultDestinations: Partial<
NotificationDestination.Email,
NotificationDestination.Slack
],
+ [NotificationEvent.PurchasingRfqAssignment]: [
+ NotificationDestination.Email,
+ NotificationDestination.Slack
+ ],
[NotificationEvent.SalesRfqAssignment]: [
NotificationDestination.Email,
NotificationDestination.Slack
@@ -288,6 +292,41 @@ export const notifyFunction = inngest.createFunction(
return;
}
+ const topic = getNotificationTopic(payload.event);
+
+ const wantsEmail = destinations.includes(NotificationDestination.Email);
+ const wantsSlack = destinations.includes(NotificationDestination.Slack);
+
+ // Per-user channel opt-outs: absence of a row = enabled; enabled=false
+ // mutes that (topic, channel). In-app delivery is never filtered.
+ const { emailRecipientIds, slackRecipientIds } =
+ wantsEmail || wantsSlack
+ ? await step.run("filter-recipients-by-preference", async () => {
+ const { data: prefs, error } = await client
+ .from("notificationPreference")
+ .select("userId, channel, enabled")
+ .in("userId", userIds)
+ .eq("companyId", payload.companyId)
+ .eq("topic", topic);
+ if (error) {
+ console.error("Failed to load notification preferences", error);
+ throw error;
+ }
+ const mutedFor = (channel: "email" | "slack") =>
+ new Set(
+ (prefs ?? [])
+ .filter((p) => p.channel === channel && !p.enabled)
+ .map((p) => p.userId)
+ );
+ const emailMuted = mutedFor("email");
+ const slackMuted = mutedFor("slack");
+ return {
+ emailRecipientIds: userIds.filter((id) => !emailMuted.has(id)),
+ slackRecipientIds: userIds.filter((id) => !slackMuted.has(id))
+ };
+ })
+ : { emailRecipientIds: userIds, slackRecipientIds: userIds };
+
// Existing EE hook for non-conformance assignment — keep as a separate
// path because it handles cross-system task linking (Linear/Jira), not
// user-facing notification delivery.
@@ -331,8 +370,6 @@ export const notifyFunction = inngest.createFunction(
});
}
- const topic = getNotificationTopic(payload.event);
-
// ---- In-app fan-out ----
if (destinations.includes(NotificationDestination.InApp)) {
await step.run("write-in-app-notifications", async () => {
@@ -470,27 +507,27 @@ export const notifyFunction = inngest.createFunction(
// The plan check gates only the email channel — Slack fan-out below must
// still run for companies without EMAIL_NOTIFICATIONS.
const emailAllowed =
- destinations.includes(NotificationDestination.Email) &&
+ wantsEmail &&
(await step.run("check-email-plan", () =>
companyHasPlan(client, payload.companyId, {
feature: "EMAIL_NOTIFICATIONS"
})
));
- if (destinations.includes(NotificationDestination.Email) && !emailAllowed) {
+ if (wantsEmail && !emailAllowed) {
console.warn(
`EMAIL_NOTIFICATIONS not enabled for company ${payload.companyId}; skipping email fan-out`
);
}
- if (emailAllowed) {
+ if (emailAllowed && emailRecipientIds.length > 0) {
const emailEvents = await step.run(
"resolve-email-recipients",
async () => {
const { data: users, error } = await client
.from("user")
.select("id, email, fullName")
- .in("id", userIds);
+ .in("id", emailRecipientIds);
if (error) {
console.error("Failed to resolve email recipients", error);
throw error;
@@ -528,6 +565,7 @@ export const notifyFunction = inngest.createFunction(
recipients.map(async (u) => {
const html = await render(
getNotificationEmailComponent({
+ companyId: payload.companyId,
content,
ctaLabel,
ctaUrl,
@@ -583,7 +621,7 @@ export const notifyFunction = inngest.createFunction(
// ---- Slack DM fan-out ----
// Per-user DMs via the company's linked Slack workspace. Users without a
// matching Slack account in that workspace are silently skipped.
- if (destinations.includes(NotificationDestination.Slack)) {
+ if (wantsSlack && slackRecipientIds.length > 0) {
const slackEvents = await step.run(
"resolve-slack-recipients",
async () => {
@@ -629,7 +667,7 @@ export const notifyFunction = inngest.createFunction(
}\n<${ctaUrl}|View in Carbon>`;
const slackUserIds = await Promise.all(
- userIds.map((userId) =>
+ slackRecipientIds.map((userId) =>
getSlackUserIdByCarbonId(client, accessToken, userId)
)
);
diff --git a/packages/locale/locales/de/erp.po b/packages/locale/locales/de/erp.po
index 3669cc40dc..2ad4ff0232 100644
--- a/packages/locale/locales/de/erp.po
+++ b/packages/locale/locales/de/erp.po
@@ -1029,6 +1029,9 @@ msgstr "Genehmigungsanforderungen"
msgid "Approval Rules"
msgstr "Genehmigungsregeln"
+msgid "Approvals"
+msgstr "Genehmigungen"
+
msgid "Approve"
msgstr "Genehmigen"
@@ -4678,12 +4681,18 @@ msgstr "Arbeitszentrum bearbeiten"
msgid "Eliminated"
msgstr "Beseitigt"
+msgid "email"
+msgstr "E-Mail"
+
msgid "Email"
msgstr "E-Mail"
msgid "Email Address"
msgstr "E-Mail-Adresse"
+msgid "Email notifications are not included in your company's current plan; email preferences will apply if they are enabled."
+msgstr "E-Mail-Benachrichtigungen sind nicht in Ihrem aktuellen Unternehmensplan enthalten; E-Mail-Einstellungen werden angewendet, falls sie aktiviert sind."
+
msgid "Email notifications not configured"
msgstr "E-Mail-Benachrichtigungen nicht konfiguriert"
@@ -5739,6 +5748,9 @@ msgstr "Messinstrumente"
msgid "Genealogy"
msgstr "Hauptbuch"
+msgid "General"
+msgstr "Allgemein"
+
msgid "General ledger"
msgstr "GL-Konto, das Kostenunterschiede bei Fremdbearbeitungsvorgängen erfasst."
@@ -6295,6 +6307,12 @@ msgstr "Nur auf Lager"
msgid "In the loop together"
msgstr "Im Prozess dabei"
+msgid "In-app notifications are always delivered. Choose which topics also reach you by email or Slack."
+msgstr "In-App-Benachrichtigungen werden immer zugestellt. Wählen Sie, welche Themen Sie auch per E-Mail oder Slack erreichen."
+
+msgid "In-app notifications are always delivered. Choose which topics also reach you by email."
+msgstr "In-App-Benachrichtigungen werden immer zugestellt. Wählen Sie, welche Themen Sie auch per E-Mail erreichen."
+
msgid "Inactive"
msgstr "Inaktiv"
@@ -11416,6 +11434,9 @@ msgstr "Überspringen Sie den freigegebenen, aber nicht gestarteten Zustand –
msgid "Skipped"
msgstr "Übersprungen"
+msgid "Slack"
+msgstr "Slack"
+
msgid "Smoke-test the core daily flows end to end"
msgstr "Smoke-Test der täglichen Kernabläufe von Anfang bis Ende"
@@ -13075,6 +13096,9 @@ msgstr "Werkzeuge"
msgid "Top-level classification (asset / liability / equity / revenue / expense); set only on root groups, inherited by children."
msgstr "Klassifizierung auf oberster Ebene (Anlage / Verbindlichkeit / Eigenkapital / Umsatz / Ausgaben); nur auf Wurzelgruppen eingestellt, von Kindern geerbt."
+msgid "Topic"
+msgstr "Thema"
+
msgid "Total"
msgstr "Gesamt"
diff --git a/packages/locale/locales/en/erp.po b/packages/locale/locales/en/erp.po
index c93400607d..a6dc02f070 100644
--- a/packages/locale/locales/en/erp.po
+++ b/packages/locale/locales/en/erp.po
@@ -1029,6 +1029,9 @@ msgstr "Approval Requirements"
msgid "Approval Rules"
msgstr "Approval Rules"
+msgid "Approvals"
+msgstr "Approvals"
+
msgid "Approve"
msgstr "Approve"
@@ -4678,12 +4681,18 @@ msgstr "Edit Work Center"
msgid "Eliminated"
msgstr "Eliminated"
+msgid "email"
+msgstr "email"
+
msgid "Email"
msgstr "Email"
msgid "Email Address"
msgstr "Email Address"
+msgid "Email notifications are not included in your company's current plan; email preferences will apply if they are enabled."
+msgstr "Email notifications are not included in your company's current plan; email preferences will apply if they are enabled."
+
msgid "Email notifications not configured"
msgstr "Email notifications not configured"
@@ -5739,6 +5748,9 @@ msgstr "Gauges"
msgid "Genealogy"
msgstr "Genealogy"
+msgid "General"
+msgstr "General"
+
msgid "General ledger"
msgstr "General ledger"
@@ -6295,6 +6307,12 @@ msgstr "In stock only"
msgid "In the loop together"
msgstr "In the loop together"
+msgid "In-app notifications are always delivered. Choose which topics also reach you by email or Slack."
+msgstr "In-app notifications are always delivered. Choose which topics also reach you by email or Slack."
+
+msgid "In-app notifications are always delivered. Choose which topics also reach you by email."
+msgstr "In-app notifications are always delivered. Choose which topics also reach you by email."
+
msgid "Inactive"
msgstr "Inactive"
@@ -11416,6 +11434,9 @@ msgstr "Skip the released-but-not-started state — the job starts immediately o
msgid "Skipped"
msgstr "Skipped"
+msgid "Slack"
+msgstr "Slack"
+
msgid "Smoke-test the core daily flows end to end"
msgstr "Smoke-test the core daily flows end to end"
@@ -13075,6 +13096,9 @@ msgstr "Tools"
msgid "Top-level classification (asset / liability / equity / revenue / expense); set only on root groups, inherited by children."
msgstr "Top-level classification (asset / liability / equity / revenue / expense); set only on root groups, inherited by children."
+msgid "Topic"
+msgstr "Topic"
+
msgid "Total"
msgstr "Total"
diff --git a/packages/locale/locales/es/erp.po b/packages/locale/locales/es/erp.po
index ef143497ff..bfe75b0e95 100644
--- a/packages/locale/locales/es/erp.po
+++ b/packages/locale/locales/es/erp.po
@@ -1029,6 +1029,9 @@ msgstr "Requisitos de Aprobación"
msgid "Approval Rules"
msgstr "Reglas de Aprobación"
+msgid "Approvals"
+msgstr "Aprobaciones"
+
msgid "Approve"
msgstr "Aprobar"
@@ -4678,12 +4681,18 @@ msgstr "Editar Centro de Trabajo"
msgid "Eliminated"
msgstr "Eliminado"
+msgid "email"
+msgstr "Correo electrónico"
+
msgid "Email"
msgstr "Correo electrónico"
msgid "Email Address"
msgstr "Dirección de Correo Electrónico"
+msgid "Email notifications are not included in your company's current plan; email preferences will apply if they are enabled."
+msgstr "Las notificaciones por correo electrónico no se incluyen en el plan actual de su empresa; las preferencias de correo electrónico se aplicarán si se habilitan."
+
msgid "Email notifications not configured"
msgstr "Notificaciones por correo electrónico no configuradas"
@@ -5739,6 +5748,9 @@ msgstr "Medidores"
msgid "Genealogy"
msgstr "Libro Mayor"
+msgid "General"
+msgstr "General"
+
msgid "General ledger"
msgstr "Cuenta GL que captura diferencias de costos en operaciones de procesamiento externo."
@@ -6295,6 +6307,12 @@ msgstr "Solo en stock"
msgid "In the loop together"
msgstr "En el ciclo juntos"
+msgid "In-app notifications are always delivered. Choose which topics also reach you by email or Slack."
+msgstr "Las notificaciones en la aplicación siempre se entregan. Elija qué temas también le llegan por correo electrónico o Slack."
+
+msgid "In-app notifications are always delivered. Choose which topics also reach you by email."
+msgstr "Las notificaciones en la aplicación siempre se entregan. Elija qué temas también le llegan por correo electrónico."
+
msgid "Inactive"
msgstr "Inactivo"
@@ -11416,6 +11434,9 @@ msgstr "Omita el estado liberado pero no iniciado: el trabajo comienza inmediata
msgid "Skipped"
msgstr "Omitido"
+msgid "Slack"
+msgstr "Slack"
+
msgid "Smoke-test the core daily flows end to end"
msgstr "Prueba de humo de los flujos diarios principales de principio a fin"
@@ -13075,6 +13096,9 @@ msgstr "Herramientas"
msgid "Top-level classification (asset / liability / equity / revenue / expense); set only on root groups, inherited by children."
msgstr "Clasificación de nivel superior (activo/pasivo/patrimonio/ingresos/gastos); establecido solo en grupos raíz, heredado por hijos."
+msgid "Topic"
+msgstr "Tema"
+
msgid "Total"
msgstr "Total"
diff --git a/packages/locale/locales/fr/erp.po b/packages/locale/locales/fr/erp.po
index 1c3235a6b6..db92a335e9 100644
--- a/packages/locale/locales/fr/erp.po
+++ b/packages/locale/locales/fr/erp.po
@@ -1029,6 +1029,9 @@ msgstr "Exigences d'approbation"
msgid "Approval Rules"
msgstr "Règles d'approbation"
+msgid "Approvals"
+msgstr "Approbations"
+
msgid "Approve"
msgstr "Approuver"
@@ -4678,12 +4681,18 @@ msgstr "Modifier le centre de travail"
msgid "Eliminated"
msgstr "Éliminé"
+msgid "email"
+msgstr "email"
+
msgid "Email"
msgstr "E-mail"
msgid "Email Address"
msgstr "Adresse e-mail"
+msgid "Email notifications are not included in your company's current plan; email preferences will apply if they are enabled."
+msgstr "Les notifications par e-mail ne sont pas incluses dans le forfait actuel de votre entreprise ; les préférences d'e-mail s'appliqueront s'ils sont activés."
+
msgid "Email notifications not configured"
msgstr "Les notifications par e-mail ne sont pas configurées"
@@ -5739,6 +5748,9 @@ msgstr "Jauges"
msgid "Genealogy"
msgstr "Grand Livre"
+msgid "General"
+msgstr "Général"
+
msgid "General ledger"
msgstr "Compte GL capturant les différences de coûts sur les opérations de sous-traitance."
@@ -6295,6 +6307,12 @@ msgstr "En stock uniquement"
msgid "In the loop together"
msgstr "Dans la boucle ensemble"
+msgid "In-app notifications are always delivered. Choose which topics also reach you by email or Slack."
+msgstr "Les notifications dans l'application sont toujours livrées. Choisissez les sujets qui vous parviennent également par e-mail ou Slack."
+
+msgid "In-app notifications are always delivered. Choose which topics also reach you by email."
+msgstr "Les notifications dans l'application sont toujours livrées. Choisissez les sujets qui vous parviennent également par e-mail."
+
msgid "Inactive"
msgstr "Inactif"
@@ -11416,6 +11434,9 @@ msgstr "Ignorer l'état libéré mais non démarré - le travail commence imméd
msgid "Skipped"
msgstr "Ignoré"
+msgid "Slack"
+msgstr "Slack"
+
msgid "Smoke-test the core daily flows end to end"
msgstr "Tester les flux quotidiens principaux de bout en bout"
@@ -13075,6 +13096,9 @@ msgstr "Outils"
msgid "Top-level classification (asset / liability / equity / revenue / expense); set only on root groups, inherited by children."
msgstr "Classification de niveau supérieur (actif/passif/capitaux propres/revenus/dépenses); défini uniquement sur les groupes racine, hérité par les enfants."
+msgid "Topic"
+msgstr "Sujet"
+
msgid "Total"
msgstr "Total"
diff --git a/packages/locale/locales/hi/erp.po b/packages/locale/locales/hi/erp.po
index 164014cfd4..64ae7582d3 100644
--- a/packages/locale/locales/hi/erp.po
+++ b/packages/locale/locales/hi/erp.po
@@ -1029,6 +1029,9 @@ msgstr "अनुमोदन आवश्यकताएं"
msgid "Approval Rules"
msgstr "अनुमोदन नियम"
+msgid "Approvals"
+msgstr "अनुमोदन"
+
msgid "Approve"
msgstr "मंजूरी दें"
@@ -4678,12 +4681,18 @@ msgstr "कार्य केंद्र संपादित करें"
msgid "Eliminated"
msgstr "समाप्त किया गया"
+msgid "email"
+msgstr "ईमेल"
+
msgid "Email"
msgstr "ईमेल"
msgid "Email Address"
msgstr "ईमेल पता"
+msgid "Email notifications are not included in your company's current plan; email preferences will apply if they are enabled."
+msgstr "ईमेल नोटिफिकेशन आपकी कंपनी की वर्तमान योजना में शामिल नहीं हैं; यदि वे सक्षम हैं तो ईमेल प्राथमिकताएं लागू होंगी।"
+
msgid "Email notifications not configured"
msgstr "ईमेल सूचनाएं कॉन्फ़िगर नहीं की गई हैं"
@@ -5739,6 +5748,9 @@ msgstr "गेज"
msgid "Genealogy"
msgstr "सामान्य बहीखाता"
+msgid "General"
+msgstr "सामान्य"
+
msgid "General ledger"
msgstr "GL खाता बाहरी प्रसंस्करण संचालन पर लागत अंतर को कैप्चर करता है।"
@@ -6295,6 +6307,12 @@ msgstr "केवल स्टॉक में"
msgid "In the loop together"
msgstr "एक साथ लूप में"
+msgid "In-app notifications are always delivered. Choose which topics also reach you by email or Slack."
+msgstr "इन-ऐप नोटिफिकेशन हमेशा डिलीवर किए जाते हैं। चुनें कि कौन से विषय आपको ईमेल या Slack के माध्यम से भी पहुंचते हैं।"
+
+msgid "In-app notifications are always delivered. Choose which topics also reach you by email."
+msgstr "इन-ऐप नोटिफिकेशन हमेशा डिलीवर किए जाते हैं। चुनें कि कौन से विषय आपको ईमेल के माध्यम से भी पहुंचते हैं।"
+
msgid "Inactive"
msgstr "निष्क्रिय"
@@ -11416,6 +11434,9 @@ msgstr "जारी-लेकिन-शुरू नहीं की गई स
msgid "Skipped"
msgstr "छोड़ा गया"
+msgid "Slack"
+msgstr "Slack"
+
msgid "Smoke-test the core daily flows end to end"
msgstr "कोर दैनिक प्रवाह को अंत से अंत तक स्मोक-टेस्ट करें"
@@ -13075,6 +13096,9 @@ msgstr "उपकरण"
msgid "Top-level classification (asset / liability / equity / revenue / expense); set only on root groups, inherited by children."
msgstr "शीर्ष-स्तर वर्गीकरण (संपत्ति / देयता / इक्विटी / राजस्व / व्यय); केवल मूल समूहों पर सेट, बच्चों द्वारा विरासत में।"
+msgid "Topic"
+msgstr "विषय"
+
msgid "Total"
msgstr "कुल"
diff --git a/packages/locale/locales/it/erp.po b/packages/locale/locales/it/erp.po
index c12427d08c..35804bc700 100644
--- a/packages/locale/locales/it/erp.po
+++ b/packages/locale/locales/it/erp.po
@@ -1029,6 +1029,9 @@ msgstr "Requisiti di Approvazione"
msgid "Approval Rules"
msgstr "Regole di Approvazione"
+msgid "Approvals"
+msgstr "Approvazioni"
+
msgid "Approve"
msgstr "Approva"
@@ -4678,12 +4681,18 @@ msgstr "Modifica Centro di Lavoro"
msgid "Eliminated"
msgstr "Eliminato"
+msgid "email"
+msgstr "email"
+
msgid "Email"
msgstr "Email"
msgid "Email Address"
msgstr "Indirizzo Email"
+msgid "Email notifications are not included in your company's current plan; email preferences will apply if they are enabled."
+msgstr "Le notifiche e-mail non sono incluse nel piano attuale della tua azienda; le preferenze e-mail verranno applicate se abilitate."
+
msgid "Email notifications not configured"
msgstr "Notifiche email non configurate"
@@ -5739,6 +5748,9 @@ msgstr "Calibri"
msgid "Genealogy"
msgstr "Libro Mastro"
+msgid "General"
+msgstr "Generale"
+
msgid "General ledger"
msgstr "Conto GL che cattura le differenze di costo sulle operazioni di lavorazione esterna."
@@ -6295,6 +6307,12 @@ msgstr "Solo in giacenza"
msgid "In the loop together"
msgstr "Nel giro insieme"
+msgid "In-app notifications are always delivered. Choose which topics also reach you by email or Slack."
+msgstr "Le notifiche in-app vengono sempre consegnate. Scegli quali argomenti vuoi ricevere anche per e-mail o Slack."
+
+msgid "In-app notifications are always delivered. Choose which topics also reach you by email."
+msgstr "Le notifiche in-app vengono sempre consegnate. Scegli quali argomenti vuoi ricevere anche per e-mail."
+
msgid "Inactive"
msgstr "Inattivo"
@@ -11416,6 +11434,9 @@ msgstr "Ignora lo stato rilasciato ma non avviato: il lavoro inizia immediatamen
msgid "Skipped"
msgstr "Saltato"
+msgid "Slack"
+msgstr "Slack"
+
msgid "Smoke-test the core daily flows end to end"
msgstr "Smoke-test dei flussi giornalieri principali da inizio a fine"
@@ -13075,6 +13096,9 @@ msgstr "Strumenti"
msgid "Top-level classification (asset / liability / equity / revenue / expense); set only on root groups, inherited by children."
msgstr "Classificazione di primo livello (attivo/passivo/patrimonio netto/ricavi/spese); impostato solo su gruppi radice, ereditato dai figli."
+msgid "Topic"
+msgstr "Argomento"
+
msgid "Total"
msgstr "Totale"
diff --git a/packages/locale/locales/ja/erp.po b/packages/locale/locales/ja/erp.po
index c33df98411..a6d7b96882 100644
--- a/packages/locale/locales/ja/erp.po
+++ b/packages/locale/locales/ja/erp.po
@@ -1029,6 +1029,9 @@ msgstr "承認要件"
msgid "Approval Rules"
msgstr "承認ルール"
+msgid "Approvals"
+msgstr "承認"
+
msgid "Approve"
msgstr "承認"
@@ -4678,12 +4681,18 @@ msgstr "ワークセンターを編集"
msgid "Eliminated"
msgstr "削除済み"
+msgid "email"
+msgstr "メール"
+
msgid "Email"
msgstr "メール"
msgid "Email Address"
msgstr "メールアドレス"
+msgid "Email notifications are not included in your company's current plan; email preferences will apply if they are enabled."
+msgstr "メール通知はあなたの会社の現在のプランに含まれていません。メール設定が有効になっている場合は適用されます。"
+
msgid "Email notifications not configured"
msgstr "メール通知が設定されていません"
@@ -5739,6 +5748,9 @@ msgstr "ゲージ"
msgid "Genealogy"
msgstr "総勘定元帳"
+msgid "General"
+msgstr "一般"
+
msgid "General ledger"
msgstr "外部処理操作のコスト差異をキャプチャするGLアカウント。"
@@ -6295,6 +6307,12 @@ msgstr "在庫のみ"
msgid "In the loop together"
msgstr "一緒にループの中にいる"
+msgid "In-app notifications are always delivered. Choose which topics also reach you by email or Slack."
+msgstr "アプリ内通知は常に配信されます。どのトピックがメールまたはSlackでも届くかを選択してください。"
+
+msgid "In-app notifications are always delivered. Choose which topics also reach you by email."
+msgstr "アプリ内通知は常に配信されます。どのトピックがメールでも届くかを選択してください。"
+
msgid "Inactive"
msgstr "非アクティブ"
@@ -11416,6 +11434,9 @@ msgstr "リリースされたが開始していない状態をスキップしま
msgid "Skipped"
msgstr "スキップ"
+msgid "Slack"
+msgstr "Slack"
+
msgid "Smoke-test the core daily flows end to end"
msgstr "コア日次フローのスモークテストを端から端まで実施"
@@ -13075,6 +13096,9 @@ msgstr "ツール"
msgid "Top-level classification (asset / liability / equity / revenue / expense); set only on root groups, inherited by children."
msgstr "トップレベルの分類(資産/負債/資本/収益/費用)。ルートグループにのみ設定され、子に継承されます。"
+msgid "Topic"
+msgstr "トピック"
+
msgid "Total"
msgstr "合計"
diff --git a/packages/locale/locales/ko/erp.po b/packages/locale/locales/ko/erp.po
index adaf113e64..9e8cd59463 100644
--- a/packages/locale/locales/ko/erp.po
+++ b/packages/locale/locales/ko/erp.po
@@ -1029,6 +1029,9 @@ msgstr "승인 요구사항"
msgid "Approval Rules"
msgstr "승인 규칙"
+msgid "Approvals"
+msgstr "승인"
+
msgid "Approve"
msgstr "승인"
@@ -4678,12 +4681,18 @@ msgstr "작업장 수정"
msgid "Eliminated"
msgstr "제거됨"
+msgid "email"
+msgstr "이메일"
+
msgid "Email"
msgstr "이메일"
msgid "Email Address"
msgstr "이메일 주소"
+msgid "Email notifications are not included in your company's current plan; email preferences will apply if they are enabled."
+msgstr "이메일 알림은 귀사의 현재 플랜에 포함되지 않습니다. 이메일 알림이 활성화되면 이메일 환경설정이 적용됩니다."
+
msgid "Email notifications not configured"
msgstr "이메일 알림이 설정되지 않음"
@@ -5739,6 +5748,9 @@ msgstr "측정기"
msgid "Genealogy"
msgstr "계보"
+msgid "General"
+msgstr "일반"
+
msgid "General ledger"
msgstr "총계정원장"
@@ -6295,6 +6307,12 @@ msgstr "재고만"
msgid "In the loop together"
msgstr "함께 정보 공유하기"
+msgid "In-app notifications are always delivered. Choose which topics also reach you by email or Slack."
+msgstr "인앱 알림은 항상 전달됩니다. 이메일 또는 Slack으로도 전달받을 주제를 선택하세요."
+
+msgid "In-app notifications are always delivered. Choose which topics also reach you by email."
+msgstr "인앱 알림은 항상 전달됩니다. 이메일로도 전달받을 주제를 선택하세요."
+
msgid "Inactive"
msgstr "비활성"
@@ -11416,6 +11434,9 @@ msgstr "릴리즈되었지만 시작되지 않은 상태를 건너뜁니다 —
msgid "Skipped"
msgstr "건너뜀"
+msgid "Slack"
+msgstr "Slack"
+
msgid "Smoke-test the core daily flows end to end"
msgstr "핵심 일일 업무 흐름을 처음부터 끝까지 스모크 테스트하세요"
@@ -13075,6 +13096,9 @@ msgstr "공구"
msgid "Top-level classification (asset / liability / equity / revenue / expense); set only on root groups, inherited by children."
msgstr "최상위 분류(자산/부채/자본/수익/비용)로, 루트 그룹에만 설정하며 하위 항목에 상속됩니다."
+msgid "Topic"
+msgstr "주제"
+
msgid "Total"
msgstr "합계"
diff --git a/packages/locale/locales/pl/erp.po b/packages/locale/locales/pl/erp.po
index 7812d51dce..d8b37caec6 100644
--- a/packages/locale/locales/pl/erp.po
+++ b/packages/locale/locales/pl/erp.po
@@ -1029,6 +1029,9 @@ msgstr "Wymagania zatwierdzenia"
msgid "Approval Rules"
msgstr "Reguły zatwierdzania"
+msgid "Approvals"
+msgstr "Zatwierdzenia"
+
msgid "Approve"
msgstr "Zatwierdź"
@@ -4678,12 +4681,18 @@ msgstr "Edytuj Centrum Pracy"
msgid "Eliminated"
msgstr "Wyeliminowane"
+msgid "email"
+msgstr "email"
+
msgid "Email"
msgstr "E-mail"
msgid "Email Address"
msgstr "Adres e-mail"
+msgid "Email notifications are not included in your company's current plan; email preferences will apply if they are enabled."
+msgstr "Powiadomienia e-mail nie są uwzględnione w bieżącym planie Twojej firmy; preferencje e-mail będą obowiązywać, jeśli zostaną włączone."
+
msgid "Email notifications not configured"
msgstr "Powiadomienia e-mail nie są skonfigurowane"
@@ -5739,6 +5748,9 @@ msgstr "Mierniki"
msgid "Genealogy"
msgstr "Księga Główna"
+msgid "General"
+msgstr "Ogólne"
+
msgid "General ledger"
msgstr "Konto GL przechwytujące różnice kosztów w operacjach obróbki zewnętrznej."
@@ -6295,6 +6307,12 @@ msgstr "Tylko w magazynie"
msgid "In the loop together"
msgstr "W pętli razem"
+msgid "In-app notifications are always delivered. Choose which topics also reach you by email or Slack."
+msgstr "Powiadomienia w aplikacji są zawsze dostarczane. Wybierz, które tematy mają do Ciebie dotrzeć również pocztą e-mail lub Slack."
+
+msgid "In-app notifications are always delivered. Choose which topics also reach you by email."
+msgstr "Powiadomienia w aplikacji są zawsze dostarczane. Wybierz, które tematy mają do Ciebie dotrzeć również pocztą e-mail."
+
msgid "Inactive"
msgstr "Nieaktywny"
@@ -11416,6 +11434,9 @@ msgstr "Pomiń stan zwolniony, ale nie uruchomiony - zadanie rozpoczyna się nat
msgid "Skipped"
msgstr "Pominięte"
+msgid "Slack"
+msgstr "Slack"
+
msgid "Smoke-test the core daily flows end to end"
msgstr "Smoke-test podstawowych codziennych przepływów od końca do końca"
@@ -13075,6 +13096,9 @@ msgstr "Narzędzia"
msgid "Top-level classification (asset / liability / equity / revenue / expense); set only on root groups, inherited by children."
msgstr "Klasyfikacja najwyższego poziomu (aktywa/pasywa/kapitał własny/przychody/wydatki); ustawiana tylko na grupach głównych, dziedziczona przez elementy podrzędne."
+msgid "Topic"
+msgstr "Temat"
+
msgid "Total"
msgstr "Razem"
diff --git a/packages/locale/locales/pt/erp.po b/packages/locale/locales/pt/erp.po
index 4b2393e7a0..9c5882b9b8 100644
--- a/packages/locale/locales/pt/erp.po
+++ b/packages/locale/locales/pt/erp.po
@@ -1029,6 +1029,9 @@ msgstr "Requisitos de Aprovação"
msgid "Approval Rules"
msgstr "Regras de Aprovação"
+msgid "Approvals"
+msgstr "Aprovações"
+
msgid "Approve"
msgstr "Aprovar"
@@ -4678,12 +4681,18 @@ msgstr "Editar Centro de Trabalho"
msgid "Eliminated"
msgstr "Eliminado"
+msgid "email"
+msgstr "email"
+
msgid "Email"
msgstr "Email"
msgid "Email Address"
msgstr "Endereço de Email"
+msgid "Email notifications are not included in your company's current plan; email preferences will apply if they are enabled."
+msgstr "As notificações por email não estão incluídas no plano atual da sua empresa; as preferências de email serão aplicadas se habilitadas."
+
msgid "Email notifications not configured"
msgstr "Notificações de email não configuradas"
@@ -5739,6 +5748,9 @@ msgstr "Medidores"
msgid "Genealogy"
msgstr "Razão Geral"
+msgid "General"
+msgstr "Geral"
+
msgid "General ledger"
msgstr "Conta GL que captura diferenças de custos em operações de processamento externo."
@@ -6295,6 +6307,12 @@ msgstr "Apenas em estoque"
msgid "In the loop together"
msgstr "No circuito juntos"
+msgid "In-app notifications are always delivered. Choose which topics also reach you by email or Slack."
+msgstr "As notificações no aplicativo são sempre entregues. Escolha quais tópicos também chegarão a você por email ou Slack."
+
+msgid "In-app notifications are always delivered. Choose which topics also reach you by email."
+msgstr "As notificações no aplicativo são sempre entregues. Escolha quais tópicos também chegarão a você por email."
+
msgid "Inactive"
msgstr "Inativo"
@@ -11416,6 +11434,9 @@ msgstr "Ignore o estado liberado mas não iniciado - o trabalho começa imediata
msgid "Skipped"
msgstr "Ignorado"
+msgid "Slack"
+msgstr "Slack"
+
msgid "Smoke-test the core daily flows end to end"
msgstr "Teste de fumaça dos fluxos diários principais de ponta a ponta"
@@ -13075,6 +13096,9 @@ msgstr "Ferramentas"
msgid "Top-level classification (asset / liability / equity / revenue / expense); set only on root groups, inherited by children."
msgstr "Classificação de nível superior (ativo/passivo/patrimônio/receita/despesa); definido apenas em grupos raiz, herdado por filhos."
+msgid "Topic"
+msgstr "Tópico"
+
msgid "Total"
msgstr "Total"
diff --git a/packages/locale/locales/ru/erp.po b/packages/locale/locales/ru/erp.po
index a8e60fc00f..4a9f523503 100644
--- a/packages/locale/locales/ru/erp.po
+++ b/packages/locale/locales/ru/erp.po
@@ -1029,6 +1029,9 @@ msgstr "Требования к утверждению"
msgid "Approval Rules"
msgstr "Правила утверждения"
+msgid "Approvals"
+msgstr "Утверждения"
+
msgid "Approve"
msgstr "Одобрить"
@@ -4678,12 +4681,18 @@ msgstr "Редактировать рабочий центр"
msgid "Eliminated"
msgstr "Исключено"
+msgid "email"
+msgstr "Электронная почта"
+
msgid "Email"
msgstr "Электронная почта"
msgid "Email Address"
msgstr "Адрес электронной почты"
+msgid "Email notifications are not included in your company's current plan; email preferences will apply if they are enabled."
+msgstr "Уведомления по электронной почте не включены в текущий план вашей компании; параметры электронной почты будут применены, если они включены."
+
msgid "Email notifications not configured"
msgstr "Уведомления по электронной почте не настроены"
@@ -5739,6 +5748,9 @@ msgstr "Датчики"
msgid "Genealogy"
msgstr "Главная Бухгалтерская Книга"
+msgid "General"
+msgstr "Общие"
+
msgid "General ledger"
msgstr "Счет для фиксации разницы в стоимости при внешней переработке."
@@ -6295,6 +6307,12 @@ msgstr "Только в наличии"
msgid "In the loop together"
msgstr "В курсе дела вместе"
+msgid "In-app notifications are always delivered. Choose which topics also reach you by email or Slack."
+msgstr "Уведомления в приложении всегда доставляются. Выберите, какие темы также будут доходить до вас по электронной почте или Slack."
+
+msgid "In-app notifications are always delivered. Choose which topics also reach you by email."
+msgstr "Уведомления в приложении всегда доставляются. Выберите, какие темы также будут доходить до вас по электронной почте."
+
msgid "Inactive"
msgstr "Неактивно"
@@ -11416,6 +11434,9 @@ msgstr "Пропустить состояние «выпущено, но не н
msgid "Skipped"
msgstr "Пропущено"
+msgid "Slack"
+msgstr "Slack"
+
msgid "Smoke-test the core daily flows end to end"
msgstr "Дымовое тестирование основных ежедневных процессов от начала до конца"
@@ -13075,6 +13096,9 @@ msgstr "Инструменты"
msgid "Top-level classification (asset / liability / equity / revenue / expense); set only on root groups, inherited by children."
msgstr "Классификация верхнего уровня (активы/пассивы/собственный капитал/доходы/расходы); устанавливается только в корневых группах, наследуется дочерними."
+msgid "Topic"
+msgstr "Тема"
+
msgid "Total"
msgstr "Итого"
diff --git a/packages/locale/locales/tr/erp.po b/packages/locale/locales/tr/erp.po
index 83b2c34389..9bea7e4d70 100644
--- a/packages/locale/locales/tr/erp.po
+++ b/packages/locale/locales/tr/erp.po
@@ -1029,6 +1029,9 @@ msgstr "Onay Gereksinimleri"
msgid "Approval Rules"
msgstr "Onay Kuralları"
+msgid "Approvals"
+msgstr "Onaylar"
+
msgid "Approve"
msgstr "Onayla"
@@ -4678,12 +4681,18 @@ msgstr "İş Merkezi Düzenle"
msgid "Eliminated"
msgstr "Ortadan Kaldırılmış"
+msgid "email"
+msgstr "e-posta"
+
msgid "Email"
msgstr "E-posta"
msgid "Email Address"
msgstr "E-posta Adresi"
+msgid "Email notifications are not included in your company's current plan; email preferences will apply if they are enabled."
+msgstr "E-posta bildirimleri şirketinizin mevcut planına dahil değildir; e-posta tercihleriniz etkinleştirildiğinde uygulanacaktır."
+
msgid "Email notifications not configured"
msgstr "E-posta bildirimleri yapılandırılmamış"
@@ -5739,6 +5748,9 @@ msgstr "Kalibratörler"
msgid "Genealogy"
msgstr "Genel Muhasebe Defteri"
+msgid "General"
+msgstr "Genel"
+
msgid "General ledger"
msgstr "Dış işlem operasyonlarında maliyet farklarını yakalayan GL hesabı."
@@ -6295,6 +6307,12 @@ msgstr "Yalnızca stokta"
msgid "In the loop together"
msgstr "Birlikte döngüde"
+msgid "In-app notifications are always delivered. Choose which topics also reach you by email or Slack."
+msgstr "Uygulama içi bildirimler her zaman iletilir. Hangi konuların e-posta veya Slack aracılığıyla sizi ulaştıracağını seçin."
+
+msgid "In-app notifications are always delivered. Choose which topics also reach you by email."
+msgstr "Uygulama içi bildirimler her zaman iletilir. Hangi konuların e-posta aracılığıyla sizi ulaştıracağını seçin."
+
msgid "Inactive"
msgstr "Pasif"
@@ -11416,6 +11434,9 @@ msgstr "Yayınlanan ancak başlatılmayan durumu atlayın - iş tarama sırasın
msgid "Skipped"
msgstr "Atlanmış"
+msgid "Slack"
+msgstr "Slack"
+
msgid "Smoke-test the core daily flows end to end"
msgstr "Temel günlük akışları uçtan uca test et"
@@ -13075,6 +13096,9 @@ msgstr "Araçlar"
msgid "Top-level classification (asset / liability / equity / revenue / expense); set only on root groups, inherited by children."
msgstr "Üst düzey sınıflandırma (varlık/yükümlülük/öz sermaye/gelir/gider); yalnızca kök gruplarda ayarlanır, çocuklar tarafından devralınır."
+msgid "Topic"
+msgstr "Konu"
+
msgid "Total"
msgstr "Toplam"
diff --git a/packages/locale/locales/zh/erp.po b/packages/locale/locales/zh/erp.po
index e96ea71a8f..bd2a812a7a 100644
--- a/packages/locale/locales/zh/erp.po
+++ b/packages/locale/locales/zh/erp.po
@@ -1029,6 +1029,9 @@ msgstr "批准要求"
msgid "Approval Rules"
msgstr "审批规则"
+msgid "Approvals"
+msgstr "审批"
+
msgid "Approve"
msgstr "批准"
@@ -4678,12 +4681,18 @@ msgstr "编辑工作中心"
msgid "Eliminated"
msgstr "已消除"
+msgid "email"
+msgstr "邮件"
+
msgid "Email"
msgstr "电子邮件"
msgid "Email Address"
msgstr "电子邮件地址"
+msgid "Email notifications are not included in your company's current plan; email preferences will apply if they are enabled."
+msgstr "电子邮件通知不包含在贵公司的当前计划中;如果启用电子邮件偏好设置,这些偏好将适用。"
+
msgid "Email notifications not configured"
msgstr "电子邮件通知未配置"
@@ -5739,6 +5748,9 @@ msgstr "量规"
msgid "Genealogy"
msgstr "总分类账"
+msgid "General"
+msgstr "常规"
+
msgid "General ledger"
msgstr "捕获外协加工操作成本差异的GL账户。"
@@ -6295,6 +6307,12 @@ msgstr "仅库存"
msgid "In the loop together"
msgstr "一起保持沟通"
+msgid "In-app notifications are always delivered. Choose which topics also reach you by email or Slack."
+msgstr "应用内通知始终会被传递。选择哪些主题也通过电子邮件或 Slack 发送给您。"
+
+msgid "In-app notifications are always delivered. Choose which topics also reach you by email."
+msgstr "应用内通知始终会被传递。选择哪些主题也通过电子邮件发送给您。"
+
msgid "Inactive"
msgstr "未激活"
@@ -11416,6 +11434,9 @@ msgstr "跳过已发布但未启动的状态 - 扫描时工作立即开始。"
msgid "Skipped"
msgstr "已跳过"
+msgid "Slack"
+msgstr "Slack"
+
msgid "Smoke-test the core daily flows end to end"
msgstr "端到端烟雾测试核心日常流程"
@@ -13075,6 +13096,9 @@ msgstr "工具"
msgid "Top-level classification (asset / liability / equity / revenue / expense); set only on root groups, inherited by children."
msgstr "顶级分类(资产/负债/权益/收益/费用);仅在根组上设置,由子组继承。"
+msgid "Topic"
+msgstr "主题"
+
msgid "Total"
msgstr "总计"
diff --git a/packages/notifications/AGENTS.md b/packages/notifications/AGENTS.md
index 0a4a654a50..d73f291b2c 100644
--- a/packages/notifications/AGENTS.md
+++ b/packages/notifications/AGENTS.md
@@ -27,7 +27,7 @@ pnpm --filter @carbon/notifications typecheck # tsgo --noEmit
## Key Patterns
-- **Enums only** — `NotificationEvent`, `NotificationTopic`, `NotificationDestination`
+- **Enums + pure mapping helpers, no I/O** — `NotificationEvent`, `NotificationTopic`, `NotificationDestination`; `getNotificationTopic`, email heading/CTA helpers, and `USER_FACING_NOTIFICATION_TOPICS` (display order for the account notification-settings page — when adding a `NotificationTopic`, add it here too or it won't appear on that page)
- **inApp is always included** — regardless of caller-specified destinations
- **Single export**: `@carbon/notifications` barrel from `src/index.ts`
diff --git a/packages/notifications/src/index.ts b/packages/notifications/src/index.ts
index e8c2f46fb7..0a969f556c 100644
--- a/packages/notifications/src/index.ts
+++ b/packages/notifications/src/index.ts
@@ -25,6 +25,7 @@ export enum NotificationEvent {
ProcedureAssignment = "procedure-assignment",
PurchaseInvoiceAssignment = "purchase-invoice-assignment",
PurchaseOrderAssignment = "purchase-order-assignment",
+ PurchasingRfqAssignment = "purchasing-rfq-assignment",
QuoteAssignment = "quote-assignment",
QuoteExpired = "quote-expired",
RiskAssignment = "risk-assignment",
@@ -60,6 +61,22 @@ export enum NotificationTopic {
Training = "training"
}
+// Display order for the notification-settings page (/x/account/notifications);
+// labels live in that route so Lingui extracts them.
+export const USER_FACING_NOTIFICATION_TOPICS = [
+ NotificationTopic.Approval,
+ NotificationTopic.Job,
+ NotificationTopic.Sales,
+ NotificationTopic.Quote,
+ NotificationTopic.Purchasing,
+ NotificationTopic.Inventory,
+ NotificationTopic.Quality,
+ NotificationTopic.Maintenance,
+ NotificationTopic.Training,
+ NotificationTopic.Suggestion,
+ NotificationTopic.General
+] as const satisfies readonly NotificationTopic[];
+
// A labeled fact attached to a notification (e.g. Customer / Acme Corp),
// rendered in the email, Slack text, and notification.payload.details.
export type NotificationDetail = {
@@ -105,6 +122,7 @@ export function getNotificationTopic(
return NotificationTopic.Job;
case NotificationEvent.PurchaseInvoiceAssignment:
case NotificationEvent.PurchaseOrderAssignment:
+ case NotificationEvent.PurchasingRfqAssignment:
return NotificationTopic.Purchasing;
case NotificationEvent.QuoteAssignment:
case NotificationEvent.QuoteExpired:
@@ -164,6 +182,8 @@ export function getNotificationEmailHeading(event: NotificationEvent): string {
return "Purchase invoice assigned to you";
case NotificationEvent.PurchaseOrderAssignment:
return "Purchase order assigned to you";
+ case NotificationEvent.PurchasingRfqAssignment:
+ return "Purchasing RFQ assigned to you";
case NotificationEvent.QuoteAssignment:
return "Quote assigned to you";
case NotificationEvent.QuoteExpired:
diff --git a/scripts/generate-mcp.ts b/scripts/generate-mcp.ts
index 9abe9892a3..e91ab9728c 100644
--- a/scripts/generate-mcp.ts
+++ b/scripts/generate-mcp.ts
@@ -88,9 +88,13 @@ const DESCRIPTION_OVERRIDES: Record<string, string> = {
// spread of their injected args:
// - inventory_insertManualInventoryAdjustment → itemLedger
// - accounting_upsertFixedAssetUsageLog → fixedAssetUsageLog
+// account_upsertNotificationPreference spreads its argument into an upsert on
+// notificationPreference, which (like userModulePreference) carries no
+// createdBy/updatedBy columns at all — injecting them breaks the write.
const INJECT_AUTH_OVERRIDES: Record<string, AuthField[]> = {
inventory_insertManualInventoryAdjustment: ["companyId", "createdBy"],
accounting_upsertFixedAssetUsageLog: ["companyId", "createdBy"],
+ account_upsertNotificationPreference: ["companyId"],
};
// ---------------------------------------------------------------------------