@veltdev/react 4.5.0-beta.29 → 4.5.0-beta.30

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
@@ -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.29';
147
+ var VELT_SDK_VERSION = '4.5.0-beta.30';
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.29': 'sha384-ZTL8fw6HHQQFUCtbKH4bGxkRIDKjTNIwH05ok39IUtVxaKajwPXNjoXsDycYot1g',
153
+ '4.5.0-beta.30': 'sha384-y/HvXXtkHBzwnUEccSp+ehtpde5oqQz9TzVxg19N5ScNBb2EGk6LgAvwx+9ofkBn',
154
154
  };
155
155
 
156
156
  var SnippylyProvider = function (props) {
@@ -7206,6 +7206,47 @@ function useUnreadNotificationsCount() {
7206
7206
  }, [notificationElement === null || notificationElement === void 0 ? void 0 : notificationElement.getUnreadNotificationsCount]);
7207
7207
  return data;
7208
7208
  }
7209
+ function useNotificationSettings() {
7210
+ var notificationElement = useNotificationUtils();
7211
+ var _a = React__default["default"].useState(null), settings = _a[0], setSettings = _a[1];
7212
+ var _b = React__default["default"].useState(undefined), settingsData = _b[0], setSettingsData = _b[1];
7213
+ var _c = React__default["default"].useState(undefined), settingsInitialConfigData = _c[0], setSettingsInitialConfigData = _c[1];
7214
+ React.useEffect(function () {
7215
+ if ((notificationElement === null || notificationElement === void 0 ? void 0 : notificationElement.setSettingsInitialConfig) && settingsInitialConfigData) {
7216
+ notificationElement.setSettingsInitialConfig(settingsInitialConfigData);
7217
+ }
7218
+ }, [notificationElement === null || notificationElement === void 0 ? void 0 : notificationElement.setSettingsInitialConfig, settingsInitialConfigData]);
7219
+ React.useEffect(function () {
7220
+ if ((notificationElement === null || notificationElement === void 0 ? void 0 : notificationElement.setSettings) && settingsData) {
7221
+ notificationElement.setSettings(settingsData);
7222
+ }
7223
+ }, [notificationElement === null || notificationElement === void 0 ? void 0 : notificationElement.setSettings, settingsData]);
7224
+ React.useEffect(function () {
7225
+ var _a;
7226
+ if (!(notificationElement === null || notificationElement === void 0 ? void 0 : notificationElement.getSettings))
7227
+ return;
7228
+ // Added this check to make is backward compatible with the old version of the SDK where getSettings() returns value instead of observable
7229
+ if (!((_a = notificationElement === null || notificationElement === void 0 ? void 0 : notificationElement.getSettings()) === null || _a === void 0 ? void 0 : _a.subscribe))
7230
+ return;
7231
+ var subscription = notificationElement.getSettings().subscribe(function (res) {
7232
+ setSettings(res);
7233
+ });
7234
+ return function () {
7235
+ subscription.unsubscribe();
7236
+ };
7237
+ }, [notificationElement === null || notificationElement === void 0 ? void 0 : notificationElement.getSettings]);
7238
+ var setSettingsInitialConfigCallback = React__default["default"].useCallback(function (settingsInitialConfig) {
7239
+ setSettingsInitialConfigData(settingsInitialConfig);
7240
+ }, []);
7241
+ var setSettingsCallback = React__default["default"].useCallback(function (settings) {
7242
+ setSettingsData(settings);
7243
+ }, []);
7244
+ return {
7245
+ settings: settings,
7246
+ setSettings: setSettingsCallback,
7247
+ setSettingsInitialConfig: setSettingsInitialConfigCallback,
7248
+ };
7249
+ }
7209
7250
 
7210
7251
  function useNotificationEventCallback(action) {
7211
7252
  var notificationElement = useNotificationUtils();
@@ -7595,6 +7636,7 @@ exports.useLiveStateData = useLiveStateData;
7595
7636
  exports.useLiveStateSyncEventCallback = useLiveStateSyncEventCallback;
7596
7637
  exports.useLiveStateSyncUtils = useLiveStateSyncUtils;
7597
7638
  exports.useNotificationEventCallback = useNotificationEventCallback;
7639
+ exports.useNotificationSettings = useNotificationSettings;
7598
7640
  exports.useNotificationUtils = useNotificationUtils;
7599
7641
  exports.useNotificationsData = useNotificationsData;
7600
7642
  exports.usePresenceData = usePresenceData;