@octaviaflow/core 3.1.0-beta.86 → 3.1.0-beta.88

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.
Files changed (91) hide show
  1. package/dist/chunk-7VHJRHJA.js +5725 -0
  2. package/dist/chunk-7VHJRHJA.js.map +1 -0
  3. package/dist/chunk-BZA2F4V6.js +5722 -0
  4. package/dist/chunk-BZA2F4V6.js.map +1 -0
  5. package/dist/chunk-IOJPMFBQ.js +5725 -0
  6. package/dist/chunk-IOJPMFBQ.js.map +1 -0
  7. package/dist/chunk-JRFIAQHQ.js +5725 -0
  8. package/dist/chunk-JRFIAQHQ.js.map +1 -0
  9. package/dist/chunk-KKVGM7AQ.js +5723 -0
  10. package/dist/chunk-KKVGM7AQ.js.map +1 -0
  11. package/dist/chunk-NPGWV47J.js +5725 -0
  12. package/dist/chunk-NPGWV47J.js.map +1 -0
  13. package/dist/chunk-TCWVOHEZ.js +1646 -0
  14. package/dist/chunk-TCWVOHEZ.js.map +1 -0
  15. package/dist/chunk-WR7VLFZS.js +5722 -0
  16. package/dist/chunk-WR7VLFZS.js.map +1 -0
  17. package/dist/chunk-WYYXHBFE.js +5722 -0
  18. package/dist/chunk-WYYXHBFE.js.map +1 -0
  19. package/dist/components/Combobox/Combobox.d.ts +14 -1
  20. package/dist/components/Combobox/Combobox.d.ts.map +1 -1
  21. package/dist/components/ConditionBuilder/ConditionBuilder.d.ts +8 -0
  22. package/dist/components/ConditionBuilder/ConditionBuilder.d.ts.map +1 -1
  23. package/dist/components/Popover/Popover.d.ts +48 -1
  24. package/dist/components/Popover/Popover.d.ts.map +1 -1
  25. package/dist/components/Popover/index.d.ts +1 -1
  26. package/dist/components/Popover/index.d.ts.map +1 -1
  27. package/dist/components/ScheduleBuilder/ScheduleBuilder.d.ts +90 -0
  28. package/dist/components/ScheduleBuilder/ScheduleBuilder.d.ts.map +1 -0
  29. package/dist/components/ScheduleBuilder/index.d.ts +2 -0
  30. package/dist/components/ScheduleBuilder/index.d.ts.map +1 -0
  31. package/dist/components/Sheet/Sheet.d.ts +10 -0
  32. package/dist/components/Sheet/Sheet.d.ts.map +1 -1
  33. package/dist/components/Sheet/index.d.ts +1 -1
  34. package/dist/components/Sheet/index.d.ts.map +1 -1
  35. package/dist/components/TimezonePicker/TimezonePicker.d.ts +9 -0
  36. package/dist/components/TimezonePicker/TimezonePicker.d.ts.map +1 -1
  37. package/dist/components/TimezonePicker/index.d.ts +1 -1
  38. package/dist/components/TimezonePicker/index.d.ts.map +1 -1
  39. package/dist/index.cjs +17749 -14481
  40. package/dist/index.cjs.map +1 -1
  41. package/dist/index.d.ts +3 -1
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +14851 -11654
  44. package/dist/index.js.map +1 -1
  45. package/dist/notifications/components/AlertConditionComposer/AlertConditionComposer.d.ts +38 -0
  46. package/dist/notifications/components/AlertConditionComposer/AlertConditionComposer.d.ts.map +1 -0
  47. package/dist/notifications/components/DeliveryFrequencyControl/DeliveryFrequencyControl.d.ts +33 -0
  48. package/dist/notifications/components/DeliveryFrequencyControl/DeliveryFrequencyControl.d.ts.map +1 -0
  49. package/dist/notifications/components/EventCatalogPicker/EventCatalogPicker.d.ts +34 -0
  50. package/dist/notifications/components/EventCatalogPicker/EventCatalogPicker.d.ts.map +1 -0
  51. package/dist/notifications/components/NotificationBell/NotificationBell.d.ts +47 -0
  52. package/dist/notifications/components/NotificationBell/NotificationBell.d.ts.map +1 -0
  53. package/dist/notifications/components/NotificationChannelCard/NotificationChannelCard.d.ts +39 -0
  54. package/dist/notifications/components/NotificationChannelCard/NotificationChannelCard.d.ts.map +1 -0
  55. package/dist/notifications/components/NotificationChannelDialog/NotificationChannelDialog.d.ts +48 -0
  56. package/dist/notifications/components/NotificationChannelDialog/NotificationChannelDialog.d.ts.map +1 -0
  57. package/dist/notifications/components/NotificationChannelForm/NotificationChannelForm.d.ts +55 -0
  58. package/dist/notifications/components/NotificationChannelForm/NotificationChannelForm.d.ts.map +1 -0
  59. package/dist/notifications/components/NotificationChannelList/NotificationChannelList.d.ts +31 -0
  60. package/dist/notifications/components/NotificationChannelList/NotificationChannelList.d.ts.map +1 -0
  61. package/dist/notifications/components/NotificationDetailDialog/NotificationDetailDialog.d.ts +30 -0
  62. package/dist/notifications/components/NotificationDetailDialog/NotificationDetailDialog.d.ts.map +1 -0
  63. package/dist/notifications/components/NotificationInbox/NotificationInbox.d.ts +65 -0
  64. package/dist/notifications/components/NotificationInbox/NotificationInbox.d.ts.map +1 -0
  65. package/dist/notifications/components/NotificationPreferenceMatrix/NotificationPreferenceMatrix.d.ts +37 -0
  66. package/dist/notifications/components/NotificationPreferenceMatrix/NotificationPreferenceMatrix.d.ts.map +1 -0
  67. package/dist/notifications/components/NotificationRuleEditor/NotificationRuleEditor.d.ts +52 -0
  68. package/dist/notifications/components/NotificationRuleEditor/NotificationRuleEditor.d.ts.map +1 -0
  69. package/dist/notifications/components/NotificationRuleList/NotificationRuleList.d.ts +37 -0
  70. package/dist/notifications/components/NotificationRuleList/NotificationRuleList.d.ts.map +1 -0
  71. package/dist/notifications/components/meta.d.ts +32 -0
  72. package/dist/notifications/components/meta.d.ts.map +1 -0
  73. package/dist/notifications/engine/catalog.d.ts +27 -0
  74. package/dist/notifications/engine/catalog.d.ts.map +1 -0
  75. package/dist/notifications/engine/channels.d.ts +31 -0
  76. package/dist/notifications/engine/channels.d.ts.map +1 -0
  77. package/dist/notifications/engine/describeRule.d.ts +44 -0
  78. package/dist/notifications/engine/describeRule.d.ts.map +1 -0
  79. package/dist/notifications/engine/inbox.d.ts +29 -0
  80. package/dist/notifications/engine/inbox.d.ts.map +1 -0
  81. package/dist/notifications/engine/preferences.d.ts +48 -0
  82. package/dist/notifications/engine/preferences.d.ts.map +1 -0
  83. package/dist/notifications/index.d.ts +34 -0
  84. package/dist/notifications/index.d.ts.map +1 -0
  85. package/dist/notifications/types.d.ts +236 -0
  86. package/dist/notifications/types.d.ts.map +1 -0
  87. package/dist/styles.css +1 -1
  88. package/dist/workflow.cjs +25 -1
  89. package/dist/workflow.cjs.map +1 -1
  90. package/dist/workflow.js +1 -1
  91. package/package.json +1 -1
@@ -0,0 +1,32 @@
1
+ import type { ReactNode } from "react";
2
+ import type { BadgeVariant } from "../../components/Badge";
3
+ import type { NotificationChannelStatus, NotificationChannelType, NotificationSeverity, PersonalChannel } from "../types";
4
+ export interface ChannelTypeMeta {
5
+ label: string;
6
+ /** Short helper shown under the type in the picker. */
7
+ hint: string;
8
+ /** Backed by a connected app instance (OAuth) rather than typed in. */
9
+ connected: boolean;
10
+ icon: ReactNode;
11
+ }
12
+ /**
13
+ * Display metadata per channel type. Hosts can override the icon per channel
14
+ * via `NotificationChannel`-level props where a brand mark is available; the
15
+ * defaults use the icon set's generic marks so nothing here depends on a logo
16
+ * the icon package does not ship.
17
+ */
18
+ export declare const CHANNEL_TYPE_META: Record<NotificationChannelType, ChannelTypeMeta>;
19
+ export declare const PERSONAL_CHANNEL_META: Record<PersonalChannel, {
20
+ label: string;
21
+ icon: ReactNode;
22
+ }>;
23
+ export declare const CHANNEL_STATUS_META: Record<NotificationChannelStatus, {
24
+ label: string;
25
+ variant: BadgeVariant;
26
+ }>;
27
+ export declare const SEVERITY_META: Record<NotificationSeverity, {
28
+ label: string;
29
+ variant: BadgeVariant;
30
+ icon: ReactNode;
31
+ }>;
32
+ //# sourceMappingURL=meta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/notifications/components/meta.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EACV,yBAAyB,EACzB,uBAAuB,EACvB,oBAAoB,EACpB,eAAe,EAChB,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,SAAS,CAAC;CACjB;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,uBAAuB,EAAE,eAAe,CA2C9E,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,eAAe,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,SAAS,CAAA;CAAE,CAI7F,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,MAAM,CACtC,yBAAyB,EACzB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,YAAY,CAAA;CAAE,CAMzC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,MAAM,CAChC,oBAAoB,EACpB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,SAAS,CAAA;CAAE,CAiB1D,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { NotificationAudience, NotificationEventCategory, NotificationEventDefinition } from "../types";
2
+ /**
3
+ * The platform event catalogue, shipped as data so the rule picker, the
4
+ * personal matrix and the inbox agree on labels, severity and audience.
5
+ *
6
+ * Hosts may serve a filtered copy from the API (to hide rows a deployment
7
+ * cannot emit yet) but the SHAPE is fixed here. Keys are stable identifiers;
8
+ * renaming one is a migration.
9
+ *
10
+ * Research: Octaviaflow-Docs/Research/notification-center-v2-configurable-alerting.md §4.2
11
+ */
12
+ export declare const DEFAULT_NOTIFICATION_CATALOG: NotificationEventCategory[];
13
+ /** Every event in the catalogue, in display order. */
14
+ export declare function flattenCatalog(catalog: NotificationEventCategory[]): NotificationEventDefinition[];
15
+ /** Lookup by key; `undefined` for keys the catalogue does not know. */
16
+ export declare function findEvent(catalog: NotificationEventCategory[], key: string): NotificationEventDefinition | undefined;
17
+ /**
18
+ * The catalogue narrowed to the given audiences, dropping categories that end
19
+ * up empty. Used by the rule picker (org + admin) and the personal matrix
20
+ * (user + org, plus admin for admins).
21
+ */
22
+ export declare function filterCatalog(catalog: NotificationEventCategory[], audiences: readonly NotificationAudience[]): NotificationEventCategory[];
23
+ /** Audiences visible on the PERSONAL matrix for a member vs an admin. */
24
+ export declare function personalAudiences(isAdmin: boolean): NotificationAudience[];
25
+ /** Audiences an ORG rule may subscribe to — never personal events. */
26
+ export declare const RULE_AUDIENCES: readonly NotificationAudience[];
27
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/notifications/engine/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,yBAAyB,EACzB,2BAA2B,EAC5B,MAAM,UAAU,CAAC;AAElB;;;;;;;;;GASG;AACH,eAAO,MAAM,4BAA4B,EAAE,yBAAyB,EAkWnE,CAAC;AAEF,sDAAsD;AACtD,wBAAgB,cAAc,CAC5B,OAAO,EAAE,yBAAyB,EAAE,GACnC,2BAA2B,EAAE,CAE/B;AAED,uEAAuE;AACvE,wBAAgB,SAAS,CACvB,OAAO,EAAE,yBAAyB,EAAE,EACpC,GAAG,EAAE,MAAM,GACV,2BAA2B,GAAG,SAAS,CAMzC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,yBAAyB,EAAE,EACpC,SAAS,EAAE,SAAS,oBAAoB,EAAE,GACzC,yBAAyB,EAAE,CAK7B;AAED,yEAAyE;AACzE,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,oBAAoB,EAAE,CAE1E;AAED,sEAAsE;AACtE,eAAO,MAAM,cAAc,EAAE,SAAS,oBAAoB,EAAqB,CAAC"}
@@ -0,0 +1,31 @@
1
+ import type { ConnectedAppInstance, NotificationChannel, NotificationChannelDraft, NotificationChannelType } from "../types";
2
+ export type ChannelDraftField = "label" | "instanceId" | "target" | "recipients" | "url";
3
+ export type ChannelDraftErrors = Partial<Record<ChannelDraftField, string>>;
4
+ /** Types backed by a connected app instance rather than typed-in details. */
5
+ export declare const CONNECTED_CHANNEL_TYPES: readonly NotificationChannelType[];
6
+ export declare function isValidEmail(value: string): boolean;
7
+ export declare function isValidWebhookUrl(value: string): boolean;
8
+ /**
9
+ * Field-level validation for a channel draft. Pure, so the dialog and the
10
+ * host's server can agree on what "complete" means.
11
+ *
12
+ * Messages are written for the form: short, in the second person, saying
13
+ * what to do rather than what is wrong.
14
+ */
15
+ export declare function validateChannelDraft(draft: NotificationChannelDraft): ChannelDraftErrors;
16
+ export declare function isChannelDraftComplete(draft: NotificationChannelDraft): boolean;
17
+ /**
18
+ * A default label when the user has not typed one — "#alerts · Acme Slack",
19
+ * "ops@acme.com", "hooks.example.com". Used as the placeholder AND as the
20
+ * value the dialog saves when the label is left empty, so a channel is
21
+ * never called "New channel".
22
+ */
23
+ export declare function suggestChannelLabel(draft: NotificationChannelDraft, instances?: readonly ConnectedAppInstance[], targetLabel?: string): string;
24
+ /**
25
+ * One line that says where messages will go — the confirmation under the
26
+ * form and the `target` a saved channel displays. Empty while incomplete.
27
+ */
28
+ export declare function describeChannelDraft(draft: NotificationChannelDraft, instances?: readonly ConnectedAppInstance[], targetLabel?: string): string;
29
+ /** Seed a draft from an existing channel (edit mode) or a type (create mode). */
30
+ export declare function draftFromChannel(channel: NotificationChannel | null | undefined, fallbackType?: NotificationChannelType): NotificationChannelDraft;
31
+ //# sourceMappingURL=channels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../../src/notifications/engine/channels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,YAAY,GAAG,QAAQ,GAAG,YAAY,GAAG,KAAK,CAAC;AAEzF,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,CAAC;AAE5E,6EAA6E;AAC7E,eAAO,MAAM,uBAAuB,EAAE,SAAS,uBAAuB,EAKrE,CAAC;AAIF,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAOxD;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,wBAAwB,GAAG,kBAAkB,CAsBxF;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAE/E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,wBAAwB,EAC/B,SAAS,GAAE,SAAS,oBAAoB,EAAO,EAC/C,WAAW,CAAC,EAAE,MAAM,GACnB,MAAM,CAsBR;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,wBAAwB,EAC/B,SAAS,GAAE,SAAS,oBAAoB,EAAO,EAC/C,WAAW,CAAC,EAAE,MAAM,GACnB,MAAM,CAsBR;AAED,iFAAiF;AACjF,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,EAC/C,YAAY,GAAE,uBAAiC,GAC9C,wBAAwB,CAa1B"}
@@ -0,0 +1,44 @@
1
+ import type { AlertCondition, DeliveryPolicy, NotificationChannel, NotificationEventCategory, NotificationRule, Throttle } from "../types";
2
+ /**
3
+ * "5 minutes", "an hour", "2 hours", "a day", "3 days".
4
+ *
5
+ * Minutes are the storage unit for every window, cooldown and re-notify
6
+ * field, so one formatter keeps every surface saying the same thing for the
7
+ * same number.
8
+ */
9
+ export declare function formatMinutes(minutes: number): string;
10
+ /**
11
+ * Article-free form for use after "every" — "every hour", "every 2 hours",
12
+ * "every day", "every 15 minutes". `formatMinutes` reads right after "in";
13
+ * this one reads right after "every". Mixing them produces "every an hour".
14
+ */
15
+ export declare function formatEvery(minutes: number): string;
16
+ /** Lower-case clause for the events of a rule — "a run fails or an app needs re-authentication". */
17
+ export declare function describeEvents(eventKeys: readonly string[], catalog: NotificationEventCategory[]): string;
18
+ /** Clause appended to the events — "" | " (on status change)" | " after 3 failures in a row" | " 5 times in 10 minutes". */
19
+ export declare function describeCondition(condition: AlertCondition, subjectNoun?: string): string;
20
+ /** Adverbial clause — "immediately" | "in batches every 15 minutes" | "in a digest every Monday at 09:00 (Asia/Kolkata)". */
21
+ export declare function describeDelivery(delivery: DeliveryPolicy): string;
22
+ /** Trailing clauses for cooldown / re-notify, each starting with ", ". */
23
+ export declare function describeThrottle(throttle: Throttle | undefined, subjectNoun?: string): string;
24
+ /** Channel labels joined — "#ops and ops@acme.com" | "no channel yet". */
25
+ export declare function describeChannels(channelIds: readonly string[], channels: readonly NotificationChannel[]): string;
26
+ /**
27
+ * The subject noun the rule is about, taken from the first selected event
28
+ * that declares one. Rules mixing flows and apps fall back to "item".
29
+ */
30
+ export declare function ruleSubjectNoun(eventKeys: readonly string[], catalog: NotificationEventCategory[]): string;
31
+ /**
32
+ * One sentence for the whole rule:
33
+ *
34
+ * "When an app needs re-authentication after 2 failures in a row for the
35
+ * same app, notify #ops and ops@acme.com immediately, at most once every
36
+ * hour per app."
37
+ *
38
+ * A rule assembled from eight controls is easy to build wrong and hard to
39
+ * re-read; echoing it in words is the same idea as `describeSchedule`, and
40
+ * every surface that shows a rule (editor header, list row, confirmation)
41
+ * uses this one function so the phrasing cannot drift.
42
+ */
43
+ export declare function describeRule(rule: Pick<NotificationRule, "events" | "channelIds" | "condition" | "delivery" | "throttle">, catalog: NotificationEventCategory[], channels: readonly NotificationChannel[]): string;
44
+ //# sourceMappingURL=describeRule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"describeRule.d.ts","sourceRoot":"","sources":["../../../src/notifications/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
1
+ import type { InboxAction, InboxFilter, InboxItem, NotificationEventCategory } from "../types";
2
+ /**
3
+ * What a click on this item should do.
4
+ *
5
+ * Precedence: the item's own `action` · the event's catalogue default ·
6
+ * `link` when the subject has an href · `modal`. A `link` with nowhere to go
7
+ * degrades to `modal` rather than to a dead row. CTA copy and href are
8
+ * filled in from the subject and the catalogue so the dialog always has a
9
+ * primary action when one is possible.
10
+ */
11
+ export declare function resolveInboxAction(item: InboxItem, catalog?: NotificationEventCategory[]): InboxAction;
12
+ export declare function isUnread(item: InboxItem): boolean;
13
+ export declare function isArchived(item: InboxItem): boolean;
14
+ /** Items matching a filter, newest first. `all` excludes archived items. */
15
+ export declare function filterInbox(items: readonly InboxItem[], filter: InboxFilter): InboxItem[];
16
+ export declare function countUnread(items: readonly InboxItem[]): number;
17
+ export interface InboxDayGroup {
18
+ /** "Today" | "Yesterday" | a locale date. */
19
+ label: string;
20
+ /** `YYYY-MM-DD` in local time — stable key for rendering. */
21
+ key: string;
22
+ items: InboxItem[];
23
+ }
24
+ /**
25
+ * Group items by local calendar day, preserving the input order inside each
26
+ * group. `now` is injectable so stories and tests are deterministic.
27
+ */
28
+ export declare function groupInboxByDay(items: readonly InboxItem[], now?: number): InboxDayGroup[];
29
+ //# sourceMappingURL=inbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbox.d.ts","sourceRoot":"","sources":["../../../src/notifications/engine/inbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAG/F;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,SAAS,EACf,OAAO,CAAC,EAAE,yBAAyB,EAAE,GACpC,WAAW,CAeb;AAQD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAEjD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAEnD;AAED,4EAA4E;AAC5E,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,EAAE,MAAM,EAAE,WAAW,GAAG,SAAS,EAAE,CAYzF;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,GAAG,MAAM,CAE/D;AAED,MAAM,WAAW,aAAa;IAC5B,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,SAAS,EAAE,CAAC;CACpB;AAUD;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,GAAG,GAAE,MAAmB,GACvB,aAAa,EAAE,CA2BjB"}
@@ -0,0 +1,48 @@
1
+ import type { NotificationEventCategory, NotificationEventDefinition, NotificationPreferences, PersonalChannel } from "../types";
2
+ /**
3
+ * Channels that count towards "a critical event still reaches you". Slack DM
4
+ * is deliberately excluded: a DM depends on a Slack token that can die, which
5
+ * is the exact failure these events exist to report.
6
+ */
7
+ export declare const CRITICAL_CHANNELS: readonly PersonalChannel[];
8
+ /** The value a cell has when the user has never touched it. */
9
+ export declare function defaultPreference(def: NotificationEventDefinition, channel: PersonalChannel): boolean;
10
+ /** Resolve a cell — the stored value, else the catalogue default. */
11
+ export declare function isPreferenceEnabled(prefs: NotificationPreferences, def: NotificationEventDefinition, channel: PersonalChannel): boolean;
12
+ /** Fresh preferences with an empty matrix — every cell resolves to its default. */
13
+ export declare function defaultPreferences(emailFrequency?: NotificationPreferences["emailFrequency"]): NotificationPreferences;
14
+ export interface SetPreferenceResult {
15
+ next: NotificationPreferences;
16
+ /**
17
+ * `true` when the toggle was refused because it would have left a critical
18
+ * event with no channel. `next` is then the unchanged input.
19
+ */
20
+ blocked: boolean;
21
+ }
22
+ /**
23
+ * Toggle one cell with the critical-row guard applied.
24
+ *
25
+ * A critical event may lose any one channel but never the last one; the
26
+ * matrix shows a lock on that last cell and this function is the reason the
27
+ * lock is honest. The same rule is enforced server-side — this is the
28
+ * client's copy so the UI never has to round-trip to learn it was refused.
29
+ */
30
+ export declare function setPreference(prefs: NotificationPreferences, catalog: NotificationEventCategory[], eventKey: string, channel: PersonalChannel, enabled: boolean): SetPreferenceResult;
31
+ /**
32
+ * Whether turning this cell OFF would be refused. The matrix uses it to
33
+ * render the lock before the user clicks, rather than after.
34
+ */
35
+ export declare function isPreferenceLocked(prefs: NotificationPreferences, def: NotificationEventDefinition, channel: PersonalChannel): boolean;
36
+ /**
37
+ * Set every event in a category to `enabled` on one channel, honouring the
38
+ * guard per row. Returns how many rows were refused so the UI can say so.
39
+ */
40
+ export declare function setCategoryPreference(prefs: NotificationPreferences, catalog: NotificationEventCategory[], categoryId: string, channel: PersonalChannel, enabled: boolean): {
41
+ next: NotificationPreferences;
42
+ blockedCount: number;
43
+ };
44
+ /** "all" | "none" | "some" for a category column — drives the header checkbox. */
45
+ export declare function categoryColumnState(prefs: NotificationPreferences, category: NotificationEventCategory, channel: PersonalChannel): "all" | "none" | "some";
46
+ /** Count of enabled cells per channel across the catalogue — for summaries. */
47
+ export declare function countEnabled(prefs: NotificationPreferences, catalog: NotificationEventCategory[], channel: PersonalChannel): number;
48
+ //# sourceMappingURL=preferences.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preferences.d.ts","sourceRoot":"","sources":["../../../src/notifications/engine/preferences.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,2BAA2B,EAC3B,uBAAuB,EACvB,eAAe,EAChB,MAAM,UAAU,CAAC;AAGlB;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,eAAe,EAAwB,CAAC;AAEjF,+DAA+D;AAC/D,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,2BAA2B,EAChC,OAAO,EAAE,eAAe,GACvB,OAAO,CAUT;AAED,qEAAqE;AACrE,wBAAgB,mBAAmB,CACjC,KAA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 * Two configuration layers over one event catalogue:
5
+ * • org rules (what × where × when, thresholds, throttles) → shared channels
6
+ * • personal preferences (event × personal channel matrix) → inbox / email
7
+ * plus the always-on in-app inbox and its bell.
8
+ *
9
+ * Pure logic lives in `engine/` (tested, no React); components compose the
10
+ * existing primitives and stay controlled — the host owns every draft.
11
+ *
12
+ * Docs: Octaviaflow-Docs/Design-System/Notifications/implementation/notification-center-components.md
13
+ */
14
+ export { AlertConditionComposer, type AlertConditionComposerProps, type AlertConditionKind, } from "./components/AlertConditionComposer/AlertConditionComposer";
15
+ export { DeliveryFrequencyControl, type DeliveryFrequencyControlProps, } from "./components/DeliveryFrequencyControl/DeliveryFrequencyControl";
16
+ export { EventCatalogPicker, type EventCatalogPickerProps, } from "./components/EventCatalogPicker/EventCatalogPicker";
17
+ export { CHANNEL_STATUS_META, CHANNEL_TYPE_META, type ChannelTypeMeta, PERSONAL_CHANNEL_META, SEVERITY_META, } from "./components/meta";
18
+ export { NotificationBell, type NotificationBellProps, } from "./components/NotificationBell/NotificationBell";
19
+ export { type ChannelTestResult, NotificationChannelCard, type NotificationChannelCardProps, } from "./components/NotificationChannelCard/NotificationChannelCard";
20
+ export { NotificationChannelDialog, type NotificationChannelDialogProps, } from "./components/NotificationChannelDialog/NotificationChannelDialog";
21
+ export { type ChannelFormField, NotificationChannelForm, type NotificationChannelFormProps, } from "./components/NotificationChannelForm/NotificationChannelForm";
22
+ export { NotificationChannelList, type NotificationChannelListProps, } from "./components/NotificationChannelList/NotificationChannelList";
23
+ export { NotificationDetailDialog, type NotificationDetailDialogProps, } from "./components/NotificationDetailDialog/NotificationDetailDialog";
24
+ export { NotificationInbox, type NotificationInboxProps, } from "./components/NotificationInbox/NotificationInbox";
25
+ export { NotificationPreferenceMatrix, type NotificationPreferenceMatrixProps, type PersonalChannelColumn, } from "./components/NotificationPreferenceMatrix/NotificationPreferenceMatrix";
26
+ export { createEmptyRule, NotificationRuleEditor, type NotificationRuleEditorProps, type RuleFormField, type RuleScopeOptions, ruleUsesAdvanced, } from "./components/NotificationRuleEditor/NotificationRuleEditor";
27
+ export { NotificationRuleList, type NotificationRuleListProps, type RuleStarter, } from "./components/NotificationRuleList/NotificationRuleList";
28
+ export { DEFAULT_NOTIFICATION_CATALOG, filterCatalog, findEvent, flattenCatalog, personalAudiences, RULE_AUDIENCES, } from "./engine/catalog";
29
+ export { type ChannelDraftErrors, type ChannelDraftField, CONNECTED_CHANNEL_TYPES, describeChannelDraft, draftFromChannel, isChannelDraftComplete, isValidEmail, isValidWebhookUrl, suggestChannelLabel, validateChannelDraft, } from "./engine/channels";
30
+ export { describeChannels, describeCondition, describeDelivery, describeEvents, describeRule, describeThrottle, formatEvery, formatMinutes, ruleSubjectNoun, } from "./engine/describeRule";
31
+ export { countUnread, filterInbox, groupInboxByDay, type InboxDayGroup, isArchived, isUnread, resolveInboxAction, } from "./engine/inbox";
32
+ export { CRITICAL_CHANNELS, categoryColumnState, countEnabled, defaultPreference, defaultPreferences, isPreferenceEnabled, isPreferenceLocked, type SetPreferenceResult, setCategoryPreference, setPreference, } from "./engine/preferences";
33
+ export type { AlertCondition, ConnectedAppInstance, DeliveryMode, DeliveryPolicy, DeliveryStatus, EmailFrequency, InboxAction, InboxActionKind, InboxDetail, InboxFilter, InboxItem, InboxSubject, NotificationAudience, NotificationChannel, NotificationChannelDraft, NotificationChannelStatus, NotificationChannelType, NotificationDelivery, NotificationEventCategory, NotificationEventDefinition, NotificationPreferences, NotificationRule, NotificationSeverity, PersonalChannel, QuietHours, RuleScope, Throttle, } from "./types";
34
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notifications/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,sBAAsB,EACtB,KAAK,2BAA2B,EAChC,KAAK,kBAAkB,GACxB,MAAM,4DAA4D,CAAC;AACpE,OAAO,EACL,wBAAwB,EACxB,KAAK,6BA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B,EACvB,KAAK,iBAAiB,EACtB,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,WAAW,EACX,WAAW,EACX,eAAe,EACf,KAAK,aAAa,EAClB,UAAU,EACV,QAAQ,EACR,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,mBAAmB,EACxB,qBAAqB,EACrB,aAAa,GACd,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,cAAc,EACd,WAAW,EACX,eAAe,EACf,WAAW,EACX,WAAW,EACX,SAAS,EACT,YAAY,EACZ,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,EACvB,oBAAoB,EACpB,yBAAyB,EACzB,2BAA2B,EAC3B,uBAAuB,EACvB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,UAAU,EACV,SAAS,EACT,QAAQ,GACT,MAAM,SAAS,CAAC"}
@@ -0,0 +1,236 @@
1
+ import type { ScheduleValue } from "../components/ScheduleBuilder";
2
+ import type { TimeValue } from "../components/TimePicker";
3
+ export type NotificationSeverity = "info" | "warning" | "error";
4
+ /**
5
+ * Who an event is *for*.
6
+ *
7
+ * - `user` — personal to one account ("someone signed in as you"). Only ever
8
+ * delivered through personal preferences, never to a shared channel.
9
+ * - `admin` — org-level but only meaningful to workspace admins (billing,
10
+ * membership). Eligible for org rules and for admins' personal matrix.
11
+ * - `org` — org-level, relevant to every member (runs, connectors).
12
+ */
13
+ export type NotificationAudience = "user" | "admin" | "org";
14
+ export interface NotificationEventDefinition {
15
+ /** Stable key, `<domain>.<event>` — e.g. `connector.auth_failed`. */
16
+ key: string;
17
+ /** Short label for pickers and matrix rows — "App needs re-authentication". */
18
+ label: string;
19
+ /**
20
+ * Lower-case clause used inside generated sentences — "an app needs
21
+ * re-authentication". Falls back to the lower-cased label when omitted.
22
+ */
23
+ phrase?: string;
24
+ description?: string;
25
+ severity: NotificationSeverity;
26
+ audience: NotificationAudience;
27
+ /**
28
+ * Cannot be silenced on every personal channel at once. A user may drop one
29
+ * channel but never the last one — the guard in `engine/preferences` refuses
30
+ * the toggle and the matrix shows a lock.
31
+ */
32
+ critical?: boolean;
33
+ /** The rule condition composer offers "after N in a row" / "N in W" for it. */
34
+ threshold?: boolean;
35
+ /** Noun for the subject of a threshold — "app", "flow", "account". */
36
+ subjectNoun?: string;
37
+ /** Personal-matrix defaults for a fresh account. Both default to `true`. */
38
+ defaultInApp?: boolean;
39
+ defaultEmail?: boolean;
40
+ /**
41
+ * Default click behaviour for this event's inbox items. Security events
42
+ * open the detail dialog (there is something to read and a decision to
43
+ * make); operational events link straight to their subject.
44
+ */
45
+ onClick?: InboxActionKind;
46
+ /** CTA copy for the default action — "Review sessions", "Open run". */
47
+ actionLabel?: string;
48
+ }
49
+ export interface NotificationEventCategory {
50
+ id: string;
51
+ label: string;
52
+ description?: string;
53
+ events: NotificationEventDefinition[];
54
+ }
55
+ export type NotificationChannelType = "in_app" | "email" | "slack" | "teams" | "google_chat" | "whatsapp" | "webhook";
56
+ /**
57
+ * `verified` — a test send succeeded at least once.
58
+ * `unverified` — never tested; the single most common support issue for this
59
+ * feature class, which is why it is a first-class state and not a `null`.
60
+ * `failing` — the last delivery attempt failed.
61
+ * `disabled` — switched off by the user; kept so rules that reference it are
62
+ * not silently broken.
63
+ */
64
+ export type NotificationChannelStatus = "verified" | "unverified" | "failing" | "disabled";
65
+ export interface NotificationChannel {
66
+ id: string;
67
+ type: NotificationChannelType;
68
+ /** User-given name — "Ops — #alerts". */
69
+ label: string;
70
+ /** Where it posts: `#alerts`, `ops@acme.com`, a space name, a URL. */
71
+ target?: string;
72
+ /** The connected app instance backing a chat channel — "Acme Slack". */
73
+ instanceLabel?: string;
74
+ status: NotificationChannelStatus;
75
+ enabled: boolean;
76
+ lastDeliveryAt?: string | Date | null;
77
+ lastError?: string | null;
78
+ }
79
+ /** What the channel form edits. `id` is absent until the host persists it. */
80
+ export interface NotificationChannelDraft {
81
+ id?: string;
82
+ type: NotificationChannelType;
83
+ label: string;
84
+ /** Connected app instance id for slack / teams / google_chat / whatsapp. */
85
+ instanceId?: string;
86
+ /** Channel id / space / phone — chosen from host-supplied options or typed. */
87
+ target?: string;
88
+ /** Email recipients. */
89
+ recipients?: string[];
90
+ /** Webhook URL. */
91
+ url?: string;
92
+ }
93
+ export interface ConnectedAppInstance {
94
+ id: string;
95
+ type: NotificationChannelType;
96
+ label: string;
97
+ /** Optional secondary line — workspace / tenant name. */
98
+ meta?: string;
99
+ }
100
+ /**
101
+ * When is an occurrence worth telling anyone about. Evaluated per SUBJECT
102
+ * (one flow, one app, one account) — "3 failures" always means three failures
103
+ * of the same thing.
104
+ */
105
+ export type AlertCondition = {
106
+ kind: "every";
107
+ } | {
108
+ kind: "state_change";
109
+ } | {
110
+ kind: "consecutive";
111
+ count: number;
112
+ } | {
113
+ kind: "count";
114
+ count: number;
115
+ windowMinutes: number;
116
+ };
117
+ export type DeliveryMode = "immediate" | "batched" | "digest";
118
+ export interface DeliveryPolicy {
119
+ mode: DeliveryMode;
120
+ /** `batched`: hold and merge occurrences for this long before one send. */
121
+ batchWindowMinutes?: number;
122
+ /** `digest`: the recurrence, with an IANA zone. */
123
+ schedule?: ScheduleValue;
124
+ /** `digest`: send even when nothing happened. Off by default on purpose. */
125
+ includeEmpty?: boolean;
126
+ }
127
+ export interface Throttle {
128
+ /** At most one message per subject per channel in this window. */
129
+ cooldownMinutes?: number;
130
+ /** Repeat while the subject is still failing. Off unless set. */
131
+ renotifyMinutes?: number;
132
+ }
133
+ export interface QuietHours {
134
+ enabled: boolean;
135
+ start: TimeValue;
136
+ end: TimeValue;
137
+ /** IANA zone. */
138
+ timezone?: string;
139
+ /** 0 = Sunday … 6 = Saturday. Empty / omitted = every day. */
140
+ weekdays?: number[];
141
+ }
142
+ export interface RuleScope {
143
+ flowIds?: string[];
144
+ connectorIds?: string[];
145
+ }
146
+ export interface NotificationRule {
147
+ id?: string;
148
+ name: string;
149
+ enabled: boolean;
150
+ /** Catalogue keys. */
151
+ events: string[];
152
+ channelIds: string[];
153
+ condition: AlertCondition;
154
+ delivery: DeliveryPolicy;
155
+ throttle?: Throttle;
156
+ quietHours?: QuietHours;
157
+ scope?: RuleScope;
158
+ minSeverity?: NotificationSeverity;
159
+ lastFiredAt?: string | Date | null;
160
+ }
161
+ export type PersonalChannel = "in_app" | "email" | "slack_dm";
162
+ export type EmailFrequency = "immediate" | "hourly" | "daily";
163
+ export interface NotificationPreferences {
164
+ /** eventKey → channel → enabled. Missing entries mean "use the default". */
165
+ matrix: Record<string, Partial<Record<PersonalChannel, boolean>>>;
166
+ emailFrequency: EmailFrequency;
167
+ /** `daily` only. */
168
+ digestTime?: TimeValue;
169
+ /** IANA zone for `digestTime`. */
170
+ timezone?: string;
171
+ }
172
+ export interface InboxSubject {
173
+ kind: string;
174
+ label: string;
175
+ href?: string;
176
+ }
177
+ /**
178
+ * What happens when a notification is clicked.
179
+ *
180
+ * - `link` — navigate to `href` (the row renders as an anchor).
181
+ * - `modal` — open the built-in detail dialog (full body, details, CTA).
182
+ * - `panel` — the host opens its own side panel / drawer via `onOpen`.
183
+ * - `callback` — the host handles it entirely via `onOpen`.
184
+ * - `none` — inert; only marks read.
185
+ *
186
+ * Resolved per item by `resolveInboxAction`: an explicit `item.action` wins,
187
+ * then the event's catalogue default, then `link` when the subject has an
188
+ * href, then `modal`.
189
+ */
190
+ export type InboxActionKind = "link" | "modal" | "panel" | "callback" | "none";
191
+ export interface InboxAction {
192
+ kind: InboxActionKind;
193
+ /** `link`: where to go. Also used as the modal's primary CTA when present. */
194
+ href?: string;
195
+ /** CTA copy — "Open run", "Reconnect app", "Review sessions". */
196
+ label?: string;
197
+ /** `link`: open in a new tab. */
198
+ external?: boolean;
199
+ }
200
+ export interface InboxDetail {
201
+ label: string;
202
+ value: string;
203
+ }
204
+ export interface InboxItem {
205
+ id: string;
206
+ eventKey: string;
207
+ title: string;
208
+ body?: string;
209
+ severity: NotificationSeverity;
210
+ createdAt: string | Date;
211
+ readAt?: string | Date | null;
212
+ archivedAt?: string | Date | null;
213
+ subject?: InboxSubject;
214
+ /** Where it came from — "Salesforce CRM", "Nightly sync". */
215
+ source?: string;
216
+ /** Per-item click behaviour; overrides the event's catalogue default. */
217
+ action?: InboxAction;
218
+ /** Key facts shown in the detail dialog — device, IP, step, error code. */
219
+ details?: InboxDetail[];
220
+ }
221
+ export type InboxFilter = "all" | "unread" | "archived";
222
+ export type DeliveryStatus = "sent" | "failed" | "pending" | "suppressed" | "degraded";
223
+ export interface NotificationDelivery {
224
+ id: string;
225
+ eventKey: string;
226
+ subjectLabel?: string;
227
+ ruleName?: string;
228
+ channelLabel: string;
229
+ channelType: NotificationChannelType;
230
+ status: DeliveryStatus;
231
+ attempts?: number;
232
+ error?: string | null;
233
+ sentAt?: string | Date | null;
234
+ createdAt: string | Date;
235
+ }
236
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/notifications/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAM1D,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,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