@veltdev/react 5.0.0-beta.1 → 5.0.0-beta.3

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.
@@ -10,6 +10,8 @@ export interface IVeltCommentComposerProps extends React.DetailedHTMLProps<React
10
10
  locationId?: string;
11
11
  documentId?: string;
12
12
  folderId?: string;
13
+ placeholder?: string;
14
+ targetElementId?: string;
13
15
  }
14
16
  declare const VeltCommentComposer: React.FC<IVeltCommentComposerProps>;
15
17
  export default VeltCommentComposer;
@@ -6,6 +6,7 @@ export interface IVeltCommentDialogProps extends React.DetailedHTMLProps<React.H
6
6
  commentPinSelected?: boolean;
7
7
  fullExpanded?: boolean;
8
8
  shadowDom?: boolean;
9
+ placeholder?: string;
9
10
  }
10
11
  declare const VeltCommentDialog: React.FC<IVeltCommentDialogProps>;
11
12
  export default VeltCommentDialog;
@@ -11,6 +11,7 @@ export interface IVeltCommentDialogComposerProps extends React.DetailedHTMLProps
11
11
  commentplaceholder?: string;
12
12
  replyplaceholder?: string;
13
13
  editplaceholder?: string;
14
+ targetElementId?: string;
14
15
  }
15
16
  declare const VeltCommentDialogComposer: React.FC<IVeltCommentDialogComposerProps>;
16
17
  export default VeltCommentDialogComposer;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- export declare const VELT_SDK_VERSION = "5.0.0-beta.1";
2
+ export declare const VELT_SDK_VERSION = "5.0.0-beta.3";
3
3
  export declare const VELT_SDK_INIT_EVENT = "onVeltInit";
4
4
  export declare const VELT_TAB_ID = "veltTabId";
5
5
  export declare const INTEGRITY_MAP: Record<string, string>;
@@ -1,2 +1,28 @@
1
- declare const loadVelt: (callback: Function, version?: string, staging?: boolean, develop?: boolean, proxyDomain?: string, integrity?: boolean, integrityValue?: string) => void;
1
+ /**
2
+ * Loads the Velt script dynamically and calls the callback when ready.
3
+ * Returns a cleanup function to remove the event listener if component unmounts.
4
+ *
5
+ * ## Issue (Rapid Mount/Unmount with Slow Network)
6
+ *
7
+ * When VeltProvider is rapidly mounted/unmounted (e.g., conditional rendering,
8
+ * React Strict Mode, or route changes) while the Velt script is still loading
9
+ * over a slow network, multiple issues can occur:
10
+ *
11
+ * 1. First component mount creates the script tag and starts loading
12
+ * 2. Component unmounts before script loads (script tag remains in DOM)
13
+ * 3. Second component mount finds existing script tag
14
+ * 4. OLD BEHAVIOR: Immediately triggered callback assuming script was loaded
15
+ * 5. PROBLEM: Script wasn't actually loaded yet (still loading due to network delay)
16
+ * 6. This caused initVelt to run with window.Velt = undefined
17
+ *
18
+ * ## Fix
19
+ *
20
+ * 1. Check if window.Velt exists before triggering callback for existing scripts
21
+ * 2. If script tag exists but window.Velt doesn't, attach a new load event listener
22
+ * 3. Return a cleanup function that removes the event listener when component unmounts
23
+ * 4. This prevents orphaned callbacks from firing on destroyed component instances
24
+ *
25
+ * @returns Cleanup function to remove event listener (call on component unmount)
26
+ */
27
+ declare const loadVelt: (callback: Function, version?: string, staging?: boolean, develop?: boolean, proxyDomain?: string, integrity?: boolean, integrityValue?: string) => (() => void);
2
28
  export default loadVelt;
package/index.d.ts CHANGED
@@ -795,6 +795,8 @@ interface IVeltCommentComposerProps extends React$1.DetailedHTMLProps<React$1.HT
795
795
  locationId?: string;
796
796
  documentId?: string;
797
797
  folderId?: string;
798
+ placeholder?: string;
799
+ targetElementId?: string;
798
800
  }
799
801
  declare const VeltCommentComposer: React$1.FC<IVeltCommentComposerProps>;
800
802
 
@@ -822,6 +824,7 @@ interface IVeltCommentDialogProps extends React$1.DetailedHTMLProps<React$1.HTML
822
824
  commentPinSelected?: boolean;
823
825
  fullExpanded?: boolean;
824
826
  shadowDom?: boolean;
827
+ placeholder?: string;
825
828
  }
826
829
  declare const VeltCommentDialog: React$1.FC<IVeltCommentDialogProps>;
827
830
 
@@ -1675,6 +1678,7 @@ interface IVeltCommentDialogComposerProps$1 extends React$1.DetailedHTMLProps<Re
1675
1678
  commentplaceholder?: string;
1676
1679
  replyplaceholder?: string;
1677
1680
  editplaceholder?: string;
1681
+ targetElementId?: string;
1678
1682
  }
1679
1683
  declare const VeltCommentDialogComposer: React$1.FC<IVeltCommentDialogComposerProps$1>;
1680
1684
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veltdev/react",
3
- "version": "5.0.0-beta.1",
3
+ "version": "5.0.0-beta.3",
4
4
  "description": "Velt is an SDK to add collaborative features to your product within minutes. Example: Comments like Figma, Frame.io, Google docs or sheets, Recording like Loom, Huddles like Slack and much more.",
5
5
  "homepage": "https://velt.dev",
6
6
  "keywords": [