@veltdev/react 1.0.97 → 1.0.99
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.
- package/cjs/index.js +56 -22
- package/cjs/index.js.map +1 -1
- package/cjs/types/constants.d.ts +1 -1
- package/cjs/types/hooks/LiveStateSyncElement.d.ts +5 -1
- package/cjs/types/hooks/index.d.ts +1 -1
- package/cjs/types/redux/veltLiveStateSynceMiddleware.d.ts +4 -1
- package/esm/index.js +56 -23
- package/esm/index.js.map +1 -1
- package/esm/types/constants.d.ts +1 -1
- package/esm/types/hooks/LiveStateSyncElement.d.ts +5 -1
- package/esm/types/hooks/index.d.ts +1 -1
- package/esm/types/redux/veltLiveStateSynceMiddleware.d.ts +4 -1
- package/index.d.ts +10 -3
- package/package.json +1 -1
package/cjs/types/constants.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VELT_SDK_VERSION = "1.0.
|
|
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';
|
|
@@ -4,5 +4,8 @@ declare type LiveStateMiddlewareConfig = {
|
|
|
4
4
|
allowAction?: (action: any) => boolean;
|
|
5
5
|
liveStateDataId?: string;
|
|
6
6
|
};
|
|
7
|
-
export declare const createLiveStateMiddleware: (config?: LiveStateMiddlewareConfig) =>
|
|
7
|
+
export declare const createLiveStateMiddleware: (config?: LiveStateMiddlewareConfig) => {
|
|
8
|
+
middleware: (store: any) => (next: any) => (action: any) => any;
|
|
9
|
+
updateLiveStateDataId: (newId?: string) => void;
|
|
10
|
+
};
|
|
8
11
|
export {};
|
package/esm/index.js
CHANGED
|
@@ -101,7 +101,7 @@ var loadVelt = function (callback, version, staging, develop) {
|
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
103
|
|
|
104
|
-
var VELT_SDK_VERSION = '1.0.
|
|
104
|
+
var VELT_SDK_VERSION = '1.0.112';
|
|
105
105
|
var VELT_SDK_INIT_EVENT = 'onVeltInit';
|
|
106
106
|
|
|
107
107
|
var SnippylyProvider = function (props) {
|
|
@@ -844,6 +844,24 @@ function useEditor() {
|
|
|
844
844
|
}, [liveStateSyncElement === null || liveStateSyncElement === void 0 ? void 0 : liveStateSyncElement.getEditor]);
|
|
845
845
|
return data;
|
|
846
846
|
}
|
|
847
|
+
/**
|
|
848
|
+
* @beta This hook is in beta
|
|
849
|
+
*/
|
|
850
|
+
function useEditorAccessTimer() {
|
|
851
|
+
var liveStateSyncElement = useLiveStateSyncUtils();
|
|
852
|
+
var _a = React.useState({ state: 'idle' }), data = _a[0], setData = _a[1];
|
|
853
|
+
useEffect(function () {
|
|
854
|
+
if (!(liveStateSyncElement === null || liveStateSyncElement === void 0 ? void 0 : liveStateSyncElement.getEditorAccessTimer))
|
|
855
|
+
return;
|
|
856
|
+
var subscription = liveStateSyncElement.getEditorAccessTimer().subscribe(function (res) {
|
|
857
|
+
setData(res);
|
|
858
|
+
});
|
|
859
|
+
return function () {
|
|
860
|
+
subscription.unsubscribe();
|
|
861
|
+
};
|
|
862
|
+
}, [liveStateSyncElement === null || liveStateSyncElement === void 0 ? void 0 : liveStateSyncElement.getEditorAccessTimer]);
|
|
863
|
+
return data;
|
|
864
|
+
}
|
|
847
865
|
/**
|
|
848
866
|
* @beta This hook is in beta
|
|
849
867
|
*/
|
|
@@ -1137,28 +1155,39 @@ var createLiveStateMiddleware = function (config) {
|
|
|
1137
1155
|
if (!liveStateDataId) {
|
|
1138
1156
|
liveStateDataId = VELT_DEFAULT_LIVE_STATE_ID;
|
|
1139
1157
|
}
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
return;
|
|
1154
|
-
}
|
|
1155
|
-
else {
|
|
1156
|
-
store.dispatch(__assign(__assign({}, data.action), { isRemote: true }));
|
|
1157
|
-
}
|
|
1158
|
+
var internalStore; // This variable will hold the reference to the store
|
|
1159
|
+
var dataSubscription; // This variable will hold the reference to the data subscription
|
|
1160
|
+
var isSdkInitialized = false;
|
|
1161
|
+
var setupGetDataSubscription = function () {
|
|
1162
|
+
var _a, _b;
|
|
1163
|
+
if (!dataSubscription && window.Velt && ((_a = window.Velt) === null || _a === void 0 ? void 0 : _a.getLiveStateSyncElement)) {
|
|
1164
|
+
var liveStateSyncElement = (_b = window.Velt) === null || _b === void 0 ? void 0 : _b.getLiveStateSyncElement();
|
|
1165
|
+
dataSubscription = liveStateSyncElement === null || liveStateSyncElement === void 0 ? void 0 : liveStateSyncElement.getLiveStateData(liveStateDataId).subscribe(function (data) {
|
|
1166
|
+
// Dispatch action to update local state, marking it as remote
|
|
1167
|
+
if (data) {
|
|
1168
|
+
var sessionId_1 = getSessionId();
|
|
1169
|
+
if (data.id === sessionId_1) {
|
|
1170
|
+
return;
|
|
1158
1171
|
}
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1172
|
+
else {
|
|
1173
|
+
internalStore === null || internalStore === void 0 ? void 0 : internalStore.dispatch(__assign(__assign({}, data.action), { isRemote: true }));
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
};
|
|
1179
|
+
var updateLiveStateDataId = function (newId) {
|
|
1180
|
+
liveStateDataId = newId || VELT_DEFAULT_LIVE_STATE_ID;
|
|
1181
|
+
if (dataSubscription) {
|
|
1182
|
+
dataSubscription.unsubscribe();
|
|
1183
|
+
dataSubscription = null;
|
|
1184
|
+
}
|
|
1185
|
+
if (isSdkInitialized) {
|
|
1186
|
+
setupGetDataSubscription();
|
|
1187
|
+
}
|
|
1188
|
+
};
|
|
1189
|
+
var middleware = function (store) {
|
|
1190
|
+
internalStore = store;
|
|
1162
1191
|
var veltSdkInitializedListener = function () {
|
|
1163
1192
|
isSdkInitialized = true;
|
|
1164
1193
|
setupGetDataSubscription();
|
|
@@ -1177,6 +1206,10 @@ var createLiveStateMiddleware = function (config) {
|
|
|
1177
1206
|
return result;
|
|
1178
1207
|
}; };
|
|
1179
1208
|
};
|
|
1209
|
+
return {
|
|
1210
|
+
middleware: middleware,
|
|
1211
|
+
updateLiveStateDataId: updateLiveStateDataId,
|
|
1212
|
+
};
|
|
1180
1213
|
};
|
|
1181
1214
|
var logLiveState = function (action, liveStateDataId) {
|
|
1182
1215
|
var _a;
|
|
@@ -1196,5 +1229,5 @@ var logLiveState = function (action, liveStateDataId) {
|
|
|
1196
1229
|
}
|
|
1197
1230
|
};
|
|
1198
1231
|
|
|
1199
|
-
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 };
|
|
1232
|
+
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 };
|
|
1200
1233
|
//# sourceMappingURL=index.js.map
|