@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.
- package/cjs/index.js +74 -7
- package/cjs/index.js.map +1 -1
- package/cjs/types/components/SnippylyUserInviteTool/SnippylyUserInviteTool.d.ts +1 -0
- package/cjs/types/components/VeltDocumentViewerTrend/VeltDocumentViewerTrend.d.ts +7 -0
- package/cjs/types/components/VeltDocumentViewerTrend/index.d.ts +1 -0
- package/cjs/types/components/VeltVideoPlayer/VeltVideoPlayer.d.ts +1 -0
- package/cjs/types/components/index.d.ts +1 -0
- package/cjs/types/constants.d.ts +1 -1
- package/cjs/types/hooks/ViewsElement.d.ts +13 -0
- package/cjs/types/hooks/index.d.ts +1 -0
- package/cjs/types/loadSnippyly.d.ts +1 -1
- package/esm/index.js +71 -8
- package/esm/index.js.map +1 -1
- package/esm/types/components/SnippylyUserInviteTool/SnippylyUserInviteTool.d.ts +1 -0
- package/esm/types/components/VeltDocumentViewerTrend/VeltDocumentViewerTrend.d.ts +7 -0
- package/esm/types/components/VeltDocumentViewerTrend/index.d.ts +1 -0
- package/esm/types/components/VeltVideoPlayer/VeltVideoPlayer.d.ts +1 -0
- package/esm/types/components/index.d.ts +1 -0
- package/esm/types/constants.d.ts +1 -1
- package/esm/types/hooks/ViewsElement.d.ts +13 -0
- package/esm/types/hooks/index.d.ts +1 -0
- package/esm/types/loadSnippyly.d.ts +1 -1
- package/index.d.ts +23 -2
- package/package.json +1 -1
package/cjs/index.js
CHANGED
|
@@ -77,15 +77,19 @@ function useVeltClient() {
|
|
|
77
77
|
return React.useContext(VeltContext);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
var loadVelt = function (callback, version, staging) {
|
|
80
|
+
var loadVelt = function (callback, version, staging, develop) {
|
|
81
81
|
if (version === void 0) { version = 'latest'; }
|
|
82
82
|
if (staging === void 0) { staging = false; }
|
|
83
|
+
if (develop === void 0) { develop = false; }
|
|
83
84
|
var existingScript = document.getElementById('veltScript');
|
|
84
85
|
if (!existingScript) {
|
|
85
86
|
var script = document.createElement('script');
|
|
86
87
|
if (staging) {
|
|
87
88
|
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");
|
|
88
89
|
}
|
|
90
|
+
else if (develop) {
|
|
91
|
+
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");
|
|
92
|
+
}
|
|
89
93
|
else {
|
|
90
94
|
script.src = "https://cdn.jsdelivr.net/npm/@veltdev/sdk@".concat(version, "/velt.js");
|
|
91
95
|
}
|
|
@@ -105,7 +109,7 @@ var loadVelt = function (callback, version, staging) {
|
|
|
105
109
|
}
|
|
106
110
|
};
|
|
107
111
|
|
|
108
|
-
var VELT_SDK_VERSION = '1.0.
|
|
112
|
+
var VELT_SDK_VERSION = '1.0.98';
|
|
109
113
|
var VELT_SDK_INIT_EVENT = 'onVeltInit';
|
|
110
114
|
|
|
111
115
|
var SnippylyProvider = function (props) {
|
|
@@ -115,7 +119,7 @@ var SnippylyProvider = function (props) {
|
|
|
115
119
|
if (apiKey) {
|
|
116
120
|
loadVelt(function () {
|
|
117
121
|
initVelt();
|
|
118
|
-
}, (config === null || config === void 0 ? void 0 : config.version) || VELT_SDK_VERSION, config === null || config === void 0 ? void 0 : config.staging);
|
|
122
|
+
}, (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);
|
|
119
123
|
}
|
|
120
124
|
}, []);
|
|
121
125
|
var initVelt = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -128,6 +132,9 @@ var SnippylyProvider = function (props) {
|
|
|
128
132
|
if (config.staging) {
|
|
129
133
|
delete config.staging;
|
|
130
134
|
}
|
|
135
|
+
if (config.develop) {
|
|
136
|
+
delete config.develop;
|
|
137
|
+
}
|
|
131
138
|
if (config.version) {
|
|
132
139
|
delete config.version;
|
|
133
140
|
}
|
|
@@ -403,8 +410,8 @@ var SnippylyArrowTool = function (props) {
|
|
|
403
410
|
};
|
|
404
411
|
|
|
405
412
|
var SnippylyUserInviteTool = function (props) {
|
|
406
|
-
var type = props.type, source = props.source, title = props.title, placeholder = props.placeholder, accessControlDropdown = props.accessControlDropdown, documentUserAccessList = props.documentUserAccessList, children = props.children;
|
|
407
|
-
return (React__default["default"].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));
|
|
413
|
+
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;
|
|
414
|
+
return (React__default["default"].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));
|
|
408
415
|
};
|
|
409
416
|
|
|
410
417
|
var SnippylyUserRequestTool = function (props) {
|
|
@@ -429,8 +436,13 @@ var VeltCommentPlayerTimeline = function (props) {
|
|
|
429
436
|
};
|
|
430
437
|
|
|
431
438
|
var VeltVideoPlayer = function (props) {
|
|
432
|
-
var darkMode = props.darkMode, src = props.src, sync = props.sync;
|
|
433
|
-
return (React__default["default"].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 }));
|
|
439
|
+
var darkMode = props.darkMode, src = props.src, sync = props.sync, commentTool = props.commentTool;
|
|
440
|
+
return (React__default["default"].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 }));
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
var VeltDocumentViewerTrend = function (props) {
|
|
444
|
+
var type = props.type, locationId = props.locationId;
|
|
445
|
+
return (React__default["default"].createElement("velt-document-viewer-trend", { type: type, "location-id": locationId }));
|
|
434
446
|
};
|
|
435
447
|
|
|
436
448
|
/**
|
|
@@ -907,6 +919,57 @@ function useTagAnnotations(documentId, location) {
|
|
|
907
919
|
return data;
|
|
908
920
|
}
|
|
909
921
|
|
|
922
|
+
/**
|
|
923
|
+
* @beta This hook is in beta
|
|
924
|
+
*/
|
|
925
|
+
function useViewsUtils() {
|
|
926
|
+
var _a = React__default["default"].useState(), viewsElement = _a[0], setViewsElement = _a[1];
|
|
927
|
+
var client = useVeltClient().client;
|
|
928
|
+
React__default["default"].useEffect(function () {
|
|
929
|
+
if (!client || viewsElement)
|
|
930
|
+
return;
|
|
931
|
+
var loadedViewsElement = client.getViewsElement();
|
|
932
|
+
setViewsElement(loadedViewsElement);
|
|
933
|
+
}, [client, setViewsElement, viewsElement]);
|
|
934
|
+
return viewsElement;
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* @beta This hook is in beta
|
|
938
|
+
*/
|
|
939
|
+
function useUniqueViewsByUser(clientLocationId) {
|
|
940
|
+
var viewsElement = useViewsUtils();
|
|
941
|
+
var _a = React__default["default"].useState(null), data = _a[0], setData = _a[1];
|
|
942
|
+
React.useEffect(function () {
|
|
943
|
+
if (!(viewsElement === null || viewsElement === void 0 ? void 0 : viewsElement.getUniqueViewsByUser))
|
|
944
|
+
return;
|
|
945
|
+
var subscription = viewsElement.getUniqueViewsByUser(clientLocationId).subscribe(function (res) {
|
|
946
|
+
setData(res);
|
|
947
|
+
});
|
|
948
|
+
return function () {
|
|
949
|
+
subscription.unsubscribe();
|
|
950
|
+
};
|
|
951
|
+
}, [viewsElement === null || viewsElement === void 0 ? void 0 : viewsElement.getUniqueViewsByUser]);
|
|
952
|
+
return data;
|
|
953
|
+
}
|
|
954
|
+
/**
|
|
955
|
+
* @beta This hook is in beta
|
|
956
|
+
*/
|
|
957
|
+
function useUniqueViewsByDate(clientLocationId) {
|
|
958
|
+
var viewsElement = useViewsUtils();
|
|
959
|
+
var _a = React__default["default"].useState(null), data = _a[0], setData = _a[1];
|
|
960
|
+
React.useEffect(function () {
|
|
961
|
+
if (!(viewsElement === null || viewsElement === void 0 ? void 0 : viewsElement.getUniqueViewsByDate))
|
|
962
|
+
return;
|
|
963
|
+
var subscription = viewsElement.getUniqueViewsByDate(clientLocationId).subscribe(function (res) {
|
|
964
|
+
setData(res);
|
|
965
|
+
});
|
|
966
|
+
return function () {
|
|
967
|
+
subscription.unsubscribe();
|
|
968
|
+
};
|
|
969
|
+
}, [viewsElement === null || viewsElement === void 0 ? void 0 : viewsElement.getUniqueViewsByDate]);
|
|
970
|
+
return data;
|
|
971
|
+
}
|
|
972
|
+
|
|
910
973
|
var sessionId = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
|
|
911
974
|
var getSessionId = function () {
|
|
912
975
|
return sessionId;
|
|
@@ -991,6 +1054,7 @@ exports.VeltCommentTool = SnippylyCommentTool;
|
|
|
991
1054
|
exports.VeltComments = SnippylyComments;
|
|
992
1055
|
exports.VeltCommentsSidebar = SnippylyCommentsSidebar;
|
|
993
1056
|
exports.VeltCursor = SnippylyCursor;
|
|
1057
|
+
exports.VeltDocumentViewerTrend = VeltDocumentViewerTrend;
|
|
994
1058
|
exports.VeltHuddle = SnippylyHuddle;
|
|
995
1059
|
exports.VeltHuddleTool = SnippylyHuddleTool;
|
|
996
1060
|
exports.VeltPresence = SnippylyPresence;
|
|
@@ -1034,6 +1098,9 @@ exports.useSetLiveStateData = useSetLiveStateData;
|
|
|
1034
1098
|
exports.useSetLocation = useSetLocation;
|
|
1035
1099
|
exports.useTagAnnotations = useTagAnnotations;
|
|
1036
1100
|
exports.useTagUtils = useTagUtils;
|
|
1101
|
+
exports.useUniqueViewsByDate = useUniqueViewsByDate;
|
|
1102
|
+
exports.useUniqueViewsByUser = useUniqueViewsByUser;
|
|
1037
1103
|
exports.useUserEditorState = useUserEditorState;
|
|
1038
1104
|
exports.useVeltClient = useVeltClient;
|
|
1105
|
+
exports.useViewsUtils = useViewsUtils;
|
|
1039
1106
|
//# sourceMappingURL=index.js.map
|