@veltdev/react 2.0.14 → 2.0.16

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.
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  export interface IVeltCommentThreadProps {
3
3
  annotationId?: string;
4
+ selectable?: boolean;
5
+ onCommentClick?: Function;
4
6
  }
5
7
  declare const VeltCommentThread: React.FC<IVeltCommentThreadProps>;
6
8
  export default VeltCommentThread;
@@ -1,3 +1,3 @@
1
- export declare const VELT_SDK_VERSION = "2.0.14";
1
+ export declare const VELT_SDK_VERSION = "2.0.16";
2
2
  export declare const VELT_SDK_INIT_EVENT = "onVeltInit";
3
3
  export declare const VELT_TAB_ID = "veltTabId";
package/esm/index.js CHANGED
@@ -132,7 +132,7 @@ var loadVelt = function (callback, version, staging, develop, proxyDomain) {
132
132
  }
133
133
  };
134
134
 
135
- var VELT_SDK_VERSION = '2.0.14';
135
+ var VELT_SDK_VERSION = '2.0.16';
136
136
  var VELT_SDK_INIT_EVENT = 'onVeltInit';
137
137
  var VELT_TAB_ID = 'veltTabId';
138
138
 
@@ -678,8 +678,32 @@ var VeltViewAnalytics = function (props) {
678
678
  };
679
679
 
680
680
  var VeltCommentThread = function (props) {
681
- var annotationId = props.annotationId;
682
- return (React.createElement("velt-comment-thread", { "annotation-id": annotationId }));
681
+ var annotationId = props.annotationId, selectable = props.selectable, onCommentClick = props.onCommentClick;
682
+ var ref = useRef();
683
+ var onCommentClickRef = useRef(onCommentClick);
684
+ useEffect(function () {
685
+ onCommentClickRef.current = onCommentClick;
686
+ }, [onCommentClick]);
687
+ useEffect(function () {
688
+ var element;
689
+ var handleCommentClick = function (event) {
690
+ if (onCommentClickRef.current) {
691
+ onCommentClickRef.current(event === null || event === void 0 ? void 0 : event.detail);
692
+ }
693
+ };
694
+ if (ref.current) {
695
+ element = ref.current;
696
+ if (element) {
697
+ element.addEventListener('onCommentClick', handleCommentClick);
698
+ }
699
+ }
700
+ return function () {
701
+ if (element) {
702
+ element.removeEventListener('onCommentClick', handleCommentClick);
703
+ }
704
+ };
705
+ }, []);
706
+ return (React.createElement("velt-comment-thread", { ref: ref, "annotation-id": annotationId, selectable: [true, false].includes(selectable) ? (selectable ? 'true' : 'false') : undefined }));
683
707
  };
684
708
 
685
709
  var VeltNotificationsTool = function (props) {