@nivaro/react 0.2.19 → 0.2.20

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
@@ -513,6 +513,10 @@ export declare interface BaseMapPin {
513
513
  pulse?: boolean;
514
514
  }
515
515
 
516
+ /** Turns clean mode on until the returned release runs (idempotent). Nested
517
+ * holders count; the mode ends when the last one releases. */
518
+ export declare function beginCleanRecording(): () => void;
519
+
516
520
  declare type BinaryOp = '+' | '-' | '*' | '/' | '==' | '!=' | '<' | '<=' | '>' | '>=' | '&&' | '||';
517
521
 
518
522
  declare interface Blur {
@@ -1050,6 +1054,25 @@ declare type CheckFrequency = 'hourly' | 'daily' | 'weekly';
1050
1054
  */
1051
1055
  export declare function choiceLabel(text: string | null | undefined): string;
1052
1056
 
1057
+ /**
1058
+ * Clean recording mode: while a help video records, the screen being recorded
1059
+ * hides what belongs to the author rather than the walkthrough (notification
1060
+ * counts, chat, toasts, banners, floating chips) and shows "Demo User" in place
1061
+ * of the author's own name, email and photo.
1062
+ *
1063
+ * Two halves:
1064
+ * - `<html data-nvr-recording-clean>` drives CSS: anything tagged
1065
+ * `data-nvr-recording-hide` disappears (`="keep-space"` keeps its box), and
1066
+ * Sonner's toaster is hidden by its own attribute. Hosts that cannot import
1067
+ * this module (a pinned package) read the attribute directly.
1068
+ * - `useCleanRecording()` / `useIsRecordingSelf()` for components that swap
1069
+ * content (a name, an avatar).
1070
+ *
1071
+ * The mode is held, never set: every holder releases on unmount, so a crash
1072
+ * or a closed recorder can never leave the page stuck hidden.
1073
+ */
1074
+ export declare const CLEAN_RECORDING_ATTR = "data-nvr-recording-clean";
1075
+
1053
1076
  /** Clear the schema cache (e.g. after a schema change). */
1054
1077
  export declare function clearFormSchemaCache(collection?: string): void;
1055
1078
 
@@ -1556,6 +1579,15 @@ declare interface DeliveryChipsProps {
1556
1579
  className?: string;
1557
1580
  }
1558
1581
 
1582
+ /** What the author reads as while a clean recording runs. */
1583
+ export declare const DEMO_USER: {
1584
+ readonly name: "Demo User";
1585
+ readonly first_name: "Demo";
1586
+ readonly last_name: "User";
1587
+ readonly initials: "DU";
1588
+ readonly email: "demo.user@example.com";
1589
+ };
1590
+
1559
1591
  export declare function deriveGroupKey<T extends QueueGroupingRow>(row: T, attribute: string): string;
1560
1592
 
1561
1593
  export declare function describeCron(cron: string): string;
@@ -1723,6 +1755,14 @@ export declare function dotsForRecord(rows: Array<{
1723
1755
  tone: 'positive' | 'warning' | 'danger' | 'neutral';
1724
1756
  }>;
1725
1757
 
1758
+ /** Ticketed download links (`attachment`), relative to the API origin. */
1759
+ declare interface DownloadUrls {
1760
+ video: string;
1761
+ /** Null when the video has no captions. */
1762
+ captions_vtt: string | null;
1763
+ captions_srt: string | null;
1764
+ }
1765
+
1726
1766
  declare type DrawerRelationConfig = string | {
1727
1767
  field: string;
1728
1768
  hint?: {
@@ -1785,6 +1825,8 @@ export declare function EmptyState({ icon: Icon, title, detail, action }: {
1785
1825
  /** `?prefill=` payload encoder — base64 of the JSON, URL-encoded. */
1786
1826
  export declare function encodePrefill(values: Record<string, unknown>): string;
1787
1827
 
1828
+ export declare function endHelpVideoWalk(): void;
1829
+
1788
1830
  export declare function ErpFailureBanner({ collection, itemId }: {
1789
1831
  collection: string;
1790
1832
  itemId: string;
@@ -2535,7 +2577,13 @@ export declare function helpVideoApi(client: NivaroClient): {
2535
2577
  description?: string | null;
2536
2578
  category?: string | null;
2537
2579
  visibility?: Visibility;
2580
+ /** Viewers may download (authors always may). */
2581
+ allow_downloads?: boolean;
2538
2582
  }) => Promise<HelpVideoDto>;
2583
+ /** A fresh ticketed download link (relative to the API origin). 403
2584
+ * HELP_VIDEO_DOWNLOAD_OFF when downloads are off for this viewer; `draft`
2585
+ * is for authors. */
2586
+ downloadLink: (id: string, file?: "video" | "captions.vtt" | "captions.srt", draft?: boolean) => Promise<string>;
2539
2587
  setContexts: (id: string, contexts: HelpVideoContext[]) => Promise<unknown>;
2540
2588
  setRequirements: (id: string, role_ids: string[]) => Promise<unknown>;
2541
2589
  archive: (id: string) => Promise<unknown>;
@@ -2576,13 +2624,32 @@ export declare function helpVideoApi(client: NivaroClient): {
2576
2624
  id: string;
2577
2625
  next_part: number;
2578
2626
  }>;
2627
+ /** Opens an upload for a video file someone picked. The server ignores the
2628
+ * browser's type: the first part's bytes decide the container (MP4/MOV or
2629
+ * WebM; 422 UPLOAD_NOT_VIDEO otherwise). 503 UPLOAD_NO_FFMPEG when the
2630
+ * server cannot read videos, 413 past 1.2 GB. */
2631
+ openFileUpload: (file: {
2632
+ name: string;
2633
+ size: number;
2634
+ type: string;
2635
+ }) => Promise<{
2636
+ id: string;
2637
+ next_part: number;
2638
+ }>;
2639
+ /** Closes a picked file's upload. The server checks (and if needed
2640
+ * converts) it in the background: poll uploadStatus until `finalized`. */
2641
+ finalizeFileUpload: (id: string) => Promise<{
2642
+ data: unknown;
2643
+ }>;
2644
+ uploadStatus: (id: string) => Promise<UploadRow>;
2579
2645
  /**
2580
2646
  * Closes an upload and stores the recorder's data with it, as given.
2581
2647
  * - `duration_ms`: recording time without pauses (the server prefers its
2582
2648
  * own probe of the file; 0 when unknown).
2583
2649
  * - `clicks`: `{ t_ms, x, y }` per click on the recorded tab: `t_ms` is
2584
- * recording time, `x`/`y` are fractions (0–1) of the captured frame.
2585
- * Null when clicks were not captured.
2650
+ * recording time, `x`/`y` are fractions (0–1) of the captured frame;
2651
+ * plus what was clicked (label, role, hook, page_key, path, origin —
2652
+ * see RecordedClick). Null when clicks were not captured.
2586
2653
  * - `levels`: microphone loudness, one number from 0 (silence) to 1 every
2587
2654
  * 100 ms of recording time (10 per second), so `levels[i]` covers
2588
2655
  * `i * 100` ms. Null without a microphone.
@@ -2597,17 +2664,13 @@ export declare function helpVideoApi(client: NivaroClient): {
2597
2664
  file_id: string;
2598
2665
  duration_ms: number | null;
2599
2666
  }>;
2600
- myUploads: () => Promise<{
2601
- id: string;
2602
- bytes_received: number;
2603
- next_part: number;
2604
- /** `open`, or `finalized`: uploaded but never saved as a video. */
2605
- status: string;
2606
- duration_ms: number | null;
2607
- created_at: string;
2608
- updated_at: string;
2609
- }[]>;
2667
+ myUploads: () => Promise<UploadRow[]>;
2610
2668
  abandonUpload: (id: string) => Promise<unknown>;
2669
+ /** The published version's walk steps (none for a draft-only video). */
2670
+ walk: (id: string) => Promise<{
2671
+ version_id: string | null;
2672
+ steps: WalkStep[];
2673
+ }>;
2611
2674
  registerPage: (key: string, label: string, app?: string) => Promise<unknown>;
2612
2675
  authorRoles: () => Promise<string[]>;
2613
2676
  setAuthorRoles: (ids: string[]) => Promise<unknown>;
@@ -2653,7 +2716,15 @@ export declare interface HelpVideoDto {
2653
2716
  /** The draft's original recording (already carries `source=1`). */
2654
2717
  draft_stream_url?: string | null;
2655
2718
  draft_captions_url?: string | null;
2719
+ /** Author-only: the "Allow downloads" switch (for viewers; authors always may). */
2720
+ allow_downloads?: boolean;
2721
+ /** Author-only: the draft's downloads (render when current, else the original). */
2722
+ draft_download_urls?: DownloadUrls | null;
2656
2723
  created_by_name?: string | null;
2724
+ /** Null when this person may not download the published version. A
2725
+ * viewer's video link answers 409 HELP_VIDEO_PROCESSING while
2726
+ * `published.playable` is false. */
2727
+ download_urls: DownloadUrls | null;
2657
2728
  updated_at: string;
2658
2729
  my_progress: HelpVideoProgress | null;
2659
2730
  }
@@ -2670,6 +2741,7 @@ export declare const helpVideoKeys: {
2670
2741
  library: (p: Record<string, unknown>) => readonly ["help-videos", "library", Record<string, unknown>];
2671
2742
  required: readonly ["help-videos", "required"];
2672
2743
  pages: readonly ["help-videos", "pages"];
2744
+ walk: (id: string) => readonly ["help-videos", "walk", string];
2673
2745
  /** The editor's draft load. Outside the `all` prefix on purpose: GET
2674
2746
  * /draft/edits creates a missing draft, so a broad invalidation must
2675
2747
  * never refetch it. `n` bumps on Reload. */
@@ -2701,6 +2773,8 @@ declare type HelpVideoPlayerProps = {
2701
2773
  trackProgress?: boolean;
2702
2774
  autoPlay?: boolean;
2703
2775
  handleRef?: MutableRefObject<PlayerHandle | null>;
2776
+ /** Start here (edited time) instead of the viewer's resume point. */
2777
+ startAtMs?: number | null;
2704
2778
  className?: string;
2705
2779
  /** Rendered in frame coordinates above the video, outside the zoom (editor tools). */
2706
2780
  children?: (frame: {
@@ -2755,7 +2829,7 @@ export declare function HelpVideoRecordingProvider({ children }: {
2755
2829
  children: ReactNode;
2756
2830
  }): JSX.Element;
2757
2831
 
2758
- export declare function HelpVideoSheet({ videoId, open, onOpenChange, upNext, onPick, returnFocusRef }: {
2832
+ export declare function HelpVideoSheet({ videoId, open, onOpenChange, upNext, onPick, returnFocusRef, startAtMs, showMe }: {
2759
2833
  videoId: string | null;
2760
2834
  open: boolean;
2761
2835
  onOpenChange: (open: boolean) => void;
@@ -2765,8 +2839,20 @@ export declare function HelpVideoSheet({ videoId, open, onOpenChange, upNext, on
2765
2839
  /** Where focus goes on close when the opener unmounts while the sheet is
2766
2840
  * open (a popover row). Absent = whatever had focus when the sheet opened. */
2767
2841
  returnFocusRef?: RefObject<HTMLElement | null>;
2842
+ /** Start the player here (edited time), e.g. a walk's "Watch this step". */
2843
+ startAtMs?: number | null;
2844
+ /** Offer "Show me on this page" when the video has steps for this screen. */
2845
+ showMe?: boolean;
2768
2846
  }): JSX.Element;
2769
2847
 
2848
+ /**
2849
+ * Draws the guided walk ("Show me on this page") when one is running. Mount
2850
+ * it once per host; several may be mounted (the recording provider, every
2851
+ * help-video sheet) and only the earliest still mounted draws, so a walk
2852
+ * survives the sheet that started it closing.
2853
+ */
2854
+ export declare function HelpVideoWalkHost(): JSX.Element | null;
2855
+
2770
2856
  /** Always-visible horizontal scrollbar proxy for the table scroller —
2771
2857
  * overlay-OS scrollbars hide, so wide tables get a persistent draggable
2772
2858
  * track pinned above the pagination footer. */
@@ -3588,10 +3674,23 @@ export declare interface IntegrationSignalView {
3588
3674
  shown: number;
3589
3675
  }
3590
3676
 
3677
+ /** A title card before the recording (real extra edited time). Blank
3678
+ * `title` / `subtitle` mean the video's title and the first line of its
3679
+ * description. */
3680
+ declare interface IntroCard {
3681
+ enabled: true;
3682
+ duration_ms: number;
3683
+ show_chapters: boolean;
3684
+ title: string;
3685
+ subtitle: string;
3686
+ }
3687
+
3591
3688
  /** Whether this browser pinned the chat panel open — hosts read it for their
3592
3689
  * initial open state, so a pinned panel is still there after a reload. */
3593
3690
  export declare function isChatPanelPinned(): boolean;
3594
3691
 
3692
+ export declare function isCleanRecording(): boolean;
3693
+
3595
3694
  export declare function ItemActionButtons({ collection, itemId }: {
3596
3695
  collection: string;
3597
3696
  itemId: string;
@@ -4696,6 +4795,13 @@ export declare function OutboundPreviewSection({ collection, itemId, onShowReque
4696
4795
  onJump?: () => void;
4697
4796
  }): JSX.Element | null;
4698
4797
 
4798
+ /** An end card after the recording. Blank `text` means OUTRO_DEFAULT_TEXT. */
4799
+ declare interface OutroCard {
4800
+ enabled: true;
4801
+ duration_ms: number;
4802
+ text: string;
4803
+ }
4804
+
4699
4805
  /**
4700
4806
  * Lets a host put transient overlay state — a drill-down sheet and how deep it
4701
4807
  * is — into browser history, so Back closes the sheet instead of abandoning the
@@ -5903,11 +6009,23 @@ export declare function RecordDrilldownSheet({ collection, itemId, layoutId, roo
5903
6009
  onClose: () => void;
5904
6010
  }): JSX.Element;
5905
6011
 
5906
- /** One click on the recorded tab: recording time and frame fractions (0–1). */
5907
- declare type RecordedClick = {
6012
+ /**
6013
+ * One click on the recorded tab: recording time and frame fractions (0–1).
6014
+ * When the recorder captured its own tab, also what was clicked: accessible
6015
+ * name (≤ 80 chars, never an input's value), role, nearest data-* hook
6016
+ * (`data-name` or `data-name=value`), the screen's page key, path and origin.
6017
+ * Inside `.nvr-no-record` only the position is kept.
6018
+ */
6019
+ export declare type RecordedClick = {
5908
6020
  t_ms: number;
5909
6021
  x: number;
5910
6022
  y: number;
6023
+ label?: string;
6024
+ role?: string;
6025
+ hook?: string;
6026
+ page_key?: string;
6027
+ path?: string;
6028
+ origin?: string;
5911
6029
  };
5912
6030
 
5913
6031
  export declare function RecordGraphExplorer({ collection, itemId, className }: {
@@ -6030,6 +6148,8 @@ export declare function RecordGridWidgetBody({ widget }: {
6030
6148
  widget: PageRendererWidget;
6031
6149
  }): JSX.Element;
6032
6150
 
6151
+ export declare const RECORDING_HIDE_ATTR = "data-nvr-recording-hide";
6152
+
6033
6153
  export declare function RecordReadView({ collection, itemId, layoutData, flush, renderSlot, integrityMarks, renderGrid, onEditSection, gridCounts }: {
6034
6154
  collection: string;
6035
6155
  itemId: string;
@@ -6118,6 +6238,9 @@ export declare function registerDmOpener(fn: DmOpener): () => void;
6118
6238
 
6119
6239
  export declare function registerFieldInterface(plugin: FieldInterfacePlugin): void;
6120
6240
 
6241
+ /** Marks `key` as the screen's page key until the returned function runs. */
6242
+ export declare function registerHelpVideoPage(key: string): () => void;
6243
+
6121
6244
  export declare function registerLayoutSlot(plugin: LayoutSlotPlugin): void;
6122
6245
 
6123
6246
  export declare function registerRoomOpener(fn: RoomOpener): () => void;
@@ -6683,6 +6806,10 @@ export declare function setNumberFormat(opts: {
6683
6806
  compact?: boolean;
6684
6807
  } | null | undefined): void;
6685
6808
 
6809
+ /** Tells shared components who the signed-in person is, so their own photo
6810
+ * reads as Demo User during a clean recording. Hosts call it once they know. */
6811
+ export declare function setRecordingSelf(userId: string | number | null | undefined): void;
6812
+
6686
6813
  export declare function setTimeDisplay(mode: string | null | undefined): void;
6687
6814
 
6688
6815
  /**
@@ -6867,6 +6994,13 @@ export declare function startAutofillRun(cfg: FetchCfg, run: {
6867
6994
  poll?: typeof pollProposal;
6868
6995
  }): AutofillRun;
6869
6996
 
6997
+ export declare function startHelpVideoWalk(w: {
6998
+ videoId: string;
6999
+ title: string;
7000
+ steps: WalkStep[];
7001
+ index?: number;
7002
+ }): void;
7003
+
6870
7004
  export declare type StartRecordingOptions = {
6871
7005
  /** Where the new video shows (a new recording only). */
6872
7006
  contexts?: HelpVideoContext[];
@@ -7292,6 +7426,31 @@ declare interface UnsavedSummary {
7292
7426
  text: string;
7293
7427
  }
7294
7428
 
7429
+ /** An upload session as `/help-videos/uploads/*` returns it. */
7430
+ declare type UploadRow = {
7431
+ id: string;
7432
+ bytes_received: number;
7433
+ next_part: number;
7434
+ /** `open`, `finalizing`, `finalized` (uploaded, not yet a video), `used`
7435
+ * or `abandoned`. */
7436
+ status: string;
7437
+ duration_ms: number | null;
7438
+ created_at: string;
7439
+ updated_at: string;
7440
+ /** 'recording' from the recorder, 'upload' for a picked video file. */
7441
+ source?: 'recording' | 'upload';
7442
+ /** Picked files: the file's name and size. */
7443
+ name?: string | null;
7444
+ size?: number | null;
7445
+ /** Picked files while finishing: 'checking' | 'converting' | 'saving'. */
7446
+ phase?: string | null;
7447
+ /** Picked files while converting: 0–100. */
7448
+ progress?: number | null;
7449
+ /** Why a picked file was not kept (`abandoned`), or why saving failed (`open`). */
7450
+ error?: string | null;
7451
+ error_code?: string | null;
7452
+ };
7453
+
7295
7454
  /**
7296
7455
  * `useAfterIdle(ms)` — false on mount, true once the browser has had `ms` of
7297
7456
  * settle time after the first paint. Gate secondary reads on it (freshness
@@ -7399,6 +7558,9 @@ export declare function useChatSearch(q: string, filters?: ChatSearchFilters): {
7399
7558
  loading: boolean;
7400
7559
  };
7401
7560
 
7561
+ /** True while a clean recording runs. */
7562
+ export declare function useCleanRecording(): boolean;
7563
+
7402
7564
  export declare function useCreateChannel(): UseMutationResult<unknown, Error, {
7403
7565
  name: string;
7404
7566
  key?: string;
@@ -7417,6 +7579,8 @@ user_ids: string[];
7417
7579
  name?: string;
7418
7580
  }, unknown>;
7419
7581
 
7582
+ export declare function useCurrentHelpVideoPage(): string | null;
7583
+
7420
7584
  /**
7421
7585
  * Returns a value that trails `value` by `delayMs`. Useful for keeping text
7422
7586
  * inputs bound to live state while queries key off the debounced copy so a
@@ -7536,8 +7700,18 @@ can_author: boolean;
7536
7700
  state: string | null;
7537
7701
  }>, Error>;
7538
7702
 
7703
+ /** "Show me on this page": the published version's labelled clicks. */
7704
+ export declare function useHelpVideoWalk(id: string | null): UseQueryResult<NoInfer<{
7705
+ version_id: string | null;
7706
+ steps: WalkStep[];
7707
+ }>, Error>;
7708
+
7539
7709
  export declare function useImportHealth(): UseQueryResult<NoInfer<ImportHealth>, Error>;
7540
7710
 
7711
+ /** True when clean mode runs AND `userId` is the signed-in person (the host's
7712
+ * setRecordingSelf, else the record form's auth context). */
7713
+ export declare function useIsRecordingSelf(userId: string | number | null | undefined): boolean;
7714
+
7541
7715
  export declare function useItemEditAuth(): ItemEditAuthContextValue;
7542
7716
 
7543
7717
  export declare function useItemLock(collection: string | undefined, item: string | undefined, enabled: boolean): {
@@ -7729,6 +7903,9 @@ export declare function useQuickPickerSteps(collection: string | null | undefine
7729
7903
  * The FALLBACK is the caller's own styled disc: every site already has its
7730
7904
  * exact colors/ring/size, and this component must never change how a user
7731
7905
  * without a photo renders.
7906
+ *
7907
+ * During a clean help-video recording the signed-in person's own avatar reads
7908
+ * as a neutral "DU" (Demo User) disc; everyone else's stays.
7732
7909
  */
7733
7910
  export declare function UserAvatar({ userId, fallback, className, style, alt }: {
7734
7911
  userId: string | number | null | undefined;
@@ -7953,14 +8130,14 @@ declare interface VersionDto {
7953
8130
  note: string | null;
7954
8131
  created_at: string;
7955
8132
  /** Draft, re-record and restore results only (recorder data). */
7956
- /** Clicks on the recorded tab: `t_ms` source time, `x`/`y` frame fractions (0–1). */
7957
- clicks?: Array<{
7958
- t_ms: number;
7959
- x: number;
7960
- y: number;
7961
- }> | null;
8133
+ /** Clicks on the recorded tab: `t_ms` source time, `x`/`y` frame fractions (0–1);
8134
+ * recorded since #1486, also what was clicked (see RecordedClick). */
8135
+ clicks?: RecordedClick[] | null;
7962
8136
  /** Microphone loudness 0–1, one value per 100 ms of source time. */
7963
8137
  levels?: number[] | null;
8138
+ /** Draft load only: 'upload' when the source is a video file someone picked
8139
+ * (it has no clicks and no microphone levels), else 'recording'. */
8140
+ source_kind?: 'recording' | 'upload';
7964
8141
  }
7965
8142
 
7966
8143
  export declare interface VideoEdits {
@@ -7972,6 +8149,10 @@ export declare interface VideoEdits {
7972
8149
  zooms: Zoom[];
7973
8150
  blurs: Blur[];
7974
8151
  captions: Caption[];
8152
+ /** Stored only while switched on (absent = off). */
8153
+ intro?: IntroCard;
8154
+ outro?: OutroCard;
8155
+ chapter_banners?: true;
7975
8156
  }
7976
8157
 
7977
8158
  export declare function viewAs(person: {
@@ -7996,6 +8177,20 @@ declare type Visibility = {
7996
8177
  role_ids: string[];
7997
8178
  };
7998
8179
 
8180
+ /** One step of "Show me on this page" (GET /help-videos/:id/walk). */
8181
+ export declare interface WalkStep {
8182
+ label: string;
8183
+ role: string | null;
8184
+ hook: string | null;
8185
+ page_key: string | null;
8186
+ path: string | null;
8187
+ origin: string | null;
8188
+ /** Where the step happens in the finished video (edited time). */
8189
+ edited_ms: number;
8190
+ /** The callout or box text shown around the click, else null. */
8191
+ text: string | null;
8192
+ }
8193
+
7999
8194
  export declare function WidgetSlot({ widgetId, inputBindings, itemDraft, itemCollection, ready, label, defaultExpanded, frameless, apiBase: apiBaseProp, compact, strip, onClientAction, onWidgetType, onContentChange }: WidgetSlotProps): JSX.Element | null;
8000
8195
 
8001
8196
  declare interface WidgetSlotProps {