@nivaro/react 0.1.215 → 0.1.217

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -939,6 +939,8 @@ export declare function deriveGroupKey<T extends QueueGroupingRow>(row: T, attri
939
939
 
940
940
  export declare function describeCron(cron: string): string;
941
941
 
942
+ declare type DigestFrequency = 'instant' | 'daily' | 'weekly';
943
+
942
944
  declare type DimensionCascadeRule = {
943
945
  /** Sibling dimension's field whose picked value drives this filter. */
944
946
  parent_field: string;
@@ -2362,6 +2364,12 @@ export declare type NavigationContextValue = {
2362
2364
  * admin shape `/users/:id`; return null = host has no such page, the
2363
2365
  * action is hidden instead of navigating into the host's 404 fallback. */
2364
2366
  userUrl?: (userId: string) => string | null;
2367
+ /** Route for an ADMIN CONSOLE page given its admin-shaped path
2368
+ * (`/notification-subscriptions`, `/pipelines/:id`). Absent = the path is
2369
+ * used as-is (the admin app); return null = the host has no such page and
2370
+ * the link is hidden. Headless hosts that embed the admin elsewhere can
2371
+ * return an absolute URL. */
2372
+ consoleUrl?: (adminPath: string) => string | null;
2365
2373
  };
2366
2374
 
2367
2375
  export declare function networkdaysBetween(a: Date, b: Date): number;
@@ -2469,7 +2477,26 @@ export declare function NotificationRulesCard(): JSX.Element;
2469
2477
  */
2470
2478
  export declare type NotificationSound = 'off' | 'subtle' | 'chime';
2471
2479
 
2472
- export declare function NotificationSourcesCard(): JSX.Element | null;
2480
+ export declare function NotificationSourcesCard({ only, bare }?: NotificationSourcesCardProps): JSX.Element | null;
2481
+
2482
+ declare interface NotificationSourcesCardProps {
2483
+ /** 'subscriptions' = only the two subscription sections (the My
2484
+ * Subscriptions page); default = every source + the History tab. */
2485
+ only?: 'subscriptions';
2486
+ /** Hide the card chrome (border, header, tab strip) — the host supplies its own. */
2487
+ bare?: boolean;
2488
+ }
2489
+
2490
+ /**
2491
+ * "My Subscriptions" as a full page: the profile's subscription sections
2492
+ * (same rows, same trigger/paused/criteria treatment) with create, edit,
2493
+ * pause, delivery + channel changes and removal — one component for the
2494
+ * admin console page and any headless host. Needs NivaroProvider (+ an
2495
+ * optional NavigationContext for the "Manage →" links).
2496
+ */
2497
+ export declare function NotificationSubscriptionsView({ title }: {
2498
+ title?: string;
2499
+ }): JSX.Element;
2473
2500
 
2474
2501
  export declare type NotificationTarget = {
2475
2502
  type: 'path';
@@ -3901,6 +3928,55 @@ export declare function startRum(opts?: {
3901
3928
  apiBase?: string;
3902
3929
  }): void;
3903
3930
 
3931
+ /**
3932
+ * The one subscription editor — create + edit for nivaro_notification_subscriptions,
3933
+ * shared by the profile's Notifications & alerts card and the My Subscriptions
3934
+ * page (admin hosts the same view). Every write goes through the user's own
3935
+ * /notification-subscriptions routes; both query keys that render
3936
+ * subscriptions are invalidated so the two surfaces never disagree.
3937
+ */
3938
+ declare const SUBSCRIPTION_EVENT_TYPES: readonly ["all", "create", "update", "delete", "workflow_transition"];
3939
+
3940
+ /** Create/edit dialog. `subscription` null = create; an object = edit it. */
3941
+ export declare function SubscriptionDialog({ open, onOpenChange, subscription, initial }: {
3942
+ open: boolean;
3943
+ onOpenChange: (open: boolean) => void;
3944
+ subscription?: SubscriptionRecord | null;
3945
+ /** Seed for a NEW subscription (e.g. a collection preselected by the caller). */
3946
+ initial?: Partial<SubscriptionFormState>;
3947
+ }): JSX.Element;
3948
+
3949
+ declare type SubscriptionEventType = (typeof SUBSCRIPTION_EVENT_TYPES)[number];
3950
+
3951
+ declare interface SubscriptionFormState {
3952
+ label: string;
3953
+ collection: string;
3954
+ event_type: SubscriptionEventType;
3955
+ filter_field: string;
3956
+ filter_value: string;
3957
+ filters_json: string;
3958
+ is_active: boolean;
3959
+ digest_frequency: DigestFrequency;
3960
+ notify_inapp: boolean;
3961
+ notify_email: boolean;
3962
+ }
3963
+
3964
+ declare interface SubscriptionRecord {
3965
+ id: number;
3966
+ collection: string | null;
3967
+ queue_id?: string | null;
3968
+ event_type: string;
3969
+ filter_field: string | null;
3970
+ filter_value: string | null;
3971
+ /** Parsed array, a JSON string (some list routes hand the raw column through), or null. */
3972
+ filters?: unknown;
3973
+ label: string | null;
3974
+ is_active: boolean | number;
3975
+ digest_frequency: string | null;
3976
+ notify_inapp?: boolean;
3977
+ notify_email?: boolean;
3978
+ }
3979
+
3904
3980
  declare type TabKey = 'catalog' | 'rules' | 'subscriptions' | 'history' | 'widget_alerts' | 'widget_alert_history' | 'anomaly_rules' | 'anomaly_history';
3905
3981
 
3906
3982
  export declare type TabState = {
@@ -4380,6 +4456,21 @@ attachments?: string[];
4380
4456
 
4381
4457
  export declare function useSessionRecorder(options?: SessionRecorderOptions): void;
4382
4458
 
4459
+ /** Mutations for the user's own subscriptions. Invalidates BOTH readers —
4460
+ * the flat list (My Subscriptions) and the profile's sources aggregate. */
4461
+ export declare function useSubscriptionMutations(): {
4462
+ create: UseMutationResult<unknown, Error, SubscriptionFormState, unknown>;
4463
+ update: UseMutationResult<unknown, Error, {
4464
+ id: number;
4465
+ form: SubscriptionFormState;
4466
+ }, unknown>;
4467
+ patchFields: UseMutationResult<unknown, Error, {
4468
+ id: number;
4469
+ body: Record<string, unknown>;
4470
+ }, unknown>;
4471
+ remove: UseMutationResult<unknown, Error, number, unknown>;
4472
+ };
4473
+
4383
4474
  export declare function useTabState(form: UseNivaroFormReturn): TabState;
4384
4475
 
4385
4476
  export declare function useTogglePin(room: string): UseMutationResult<unknown, Error, number, unknown>;