@veltdev/react 4.3.0-beta.4 → 4.3.0-beta.5
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 +27 -1
- package/cjs/index.js.map +1 -1
- package/cjs/types/constants.d.ts +1 -1
- package/cjs/types/hooks/ContactElement.d.ts +2 -1
- package/cjs/types/hooks/index.d.ts +1 -1
- package/esm/index.js +27 -2
- package/esm/index.js.map +1 -1
- package/esm/types/constants.d.ts +1 -1
- package/esm/types/hooks/ContactElement.d.ts +2 -1
- package/esm/types/hooks/index.d.ts +1 -1
- package/index.d.ts +3 -2
- package/package.json +1 -1
package/cjs/index.js
CHANGED
|
@@ -140,7 +140,7 @@ var loadVelt = function (callback, version, staging, develop, proxyDomain) {
|
|
|
140
140
|
}
|
|
141
141
|
};
|
|
142
142
|
|
|
143
|
-
var VELT_SDK_VERSION = '4.3.0-beta.
|
|
143
|
+
var VELT_SDK_VERSION = '4.3.0-beta.5';
|
|
144
144
|
var VELT_SDK_INIT_EVENT = 'onVeltInit';
|
|
145
145
|
var VELT_TAB_ID = 'veltTabId';
|
|
146
146
|
|
|
@@ -6512,6 +6512,31 @@ function useContactSelected() {
|
|
|
6512
6512
|
}, [contactElement === null || contactElement === void 0 ? void 0 : contactElement.onContactSelected]);
|
|
6513
6513
|
return data;
|
|
6514
6514
|
}
|
|
6515
|
+
function useContactList() {
|
|
6516
|
+
var contactElement = useContactUtils();
|
|
6517
|
+
var _a = React__default["default"].useState(null), data = _a[0], setData = _a[1];
|
|
6518
|
+
var subscriptionRef = React__default["default"].useRef();
|
|
6519
|
+
React.useEffect(function () {
|
|
6520
|
+
if (!contactElement)
|
|
6521
|
+
return;
|
|
6522
|
+
// Unsubscribe from the previous subscription if it exists
|
|
6523
|
+
if (subscriptionRef.current) {
|
|
6524
|
+
subscriptionRef.current.unsubscribe();
|
|
6525
|
+
}
|
|
6526
|
+
var subscription = contactElement.getContactList().subscribe(function (res) {
|
|
6527
|
+
setData(res);
|
|
6528
|
+
});
|
|
6529
|
+
// Store the new subscription
|
|
6530
|
+
subscriptionRef.current = subscription;
|
|
6531
|
+
// Cleanup function
|
|
6532
|
+
return function () {
|
|
6533
|
+
if (subscriptionRef.current) {
|
|
6534
|
+
subscriptionRef.current.unsubscribe();
|
|
6535
|
+
}
|
|
6536
|
+
};
|
|
6537
|
+
}, [contactElement === null || contactElement === void 0 ? void 0 : contactElement.getContactList]);
|
|
6538
|
+
return data;
|
|
6539
|
+
}
|
|
6515
6540
|
|
|
6516
6541
|
var sessionId = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
|
|
6517
6542
|
var getSessionId = function () {
|
|
@@ -6718,6 +6743,7 @@ exports.useCommentSidebarData = useCommentSidebarData;
|
|
|
6718
6743
|
exports.useCommentSidebarInit = useCommentSidebarInit;
|
|
6719
6744
|
exports.useCommentUpdateHandler = useCommentUpdateHandler;
|
|
6720
6745
|
exports.useCommentUtils = useCommentUtils;
|
|
6746
|
+
exports.useContactList = useContactList;
|
|
6721
6747
|
exports.useContactSelected = useContactSelected;
|
|
6722
6748
|
exports.useContactUtils = useContactUtils;
|
|
6723
6749
|
exports.useCopyLink = useCopyLink;
|