@veltdev/react 4.6.6-beta.1 → 4.6.6

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 CHANGED
@@ -145,13 +145,13 @@ var loadVelt = function (callback, version, staging, develop, proxyDomain, integ
145
145
  }
146
146
  };
147
147
 
148
- var VELT_SDK_VERSION = '4.6.6-beta.1';
148
+ var VELT_SDK_VERSION = '4.6.6';
149
149
  var VELT_SDK_INIT_EVENT = 'onVeltInit';
150
150
  var VELT_TAB_ID = 'veltTabId';
151
151
  // integrity map for the Velt SDK
152
152
  // Note: generate integrity hashes with: https://www.srihash.org/
153
153
  var INTEGRITY_MAP = {
154
- '4.6.6-beta.1': 'sha384-NI8wMCE1+kHbHcBudzIDxWHljA/Gl1+np16v6fEwjU1iwmgqELj2Jpzyn19O6peM',
154
+ '4.6.6': 'sha384-NwjxBARMh0QyZR9MFw1alVnq9kG8FMREeH+x/2yu8PPQ2SjkpwrRJ01JjlfDhPrz',
155
155
  };
156
156
 
157
157
  var validProps = ['veltIf', 'veltClass', 'className', 'variant'];
@@ -6283,6 +6283,31 @@ function useCurrentUser() {
6283
6283
  }, [client === null || client === void 0 ? void 0 : client.getCurrentUser]);
6284
6284
  return data;
6285
6285
  }
6286
+ function useCurrentUserPermissions() {
6287
+ var client = useVeltClient().client;
6288
+ var _a = React__default["default"].useState(), data = _a[0], setData = _a[1];
6289
+ var subscriptionRef = React__default["default"].useRef();
6290
+ React__default["default"].useEffect(function () {
6291
+ if (!(client === null || client === void 0 ? void 0 : client.getCurrentUserPermissions))
6292
+ return;
6293
+ // Unsubscribe from the previous subscription if it exists
6294
+ if (subscriptionRef.current) {
6295
+ subscriptionRef.current.unsubscribe();
6296
+ }
6297
+ var subscription = client.getCurrentUserPermissions().subscribe(function (res) {
6298
+ setData(res);
6299
+ });
6300
+ // Store the new subscription
6301
+ subscriptionRef.current = subscription;
6302
+ // Cleanup function.
6303
+ return function () {
6304
+ if (subscriptionRef.current) {
6305
+ subscriptionRef.current.unsubscribe();
6306
+ }
6307
+ };
6308
+ }, [client === null || client === void 0 ? void 0 : client.getCurrentUserPermissions]);
6309
+ return data;
6310
+ }
6286
6311
 
6287
6312
  function useCommentUtils() {
6288
6313
  var _a = React__default["default"].useState(), commentElement = _a[0], setCommentElement = _a[1];
@@ -8129,6 +8154,7 @@ exports.useContactSelected = useContactSelected;
8129
8154
  exports.useContactUtils = useContactUtils;
8130
8155
  exports.useCopyLink = useCopyLink;
8131
8156
  exports.useCurrentUser = useCurrentUser;
8157
+ exports.useCurrentUserPermissions = useCurrentUserPermissions;
8132
8158
  exports.useCursorUsers = useCursorUsers;
8133
8159
  exports.useCursorUtils = useCursorUtils;
8134
8160
  exports.useDeleteAttachment = useDeleteAttachment;