@veltdev/react 4.6.7 → 4.6.9

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,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- export declare const VELT_SDK_VERSION = "4.6.7";
2
+ export declare const VELT_SDK_VERSION = "4.6.9";
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>;
@@ -0,0 +1,2 @@
1
+ import { CrdtEventTypesMap } from "@veltdev/types";
2
+ export declare function useCrdtEventCallback<T extends keyof CrdtEventTypesMap>(action: T): CrdtEventTypesMap[T];
@@ -0,0 +1,2 @@
1
+ import { CrdtElement } from "@veltdev/types";
2
+ export declare function useCrdtUtils(): CrdtElement | undefined;
@@ -18,3 +18,5 @@ export { useNotificationUtils, useNotificationsData, useUnreadNotificationsCount
18
18
  export { useNotificationEventCallback, } from './NotificationsActions';
19
19
  export { useAutocompleteUtils, useAutocompleteChipClick, } from './AutocompleteElement';
20
20
  export { useContactUtils, useContactSelected, useContactList, } from './ContactElement';
21
+ export { useCrdtUtils, } from './CrdtElement';
22
+ export { useCrdtEventCallback, } from './CrdtActions';
package/esm/index.js CHANGED
@@ -137,13 +137,13 @@ var loadVelt = function (callback, version, staging, develop, proxyDomain, integ
137
137
  }
138
138
  };
139
139
 
140
- var VELT_SDK_VERSION = '4.6.7';
140
+ var VELT_SDK_VERSION = '4.6.9';
141
141
  var VELT_SDK_INIT_EVENT = 'onVeltInit';
142
142
  var VELT_TAB_ID = 'veltTabId';
143
143
  // integrity map for the Velt SDK
144
144
  // Note: generate integrity hashes with: https://www.srihash.org/
145
145
  var INTEGRITY_MAP = {
146
- '4.6.7': 'sha384-YCHh91OgPnfwnVPiya728UyOmgbn6CAEY8R1v3ytYaOJazqiGJiqoQ6+C5x3ajiJ',
146
+ '4.6.9': 'sha384-hC0faXaN+Z6kIhO87PDhqL+ARcdgmD1FdpLB9amziTOoZ3G2cIZmcwReBVK5Y7hf',
147
147
  };
148
148
 
149
149
  var validProps = ['veltIf', 'veltClass', 'className', 'variant'];
@@ -7898,6 +7898,45 @@ function useContactList() {
7898
7898
  return data;
7899
7899
  }
7900
7900
 
7901
+ function useCrdtUtils() {
7902
+ var _a = React.useState(), crdtElement = _a[0], setCrdtElement = _a[1];
7903
+ var client = useVeltClient().client;
7904
+ React.useEffect(function () {
7905
+ if (!client || crdtElement)
7906
+ return;
7907
+ var loadedCrdtElement = client.getCrdtElement();
7908
+ setCrdtElement(loadedCrdtElement);
7909
+ }, [client, setCrdtElement, crdtElement]);
7910
+ return crdtElement;
7911
+ }
7912
+
7913
+ function useCrdtEventCallback(action) {
7914
+ var crdtElement = useCrdtUtils();
7915
+ var _a = useState(null), data = _a[0], setData = _a[1];
7916
+ var subscriptionRef = useRef(null);
7917
+ var memoizedAction = useMemo(function () { return action; }, [action]);
7918
+ useEffect(function () {
7919
+ var _a;
7920
+ if (!(crdtElement === null || crdtElement === void 0 ? void 0 : crdtElement.on))
7921
+ return;
7922
+ if (subscriptionRef.current) {
7923
+ subscriptionRef.current.unsubscribe();
7924
+ }
7925
+ var subscription = (_a = crdtElement === null || crdtElement === void 0 ? void 0 : crdtElement.on(memoizedAction)) === null || _a === void 0 ? void 0 : _a.subscribe(function (data) {
7926
+ setData(data);
7927
+ });
7928
+ // Store the new subscription
7929
+ subscriptionRef.current = subscription;
7930
+ // Cleanup function
7931
+ return function () {
7932
+ if (subscriptionRef.current) {
7933
+ subscriptionRef.current.unsubscribe();
7934
+ }
7935
+ };
7936
+ }, [crdtElement === null || crdtElement === void 0 ? void 0 : crdtElement.on, memoizedAction]);
7937
+ return data;
7938
+ }
7939
+
7901
7940
  var sessionId = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
7902
7941
  var getSessionId = function () {
7903
7942
  return (sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.getItem(VELT_TAB_ID)) || sessionId;
@@ -8034,5 +8073,5 @@ var logLiveState = function (action, liveStateDataId) {
8034
8073
  }
8035
8074
  };
8036
8075
 
8037
- export { SnippylyArrowTool as VeltArrowTool, SnippylyArrows as VeltArrows, VeltAutocomplete, VeltAutocompleteChipTooltipWireframe, VeltAutocompleteGroupOptionWireframe, VeltAutocompleteOptionWireframe, VeltButtonWireframe, VeltCanvasComment, VeltChartComment, SnippylyCommentBubble as VeltCommentBubble, VeltCommentBubbleWireframe, VeltCommentComposer, VeltCommentComposerWireframe, VeltCommentDialogOptionsDropdownContentWireframe, VeltCommentDialogOptionsDropdownTriggerWireframe, VeltCommentDialogPriorityDropdownContentWireframe, VeltCommentDialogPriorityDropdownTriggerWireframe, VeltCommentDialogStatusDropdownContentWireframe, VeltCommentDialogStatusDropdownTriggerWireframe, VeltCommentDialogWireframe, VeltCommentPin, VeltCommentPinWireframe, VeltCommentPlayerTimeline, VeltCommentText, VeltCommentThread, VeltCommentThreadWireframe, SnippylyCommentTool as VeltCommentTool, VeltCommentToolWireframe, SnippylyComments as VeltComments, VeltCommentsMinimap, SnippylyCommentsSidebar as VeltCommentsSidebar, VeltCommentsSidebarButton, VeltCommentsSidebarStatusDropdownWireframe, VeltCommentsSidebarWireframe, VeltConfirmDialogWireframe, SnippylyCursor as VeltCursor, VeltCursorPointerWireframe, VeltData, VeltHighChartComments, SnippylyHuddle as VeltHuddle, SnippylyHuddleTool as VeltHuddleTool, VeltIf, VeltInlineCommentsSection, VeltInlineCommentsSectionWireframe, VeltInlineReactionsSection, VeltInlineReactionsSectionWireframe, VeltMediaSourceSettingsWireframe, VeltMultiThreadCommentDialogWireframe, VeltNivoChartComments, VeltNotificationsHistoryPanel, VeltNotificationsPanel, VeltNotificationsPanelWireframe, VeltNotificationsTool, VeltNotificationsToolWireframe, VeltPersistentCommentModeWireframe, SnippylyPresence as VeltPresence, VeltPresenceTooltipWireframe, VeltPresenceWireframe, SnippylyProvider as VeltProvider, VeltReactionPinTooltipWireframe, VeltReactionPinWireframe, VeltReactionTool, VeltReactionToolWireframe, VeltReactionsPanelWireframe, VeltRecorderAllToolMenuWireframe, VeltRecorderAllToolWireframe, VeltRecorderAudioToolWireframe, SnippylyRecorderControlPanel as VeltRecorderControlPanel, VeltRecorderControlPanelWireframe, SnippylyRecorderNotes as VeltRecorderNotes, SnippylyRecorderPlayer as VeltRecorderPlayer, VeltRecorderPlayerExpandedWireframe, VeltRecorderPlayerWireframe, VeltRecorderScreenToolWireframe, SnippylyRecorderTool as VeltRecorderTool, VeltRecorderVideoToolWireframe, VeltRecordingPreviewStepsDialogWireframe, SnippylySidebarButton as VeltSidebarButton, VeltSidebarButtonWireframe, VeltSingleEditorModePanel, VeltSingleEditorModePanelWireframe, VeltSubtitlesWireframe, SnippylyTagTool as VeltTagTool, SnippylyTags as VeltTags, VeltTextCommentToolWireframe, VeltTextCommentToolbar as VeltTextCommentToolbarWireframe, VeltTranscriptionWireframe, SnippylyUserInviteTool as VeltUserInviteTool, SnippylyUserRequestTool as VeltUserRequestTool, VeltUserSelectorDropdown as VeltUserSelectorDropdownWireframe, VeltVideoEditor, VeltVideoEditorPlayerWireframe, VeltVideoPlayer, VeltViewAnalytics, VeltWireframe, createLiveStateMiddleware, useAIRewriterUtils, useAddAttachment, useAddComment, useAddCommentAnnotation, useAddReaction, useApproveCommentAnnotation, useAssignUser, useAutocompleteChipClick, useAutocompleteUtils, useClient, useCommentActionCallback, useCommentAddHandler, useCommentAnnotationById, useCommentAnnotations, useCommentAnnotationsCount, useCommentCopyLinkHandler, useCommentDialogSidebarClickHandler, useCommentEventCallback, useCommentModeState, useCommentSelectionChangeHandler, useCommentSidebarActionButtonClick, useCommentSidebarData, useCommentSidebarInit, useCommentUpdateHandler, useCommentUtils, useContactList, useContactSelected, useContactUtils, useCopyLink, useCurrentUser, useCurrentUserPermissions, useCursorUsers, useCursorUtils, useDeleteAttachment, useDeleteComment, useDeleteCommentAnnotation, useDeleteReaction, useDeleteRecording, useEditor, useEditorAccessRequestHandler, useEditorAccessTimer, useGetAttachment, useGetComment, useGetCommentAnnotations, useGetLink, useGetRecording, useHeartbeat, useHuddleUtils, useIdentify, useLiveSelectionDataHandler, useLiveSelectionUtils, useLiveState, useLiveStateData, useLiveStateSyncEventCallback, useLiveStateSyncUtils, useNotificationEventCallback, useNotificationSettings, useNotificationUtils, useNotificationsData, usePresenceData, usePresenceEventCallback, usePresenceUsers, usePresenceUtils, useRecorderAddHandler, useRecorderEventCallback, useRecorderUtils, useRecordingDataByRecorderId, useRecordings, useRejectCommentAnnotation, useResolveCommentAnnotation, useServerConnectionStateChangeHandler, useSetDocument, useSetDocumentId, useSetDocuments, useSetLiveStateData, useSetLocation, useSetLocations, useSetRootDocument, useSetRootLocation, useSubscribeCommentAnnotation, useTagAnnotations, useTagUtils, useToggleReaction, useUiState, useUniqueViewsByDate, useUniqueViewsByUser, useUnreadCommentAnnotationCountByLocationId, useUnreadCommentAnnotationCountOnCurrentDocument, useUnreadCommentCountByAnnotationId, useUnreadCommentCountByLocationId, useUnreadCommentCountOnCurrentDocument, useUnreadNotificationsCount, useUnsetDocumentId, useUnsetDocuments, useUnsubscribeCommentAnnotation, useUpdateAccess, useUpdateComment, useUpdatePriority, useUpdateStatus, useUserEditorState, useVeltClient, useVeltEventCallback, useVeltInitState, useViewsUtils };
8076
+ export { SnippylyArrowTool as VeltArrowTool, SnippylyArrows as VeltArrows, VeltAutocomplete, VeltAutocompleteChipTooltipWireframe, VeltAutocompleteGroupOptionWireframe, VeltAutocompleteOptionWireframe, VeltButtonWireframe, VeltCanvasComment, VeltChartComment, SnippylyCommentBubble as VeltCommentBubble, VeltCommentBubbleWireframe, VeltCommentComposer, VeltCommentComposerWireframe, VeltCommentDialogOptionsDropdownContentWireframe, VeltCommentDialogOptionsDropdownTriggerWireframe, VeltCommentDialogPriorityDropdownContentWireframe, VeltCommentDialogPriorityDropdownTriggerWireframe, VeltCommentDialogStatusDropdownContentWireframe, VeltCommentDialogStatusDropdownTriggerWireframe, VeltCommentDialogWireframe, VeltCommentPin, VeltCommentPinWireframe, VeltCommentPlayerTimeline, VeltCommentText, VeltCommentThread, VeltCommentThreadWireframe, SnippylyCommentTool as VeltCommentTool, VeltCommentToolWireframe, SnippylyComments as VeltComments, VeltCommentsMinimap, SnippylyCommentsSidebar as VeltCommentsSidebar, VeltCommentsSidebarButton, VeltCommentsSidebarStatusDropdownWireframe, VeltCommentsSidebarWireframe, VeltConfirmDialogWireframe, SnippylyCursor as VeltCursor, VeltCursorPointerWireframe, VeltData, VeltHighChartComments, SnippylyHuddle as VeltHuddle, SnippylyHuddleTool as VeltHuddleTool, VeltIf, VeltInlineCommentsSection, VeltInlineCommentsSectionWireframe, VeltInlineReactionsSection, VeltInlineReactionsSectionWireframe, VeltMediaSourceSettingsWireframe, VeltMultiThreadCommentDialogWireframe, VeltNivoChartComments, VeltNotificationsHistoryPanel, VeltNotificationsPanel, VeltNotificationsPanelWireframe, VeltNotificationsTool, VeltNotificationsToolWireframe, VeltPersistentCommentModeWireframe, SnippylyPresence as VeltPresence, VeltPresenceTooltipWireframe, VeltPresenceWireframe, SnippylyProvider as VeltProvider, VeltReactionPinTooltipWireframe, VeltReactionPinWireframe, VeltReactionTool, VeltReactionToolWireframe, VeltReactionsPanelWireframe, VeltRecorderAllToolMenuWireframe, VeltRecorderAllToolWireframe, VeltRecorderAudioToolWireframe, SnippylyRecorderControlPanel as VeltRecorderControlPanel, VeltRecorderControlPanelWireframe, SnippylyRecorderNotes as VeltRecorderNotes, SnippylyRecorderPlayer as VeltRecorderPlayer, VeltRecorderPlayerExpandedWireframe, VeltRecorderPlayerWireframe, VeltRecorderScreenToolWireframe, SnippylyRecorderTool as VeltRecorderTool, VeltRecorderVideoToolWireframe, VeltRecordingPreviewStepsDialogWireframe, SnippylySidebarButton as VeltSidebarButton, VeltSidebarButtonWireframe, VeltSingleEditorModePanel, VeltSingleEditorModePanelWireframe, VeltSubtitlesWireframe, SnippylyTagTool as VeltTagTool, SnippylyTags as VeltTags, VeltTextCommentToolWireframe, VeltTextCommentToolbar as VeltTextCommentToolbarWireframe, VeltTranscriptionWireframe, SnippylyUserInviteTool as VeltUserInviteTool, SnippylyUserRequestTool as VeltUserRequestTool, VeltUserSelectorDropdown as VeltUserSelectorDropdownWireframe, VeltVideoEditor, VeltVideoEditorPlayerWireframe, VeltVideoPlayer, VeltViewAnalytics, VeltWireframe, createLiveStateMiddleware, useAIRewriterUtils, useAddAttachment, useAddComment, useAddCommentAnnotation, useAddReaction, useApproveCommentAnnotation, useAssignUser, useAutocompleteChipClick, useAutocompleteUtils, useClient, useCommentActionCallback, useCommentAddHandler, useCommentAnnotationById, useCommentAnnotations, useCommentAnnotationsCount, useCommentCopyLinkHandler, useCommentDialogSidebarClickHandler, useCommentEventCallback, useCommentModeState, useCommentSelectionChangeHandler, useCommentSidebarActionButtonClick, useCommentSidebarData, useCommentSidebarInit, useCommentUpdateHandler, useCommentUtils, useContactList, useContactSelected, useContactUtils, useCopyLink, useCrdtEventCallback, useCrdtUtils, useCurrentUser, useCurrentUserPermissions, useCursorUsers, useCursorUtils, useDeleteAttachment, useDeleteComment, useDeleteCommentAnnotation, useDeleteReaction, useDeleteRecording, useEditor, useEditorAccessRequestHandler, useEditorAccessTimer, useGetAttachment, useGetComment, useGetCommentAnnotations, useGetLink, useGetRecording, useHeartbeat, useHuddleUtils, useIdentify, useLiveSelectionDataHandler, useLiveSelectionUtils, useLiveState, useLiveStateData, useLiveStateSyncEventCallback, useLiveStateSyncUtils, useNotificationEventCallback, useNotificationSettings, useNotificationUtils, useNotificationsData, usePresenceData, usePresenceEventCallback, usePresenceUsers, usePresenceUtils, useRecorderAddHandler, useRecorderEventCallback, useRecorderUtils, useRecordingDataByRecorderId, useRecordings, useRejectCommentAnnotation, useResolveCommentAnnotation, useServerConnectionStateChangeHandler, useSetDocument, useSetDocumentId, useSetDocuments, useSetLiveStateData, useSetLocation, useSetLocations, useSetRootDocument, useSetRootLocation, useSubscribeCommentAnnotation, useTagAnnotations, useTagUtils, useToggleReaction, useUiState, useUniqueViewsByDate, useUniqueViewsByUser, useUnreadCommentAnnotationCountByLocationId, useUnreadCommentAnnotationCountOnCurrentDocument, useUnreadCommentCountByAnnotationId, useUnreadCommentCountByLocationId, useUnreadCommentCountOnCurrentDocument, useUnreadNotificationsCount, useUnsetDocumentId, useUnsetDocuments, useUnsubscribeCommentAnnotation, useUpdateAccess, useUpdateComment, useUpdatePriority, useUpdateStatus, useUserEditorState, useVeltClient, useVeltEventCallback, useVeltInitState, useViewsUtils };
8038
8077
  //# sourceMappingURL=index.js.map