@veltdev/react 1.0.98 → 1.0.100

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.
@@ -2,7 +2,9 @@ import React from 'react';
2
2
  import { Config, Velt } from '@veltdev/types';
3
3
  export interface IVeltProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> {
4
4
  apiKey: string;
5
- config?: Config;
5
+ config?: Config & {
6
+ proxyDomain?: string;
7
+ };
6
8
  user?: any;
7
9
  documentId?: string;
8
10
  language?: string;
@@ -1,2 +1,2 @@
1
- export declare const VELT_SDK_VERSION = "1.0.111";
1
+ export declare const VELT_SDK_VERSION = "1.0.112";
2
2
  export declare const VELT_SDK_INIT_EVENT = "onVeltInit";
@@ -1,4 +1,4 @@
1
- import { LiveStateSyncElement, User, UserEditorAccess } from "@veltdev/types";
1
+ import { EditorAccessTimer, LiveStateSyncElement, User, UserEditorAccess } from "@veltdev/types";
2
2
  /**
3
3
  * @beta This hook is in beta
4
4
  */
@@ -19,6 +19,10 @@ export declare function useUserEditorState(): UserEditorAccess | null;
19
19
  * @beta This hook is in beta
20
20
  */
21
21
  export declare function useEditor(): User | null;
22
+ /**
23
+ * @beta This hook is in beta
24
+ */
25
+ export declare function useEditorAccessTimer(): EditorAccessTimer;
22
26
  /**
23
27
  * @beta This hook is in beta
24
28
  */
@@ -2,7 +2,7 @@ export { useAddLocation, useSetLocation, useSetDocumentId, useIdentify, useClien
2
2
  export { useCommentUtils, useCommentAnnotations, useCommentAddHandler, useCommentModeState, useCommentUpdateHandler, useCommentDialogSidebarClickHandler, } from './CommentElement';
3
3
  export { useCursorUtils, useCursorUsers, } from './CursorElement';
4
4
  export { useHuddleUtils, } from './HuddleElement';
5
- export { useLiveStateSyncUtils, useLiveStateData, useSetLiveStateData, useUserEditorState, useEditor, useEditorAccessRequestHandler, useLiveState, } from './LiveStateSyncElement';
5
+ export { useLiveStateSyncUtils, useLiveStateData, useSetLiveStateData, useUserEditorState, useEditor, useEditorAccessTimer, useEditorAccessRequestHandler, useLiveState, } from './LiveStateSyncElement';
6
6
  export { usePresenceUtils, usePresenceUsers, } from './PresenceElement';
7
7
  export { useRecorderUtils, useRecorderAddHandler, } from './RecorderElement';
8
8
  export { useAIRewriterUtils, } from './RewriterElement';
@@ -1,2 +1,2 @@
1
- declare const loadVelt: (callback: Function, version?: string, staging?: boolean, develop?: boolean) => void;
1
+ declare const loadVelt: (callback: Function, version?: string, staging?: boolean, develop?: boolean, proxyDomain?: string) => void;
2
2
  export default loadVelt;
package/esm/index.js CHANGED
@@ -69,7 +69,7 @@ function useVeltClient() {
69
69
  return useContext(VeltContext);
70
70
  }
71
71
 
72
- var loadVelt = function (callback, version, staging, develop) {
72
+ var loadVelt = function (callback, version, staging, develop, proxyDomain) {
73
73
  if (version === void 0) { version = 'latest'; }
74
74
  if (staging === void 0) { staging = false; }
75
75
  if (develop === void 0) { develop = false; }
@@ -83,7 +83,16 @@ var loadVelt = function (callback, version, staging, develop) {
83
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
84
  }
85
85
  else {
86
- script.src = "https://cdn.jsdelivr.net/npm/@veltdev/sdk@".concat(version, "/velt.js");
86
+ if (proxyDomain) {
87
+ // remove trailing slash from proxy
88
+ if (proxyDomain[proxyDomain.length - 1] === '/') {
89
+ proxyDomain = proxyDomain.slice(0, -1);
90
+ }
91
+ script.src = "".concat(proxyDomain, "/lib/sdk@").concat(version, "/velt.js");
92
+ }
93
+ else {
94
+ script.src = "https://cdn.jsdelivr.net/npm/@veltdev/sdk@".concat(version, "/velt.js");
95
+ }
87
96
  }
88
97
  script.id = 'veltScript';
89
98
  script.type = 'module';
@@ -101,7 +110,7 @@ var loadVelt = function (callback, version, staging, develop) {
101
110
  }
102
111
  };
103
112
 
104
- var VELT_SDK_VERSION = '1.0.111';
113
+ var VELT_SDK_VERSION = '1.0.112';
105
114
  var VELT_SDK_INIT_EVENT = 'onVeltInit';
106
115
 
107
116
  var SnippylyProvider = function (props) {
@@ -111,7 +120,7 @@ var SnippylyProvider = function (props) {
111
120
  if (apiKey) {
112
121
  loadVelt(function () {
113
122
  initVelt();
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);
123
+ }, (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, config === null || config === void 0 ? void 0 : config.proxyDomain);
115
124
  }
116
125
  }, []);
117
126
  var initVelt = function () { return __awaiter(void 0, void 0, void 0, function () {
@@ -130,6 +139,9 @@ var SnippylyProvider = function (props) {
130
139
  if (config.version) {
131
140
  delete config.version;
132
141
  }
142
+ if (config === null || config === void 0 ? void 0 : config.proxyDomain) {
143
+ delete config.proxyDomain;
144
+ }
133
145
  return [4 /*yield*/, ((_a = window.Velt) === null || _a === void 0 ? void 0 : _a.init(apiKey, config))];
134
146
  case 1:
135
147
  velt = _c.sent();
@@ -844,6 +856,24 @@ function useEditor() {
844
856
  }, [liveStateSyncElement === null || liveStateSyncElement === void 0 ? void 0 : liveStateSyncElement.getEditor]);
845
857
  return data;
846
858
  }
859
+ /**
860
+ * @beta This hook is in beta
861
+ */
862
+ function useEditorAccessTimer() {
863
+ var liveStateSyncElement = useLiveStateSyncUtils();
864
+ var _a = React.useState({ state: 'idle' }), data = _a[0], setData = _a[1];
865
+ useEffect(function () {
866
+ if (!(liveStateSyncElement === null || liveStateSyncElement === void 0 ? void 0 : liveStateSyncElement.getEditorAccessTimer))
867
+ return;
868
+ var subscription = liveStateSyncElement.getEditorAccessTimer().subscribe(function (res) {
869
+ setData(res);
870
+ });
871
+ return function () {
872
+ subscription.unsubscribe();
873
+ };
874
+ }, [liveStateSyncElement === null || liveStateSyncElement === void 0 ? void 0 : liveStateSyncElement.getEditorAccessTimer]);
875
+ return data;
876
+ }
847
877
  /**
848
878
  * @beta This hook is in beta
849
879
  */
@@ -1211,5 +1241,5 @@ var logLiveState = function (action, liveStateDataId) {
1211
1241
  }
1212
1242
  };
1213
1243
 
1214
- export { SnippylyArrowTool as VeltArrowTool, SnippylyArrows as VeltArrows, SnippylyCommentBubble as VeltCommentBubble, VeltCommentPlayerTimeline, VeltCommentThread, SnippylyCommentTool as VeltCommentTool, SnippylyComments as VeltComments, SnippylyCommentsSidebar as VeltCommentsSidebar, SnippylyCursor as VeltCursor, SnippylyHuddle as VeltHuddle, SnippylyHuddleTool as VeltHuddleTool, VeltNivoChartComments, VeltNotificationsHistoryPanel, VeltNotificationsPanel, VeltNotificationsTool, 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, VeltViewAnalytics, createLiveStateMiddleware, useAIRewriterUtils, useAddLocation, useClient, useCommentAddHandler, useCommentAnnotations, useCommentDialogSidebarClickHandler, useCommentModeState, useCommentUpdateHandler, useCommentUtils, useCursorUsers, useCursorUtils, useEditor, useEditorAccessRequestHandler, useHuddleUtils, useIdentify, useLiveSelectionUtils, useLiveState, useLiveStateData, useLiveStateSyncUtils, useNotificationUtils, useNotificationsData, usePresenceUsers, usePresenceUtils, useRecorderAddHandler, useRecorderUtils, useSetDocumentId, useSetLiveStateData, useSetLocation, useTagAnnotations, useTagUtils, useUniqueViewsByDate, useUniqueViewsByUser, useUserEditorState, useVeltClient, useViewsUtils };
1244
+ export { SnippylyArrowTool as VeltArrowTool, SnippylyArrows as VeltArrows, SnippylyCommentBubble as VeltCommentBubble, VeltCommentPlayerTimeline, VeltCommentThread, SnippylyCommentTool as VeltCommentTool, SnippylyComments as VeltComments, SnippylyCommentsSidebar as VeltCommentsSidebar, SnippylyCursor as VeltCursor, SnippylyHuddle as VeltHuddle, SnippylyHuddleTool as VeltHuddleTool, VeltNivoChartComments, VeltNotificationsHistoryPanel, VeltNotificationsPanel, VeltNotificationsTool, 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, VeltViewAnalytics, createLiveStateMiddleware, useAIRewriterUtils, useAddLocation, useClient, useCommentAddHandler, useCommentAnnotations, useCommentDialogSidebarClickHandler, useCommentModeState, useCommentUpdateHandler, useCommentUtils, useCursorUsers, useCursorUtils, useEditor, useEditorAccessRequestHandler, useEditorAccessTimer, useHuddleUtils, useIdentify, useLiveSelectionUtils, useLiveState, useLiveStateData, useLiveStateSyncUtils, useNotificationUtils, useNotificationsData, usePresenceUsers, usePresenceUtils, useRecorderAddHandler, useRecorderUtils, useSetDocumentId, useSetLiveStateData, useSetLocation, useTagAnnotations, useTagUtils, useUniqueViewsByDate, useUniqueViewsByUser, useUserEditorState, useVeltClient, useViewsUtils };
1215
1245
  //# sourceMappingURL=index.js.map