@veltdev/react 1.0.80 → 1.0.81

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.
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export interface IVeltDocumentViewerTrendProps {
3
+ type?: 'document' | 'location';
4
+ locationId?: string;
5
+ }
6
+ declare const VeltDocumentViewerTrend: React.FC<IVeltDocumentViewerTrendProps>;
7
+ export default VeltDocumentViewerTrend;
@@ -0,0 +1 @@
1
+ export { default } from "./VeltDocumentViewerTrend";
@@ -3,6 +3,7 @@ export interface IVeltVideoPlayerProps {
3
3
  src: string;
4
4
  darkMode?: boolean;
5
5
  sync?: boolean;
6
+ commentTool?: boolean;
6
7
  }
7
8
  declare const VeltVideoPlayer: React.FC<IVeltVideoPlayerProps>;
8
9
  export default VeltVideoPlayer;
@@ -20,3 +20,4 @@ export { default as VeltUserInviteTool } from "./SnippylyUserInviteTool";
20
20
  export { default as VeltUserRequestTool } from "./SnippylyUserRequestTool";
21
21
  export { default as VeltCommentPlayerTimeline } from "./VeltCommentPlayerTimeline";
22
22
  export { default as VeltVideoPlayer } from "./VeltVideoPlayer";
23
+ export { default as VeltDocumentViewerTrend } from "./VeltDocumentViewerTrend";
@@ -1,2 +1,2 @@
1
- export declare const VELT_SDK_VERSION = "1.0.97";
1
+ export declare const VELT_SDK_VERSION = "1.0.98";
2
2
  export declare const VELT_SDK_INIT_EVENT = "onVeltInit";
@@ -0,0 +1,13 @@
1
+ import { ViewsByDate, ViewsByUser, ViewsElement } from "@veltdev/types";
2
+ /**
3
+ * @beta This hook is in beta
4
+ */
5
+ export declare function useViewsUtils(): ViewsElement | undefined;
6
+ /**
7
+ * @beta This hook is in beta
8
+ */
9
+ export declare function useUniqueViewsByUser(clientLocationId?: string): ViewsByUser | null;
10
+ /**
11
+ * @beta This hook is in beta
12
+ */
13
+ export declare function useUniqueViewsByDate(clientLocationId?: string): ViewsByDate | null;
@@ -8,3 +8,4 @@ export { useRecorderUtils, useRecorderAddHandler, } from './RecorderElement';
8
8
  export { useAIRewriterUtils, } from './RewriterElement';
9
9
  export { useLiveSelectionUtils, } from './SelectionElement';
10
10
  export { useTagUtils, useTagAnnotations, } from './TagElement';
11
+ export { useViewsUtils, useUniqueViewsByDate, useUniqueViewsByUser, } from './ViewsElement';
@@ -1,2 +1,2 @@
1
- declare const loadVelt: (callback: Function, version?: string, staging?: boolean) => void;
1
+ declare const loadVelt: (callback: Function, version?: string, staging?: boolean, develop?: boolean) => void;
2
2
  export default loadVelt;
package/esm/index.js CHANGED
@@ -69,15 +69,19 @@ function useVeltClient() {
69
69
  return useContext(VeltContext);
70
70
  }
71
71
 
72
- var loadVelt = function (callback, version, staging) {
72
+ var loadVelt = function (callback, version, staging, develop) {
73
73
  if (version === void 0) { version = 'latest'; }
74
74
  if (staging === void 0) { staging = false; }
75
+ if (develop === void 0) { develop = false; }
75
76
  var existingScript = document.getElementById('veltScript');
76
77
  if (!existingScript) {
77
78
  var script = document.createElement('script');
78
79
  if (staging) {
79
80
  script.src = "https://us-central1-snipply-sdk-staging.cloudfunctions.net/getPrivateNpmPackageFile?packageName=sdk-staging&packageVersion=".concat((!version || version === 'latest') ? '1.0.1' : version, "&filePath=velt.js&orgName=@veltdev");
80
81
  }
82
+ else if (develop) {
83
+ script.src = "https://us-central1-snipply-sdk-staging.cloudfunctions.net/getPrivateNpmPackageFile?packageName=sdk-dev&packageVersion=".concat((!version || version === 'latest') ? '1.0.1' : version, "&filePath=velt.js&orgName=@veltdev");
84
+ }
81
85
  else {
82
86
  script.src = "https://cdn.jsdelivr.net/npm/@veltdev/sdk@".concat(version, "/velt.js");
83
87
  }
@@ -97,7 +101,7 @@ var loadVelt = function (callback, version, staging) {
97
101
  }
98
102
  };
99
103
 
100
- var VELT_SDK_VERSION = '1.0.97';
104
+ var VELT_SDK_VERSION = '1.0.98';
101
105
  var VELT_SDK_INIT_EVENT = 'onVeltInit';
102
106
 
103
107
  var SnippylyProvider = function (props) {
@@ -107,7 +111,7 @@ var SnippylyProvider = function (props) {
107
111
  if (apiKey) {
108
112
  loadVelt(function () {
109
113
  initVelt();
110
- }, (config === null || config === void 0 ? void 0 : config.version) || VELT_SDK_VERSION, config === null || config === void 0 ? void 0 : config.staging);
114
+ }, (config === null || config === void 0 ? void 0 : config.version) || VELT_SDK_VERSION, config === null || config === void 0 ? void 0 : config.staging, config === null || config === void 0 ? void 0 : config.develop);
111
115
  }
112
116
  }, []);
113
117
  var initVelt = function () { return __awaiter(void 0, void 0, void 0, function () {
@@ -120,6 +124,9 @@ var SnippylyProvider = function (props) {
120
124
  if (config.staging) {
121
125
  delete config.staging;
122
126
  }
127
+ if (config.develop) {
128
+ delete config.develop;
129
+ }
123
130
  if (config.version) {
124
131
  delete config.version;
125
132
  }
@@ -395,8 +402,8 @@ var SnippylyArrowTool = function (props) {
395
402
  };
396
403
 
397
404
  var SnippylyUserInviteTool = function (props) {
398
- var type = props.type, source = props.source, title = props.title, placeholder = props.placeholder, accessControlDropdown = props.accessControlDropdown, documentUserAccessList = props.documentUserAccessList, children = props.children;
399
- return (React.createElement("velt-user-invite-tool", { type: type, source: source, title: title, placeholder: placeholder, "access-control-dropdown": [true, false].includes(accessControlDropdown) ? accessControlDropdown : undefined, "document-user-access-list": [true, false].includes(documentUserAccessList) ? documentUserAccessList : undefined }, children));
405
+ var type = props.type, source = props.source, title = props.title, placeholder = props.placeholder, inviteUrl = props.inviteUrl, accessControlDropdown = props.accessControlDropdown, documentUserAccessList = props.documentUserAccessList, children = props.children;
406
+ return (React.createElement("velt-user-invite-tool", { type: type, source: source, title: title, placeholder: placeholder, "invite-url": inviteUrl, "access-control-dropdown": [true, false].includes(accessControlDropdown) ? accessControlDropdown : undefined, "document-user-access-list": [true, false].includes(documentUserAccessList) ? documentUserAccessList : undefined }, children));
400
407
  };
401
408
 
402
409
  var SnippylyUserRequestTool = function (props) {
@@ -421,8 +428,13 @@ var VeltCommentPlayerTimeline = function (props) {
421
428
  };
422
429
 
423
430
  var VeltVideoPlayer = function (props) {
424
- var darkMode = props.darkMode, src = props.src, sync = props.sync;
425
- return (React.createElement("velt-video-player", { src: src, "dark-mode": [true, false].includes(darkMode) ? (darkMode ? 'true' : 'false') : undefined, sync: [true, false].includes(sync) ? (sync ? 'true' : 'false') : undefined }));
431
+ var darkMode = props.darkMode, src = props.src, sync = props.sync, commentTool = props.commentTool;
432
+ return (React.createElement("velt-video-player", { src: src, "dark-mode": [true, false].includes(darkMode) ? (darkMode ? 'true' : 'false') : undefined, sync: [true, false].includes(sync) ? (sync ? 'true' : 'false') : undefined, "comment-tool": [true, false].includes(commentTool) ? (commentTool ? 'true' : 'false') : undefined }));
433
+ };
434
+
435
+ var VeltDocumentViewerTrend = function (props) {
436
+ var type = props.type, locationId = props.locationId;
437
+ return (React.createElement("velt-document-viewer-trend", { type: type, "location-id": locationId }));
426
438
  };
427
439
 
428
440
  /**
@@ -899,6 +911,57 @@ function useTagAnnotations(documentId, location) {
899
911
  return data;
900
912
  }
901
913
 
914
+ /**
915
+ * @beta This hook is in beta
916
+ */
917
+ function useViewsUtils() {
918
+ var _a = React.useState(), viewsElement = _a[0], setViewsElement = _a[1];
919
+ var client = useVeltClient().client;
920
+ React.useEffect(function () {
921
+ if (!client || viewsElement)
922
+ return;
923
+ var loadedViewsElement = client.getViewsElement();
924
+ setViewsElement(loadedViewsElement);
925
+ }, [client, setViewsElement, viewsElement]);
926
+ return viewsElement;
927
+ }
928
+ /**
929
+ * @beta This hook is in beta
930
+ */
931
+ function useUniqueViewsByUser(clientLocationId) {
932
+ var viewsElement = useViewsUtils();
933
+ var _a = React.useState(null), data = _a[0], setData = _a[1];
934
+ useEffect(function () {
935
+ if (!(viewsElement === null || viewsElement === void 0 ? void 0 : viewsElement.getUniqueViewsByUser))
936
+ return;
937
+ var subscription = viewsElement.getUniqueViewsByUser(clientLocationId).subscribe(function (res) {
938
+ setData(res);
939
+ });
940
+ return function () {
941
+ subscription.unsubscribe();
942
+ };
943
+ }, [viewsElement === null || viewsElement === void 0 ? void 0 : viewsElement.getUniqueViewsByUser]);
944
+ return data;
945
+ }
946
+ /**
947
+ * @beta This hook is in beta
948
+ */
949
+ function useUniqueViewsByDate(clientLocationId) {
950
+ var viewsElement = useViewsUtils();
951
+ var _a = React.useState(null), data = _a[0], setData = _a[1];
952
+ useEffect(function () {
953
+ if (!(viewsElement === null || viewsElement === void 0 ? void 0 : viewsElement.getUniqueViewsByDate))
954
+ return;
955
+ var subscription = viewsElement.getUniqueViewsByDate(clientLocationId).subscribe(function (res) {
956
+ setData(res);
957
+ });
958
+ return function () {
959
+ subscription.unsubscribe();
960
+ };
961
+ }, [viewsElement === null || viewsElement === void 0 ? void 0 : viewsElement.getUniqueViewsByDate]);
962
+ return data;
963
+ }
964
+
902
965
  var sessionId = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
903
966
  var getSessionId = function () {
904
967
  return sessionId;
@@ -975,5 +1038,5 @@ var logLiveState = function (action, liveStateDataId) {
975
1038
  }
976
1039
  };
977
1040
 
978
- export { SnippylyArrowTool as VeltArrowTool, SnippylyArrows as VeltArrows, SnippylyCommentBubble as VeltCommentBubble, VeltCommentPlayerTimeline, SnippylyCommentTool as VeltCommentTool, SnippylyComments as VeltComments, SnippylyCommentsSidebar as VeltCommentsSidebar, SnippylyCursor as VeltCursor, SnippylyHuddle as VeltHuddle, SnippylyHuddleTool as VeltHuddleTool, SnippylyPresence as VeltPresence, SnippylyProvider as VeltProvider, SnippylyRecorderControlPanel as VeltRecorderControlPanel, SnippylyRecorderNotes as VeltRecorderNotes, SnippylyRecorderPlayer as VeltRecorderPlayer, SnippylyRecorderTool as VeltRecorderTool, SnippylySidebarButton as VeltSidebarButton, SnippylyTagTool as VeltTagTool, SnippylyTags as VeltTags, SnippylyUserInviteTool as VeltUserInviteTool, SnippylyUserRequestTool as VeltUserRequestTool, VeltVideoPlayer, createLiveStateMiddleware, useAIRewriterUtils, useAddLocation, useClient, useCommentAddHandler, useCommentAnnotations, useCommentDialogSidebarClickHandler, useCommentModeState, useCommentUpdateHandler, useCommentUtils, useCursorUsers, useCursorUtils, useEditor, useEditorAccessRequestHandler, useHuddleUtils, useIdentify, useLiveSelectionUtils, useLiveState, useLiveStateData, useLiveStateSyncUtils, usePresenceUsers, usePresenceUtils, useRecorderAddHandler, useRecorderUtils, useSetDocumentId, useSetLiveStateData, useSetLocation, useTagAnnotations, useTagUtils, useUserEditorState, useVeltClient };
1041
+ export { SnippylyArrowTool as VeltArrowTool, SnippylyArrows as VeltArrows, SnippylyCommentBubble as VeltCommentBubble, VeltCommentPlayerTimeline, SnippylyCommentTool as VeltCommentTool, SnippylyComments as VeltComments, SnippylyCommentsSidebar as VeltCommentsSidebar, SnippylyCursor as VeltCursor, VeltDocumentViewerTrend, SnippylyHuddle as VeltHuddle, SnippylyHuddleTool as VeltHuddleTool, SnippylyPresence as VeltPresence, SnippylyProvider as VeltProvider, SnippylyRecorderControlPanel as VeltRecorderControlPanel, SnippylyRecorderNotes as VeltRecorderNotes, SnippylyRecorderPlayer as VeltRecorderPlayer, SnippylyRecorderTool as VeltRecorderTool, SnippylySidebarButton as VeltSidebarButton, SnippylyTagTool as VeltTagTool, SnippylyTags as VeltTags, SnippylyUserInviteTool as VeltUserInviteTool, SnippylyUserRequestTool as VeltUserRequestTool, VeltVideoPlayer, createLiveStateMiddleware, useAIRewriterUtils, useAddLocation, useClient, useCommentAddHandler, useCommentAnnotations, useCommentDialogSidebarClickHandler, useCommentModeState, useCommentUpdateHandler, useCommentUtils, useCursorUsers, useCursorUtils, useEditor, useEditorAccessRequestHandler, useHuddleUtils, useIdentify, useLiveSelectionUtils, useLiveState, useLiveStateData, useLiveStateSyncUtils, usePresenceUsers, usePresenceUtils, useRecorderAddHandler, useRecorderUtils, useSetDocumentId, useSetLiveStateData, useSetLocation, useTagAnnotations, useTagUtils, useUniqueViewsByDate, useUniqueViewsByUser, useUserEditorState, useVeltClient, useViewsUtils };
979
1042
  //# sourceMappingURL=index.js.map