@veltdev/react 4.5.0-beta.18 → 4.5.0-beta.19
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 +60 -8
- package/cjs/index.js.map +1 -1
- package/cjs/types/constants.d.ts +1 -1
- package/cjs/types/hooks/Client.d.ts +10 -1
- package/cjs/types/hooks/index.d.ts +1 -1
- package/esm/index.js +58 -9
- package/esm/index.js.map +1 -1
- package/esm/types/constants.d.ts +1 -1
- package/esm/types/hooks/Client.d.ts +10 -1
- package/esm/types/hooks/index.d.ts +1 -1
- package/index.d.ts +11 -2
- package/package.json +1 -1
package/cjs/index.js
CHANGED
|
@@ -144,13 +144,13 @@ var loadVelt = function (callback, version, staging, develop, proxyDomain, integ
|
|
|
144
144
|
}
|
|
145
145
|
};
|
|
146
146
|
|
|
147
|
-
var VELT_SDK_VERSION = '4.5.0-beta.
|
|
147
|
+
var VELT_SDK_VERSION = '4.5.0-beta.19';
|
|
148
148
|
var VELT_SDK_INIT_EVENT = 'onVeltInit';
|
|
149
149
|
var VELT_TAB_ID = 'veltTabId';
|
|
150
150
|
// integrity map for the Velt SDK
|
|
151
151
|
// Note: generate integrity hashes with: https://www.srihash.org/
|
|
152
152
|
var INTEGRITY_MAP = {
|
|
153
|
-
'4.5.0-beta.
|
|
153
|
+
'4.5.0-beta.19': 'sha384-4cBwejg47Xi4Abp4w1UbJFsRB4U3qD9k4MXj7WHVNFl+9zG/EGQJw07I00JkGORv',
|
|
154
154
|
};
|
|
155
155
|
|
|
156
156
|
var SnippylyProvider = function (props) {
|
|
@@ -5607,15 +5607,15 @@ function useSetDocuments() {
|
|
|
5607
5607
|
var client = useVeltClient().client;
|
|
5608
5608
|
var _a = React__default["default"].useState(undefined), data = _a[0], setData = _a[1];
|
|
5609
5609
|
// Memoize the setDocuments call
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
}, [JSON.stringify(data
|
|
5610
|
+
// const memoizedData = React.useMemo(() => {
|
|
5611
|
+
// return data;
|
|
5612
|
+
// }, [JSON.stringify(data?.documents), JSON.stringify(data?.options)]);
|
|
5613
5613
|
React__default["default"].useEffect(function () {
|
|
5614
5614
|
var _a;
|
|
5615
|
-
if (client && ((_a =
|
|
5616
|
-
client.setDocuments(
|
|
5615
|
+
if ((client === null || client === void 0 ? void 0 : client.setDocuments) && ((_a = data === null || data === void 0 ? void 0 : data.documents) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
5616
|
+
client.setDocuments(data.documents, data.options);
|
|
5617
5617
|
}
|
|
5618
|
-
}, [client === null || client === void 0 ? void 0 : client.setDocuments,
|
|
5618
|
+
}, [client === null || client === void 0 ? void 0 : client.setDocuments, data]);
|
|
5619
5619
|
// Memoize the setDocuments callback
|
|
5620
5620
|
var setDocumentsCallback = React__default["default"].useCallback(function (documents, options) {
|
|
5621
5621
|
setData({ documents: documents, options: options });
|
|
@@ -5624,6 +5624,22 @@ function useSetDocuments() {
|
|
|
5624
5624
|
setDocuments: setDocumentsCallback
|
|
5625
5625
|
};
|
|
5626
5626
|
}
|
|
5627
|
+
function useSetRootDocument() {
|
|
5628
|
+
var client = useVeltClient().client;
|
|
5629
|
+
var _a = React__default["default"].useState(undefined), data = _a[0], setData = _a[1];
|
|
5630
|
+
React__default["default"].useEffect(function () {
|
|
5631
|
+
if ((client === null || client === void 0 ? void 0 : client.setRootDocument) && data) {
|
|
5632
|
+
client.setRootDocument(data);
|
|
5633
|
+
}
|
|
5634
|
+
}, [client === null || client === void 0 ? void 0 : client.setRootDocument, data]);
|
|
5635
|
+
// Memoize the setRootDocument callback
|
|
5636
|
+
var setRootDocumentCallback = React__default["default"].useCallback(function (document) {
|
|
5637
|
+
setData(document);
|
|
5638
|
+
}, []); // Empty dependency array since it only uses setState which is stable
|
|
5639
|
+
return {
|
|
5640
|
+
setRootDocument: setRootDocumentCallback
|
|
5641
|
+
};
|
|
5642
|
+
}
|
|
5627
5643
|
function useUnsetDocumentId() {
|
|
5628
5644
|
var client = useVeltClient().client;
|
|
5629
5645
|
React__default["default"].useEffect(function () {
|
|
@@ -5648,6 +5664,39 @@ function useSetLocation(location, appendLocation) {
|
|
|
5648
5664
|
}
|
|
5649
5665
|
}, [client, shouldSetLocation]);
|
|
5650
5666
|
}
|
|
5667
|
+
function useSetLocations() {
|
|
5668
|
+
var client = useVeltClient().client;
|
|
5669
|
+
var _a = React__default["default"].useState(undefined), data = _a[0], setData = _a[1];
|
|
5670
|
+
React__default["default"].useEffect(function () {
|
|
5671
|
+
var _a;
|
|
5672
|
+
if ((client === null || client === void 0 ? void 0 : client.setLocations) && ((_a = data === null || data === void 0 ? void 0 : data.locations) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
5673
|
+
client.setLocations(data.locations, data.options);
|
|
5674
|
+
}
|
|
5675
|
+
}, [client === null || client === void 0 ? void 0 : client.setLocations, data]);
|
|
5676
|
+
// Memoize the setLocations callback
|
|
5677
|
+
var setLocationsCallback = React__default["default"].useCallback(function (locations, options) {
|
|
5678
|
+
setData({ locations: locations, options: options });
|
|
5679
|
+
}, []); // Empty dependency array since it only uses setState which is stable
|
|
5680
|
+
return {
|
|
5681
|
+
setLocations: setLocationsCallback
|
|
5682
|
+
};
|
|
5683
|
+
}
|
|
5684
|
+
function useSetRootLocation() {
|
|
5685
|
+
var client = useVeltClient().client;
|
|
5686
|
+
var _a = React__default["default"].useState(undefined), data = _a[0], setData = _a[1];
|
|
5687
|
+
React__default["default"].useEffect(function () {
|
|
5688
|
+
if ((client === null || client === void 0 ? void 0 : client.setRootLocation) && data) {
|
|
5689
|
+
client.setRootLocation(data);
|
|
5690
|
+
}
|
|
5691
|
+
}, [client === null || client === void 0 ? void 0 : client.setRootLocation, data]);
|
|
5692
|
+
// Memoize the setRootLocation callback
|
|
5693
|
+
var setRootLocationCallback = React__default["default"].useCallback(function (location) {
|
|
5694
|
+
setData(location);
|
|
5695
|
+
}, []); // Empty dependency array since it only uses setState which is stable
|
|
5696
|
+
return {
|
|
5697
|
+
setRootLocation: setRootLocationCallback
|
|
5698
|
+
};
|
|
5699
|
+
}
|
|
5651
5700
|
function useVeltInitState() {
|
|
5652
5701
|
var client = useVeltClient().client;
|
|
5653
5702
|
var _a = React__default["default"].useState(), data = _a[0], setData = _a[1];
|
|
@@ -7485,6 +7534,9 @@ exports.useSetDocumentId = useSetDocumentId;
|
|
|
7485
7534
|
exports.useSetDocuments = useSetDocuments;
|
|
7486
7535
|
exports.useSetLiveStateData = useSetLiveStateData;
|
|
7487
7536
|
exports.useSetLocation = useSetLocation;
|
|
7537
|
+
exports.useSetLocations = useSetLocations;
|
|
7538
|
+
exports.useSetRootDocument = useSetRootDocument;
|
|
7539
|
+
exports.useSetRootLocation = useSetRootLocation;
|
|
7488
7540
|
exports.useSubscribeCommentAnnotation = useSubscribeCommentAnnotation;
|
|
7489
7541
|
exports.useTagAnnotations = useTagAnnotations;
|
|
7490
7542
|
exports.useTagUtils = useTagUtils;
|