@veltdev/react 1.0.157 → 1.0.159
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 +30 -1
- package/cjs/index.js.map +1 -1
- package/cjs/types/constants.d.ts +1 -1
- package/cjs/types/hooks/ContactElement.d.ts +3 -0
- package/cjs/types/hooks/index.d.ts +1 -0
- package/esm/index.js +29 -2
- package/esm/index.js.map +1 -1
- package/esm/types/constants.d.ts +1 -1
- package/esm/types/hooks/ContactElement.d.ts +3 -0
- package/esm/types/hooks/index.d.ts +1 -0
- package/index.d.ts +5 -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 = '1.0.
|
|
143
|
+
var VELT_SDK_VERSION = '1.0.177';
|
|
144
144
|
var VELT_SDK_INIT_EVENT = 'onVeltInit';
|
|
145
145
|
var VELT_TAB_ID = 'veltTabId';
|
|
146
146
|
|
|
@@ -2992,6 +2992,33 @@ function useAutocompleteChipClick() {
|
|
|
2992
2992
|
return data;
|
|
2993
2993
|
}
|
|
2994
2994
|
|
|
2995
|
+
function useContactUtils() {
|
|
2996
|
+
var _a = React__default["default"].useState(), contactElement = _a[0], setContactElement = _a[1];
|
|
2997
|
+
var client = useVeltClient().client;
|
|
2998
|
+
React__default["default"].useEffect(function () {
|
|
2999
|
+
if (!client || contactElement)
|
|
3000
|
+
return;
|
|
3001
|
+
var loadedContactElement = client.getContactElement();
|
|
3002
|
+
setContactElement(loadedContactElement);
|
|
3003
|
+
}, [client, setContactElement, contactElement]);
|
|
3004
|
+
return contactElement;
|
|
3005
|
+
}
|
|
3006
|
+
function useContactSelected() {
|
|
3007
|
+
var contactElement = useContactUtils();
|
|
3008
|
+
var _a = React__default["default"].useState(), data = _a[0], setData = _a[1];
|
|
3009
|
+
React.useEffect(function () {
|
|
3010
|
+
if (!contactElement)
|
|
3011
|
+
return;
|
|
3012
|
+
var subscription = contactElement.onContactSelected().subscribe(function (res) {
|
|
3013
|
+
setData(res);
|
|
3014
|
+
});
|
|
3015
|
+
return function () {
|
|
3016
|
+
subscription.unsubscribe();
|
|
3017
|
+
};
|
|
3018
|
+
}, [contactElement === null || contactElement === void 0 ? void 0 : contactElement.onContactSelected]);
|
|
3019
|
+
return data;
|
|
3020
|
+
}
|
|
3021
|
+
|
|
2995
3022
|
var sessionId = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
|
|
2996
3023
|
var getSessionId = function () {
|
|
2997
3024
|
return (sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.getItem(VELT_TAB_ID)) || sessionId;
|
|
@@ -3151,6 +3178,8 @@ exports.useCommentModeState = useCommentModeState;
|
|
|
3151
3178
|
exports.useCommentSelectionChangeHandler = useCommentSelectionChangeHandler;
|
|
3152
3179
|
exports.useCommentUpdateHandler = useCommentUpdateHandler;
|
|
3153
3180
|
exports.useCommentUtils = useCommentUtils;
|
|
3181
|
+
exports.useContactSelected = useContactSelected;
|
|
3182
|
+
exports.useContactUtils = useContactUtils;
|
|
3154
3183
|
exports.useCursorUsers = useCursorUsers;
|
|
3155
3184
|
exports.useCursorUtils = useCursorUtils;
|
|
3156
3185
|
exports.useEditor = useEditor;
|