@veltdev/react 1.0.94 → 1.0.95

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
@@ -109,7 +109,7 @@ var loadVelt = function (callback, version, staging, develop) {
109
109
  }
110
110
  };
111
111
 
112
- var VELT_SDK_VERSION = '1.0.109';
112
+ var VELT_SDK_VERSION = '1.0.110';
113
113
  var VELT_SDK_INIT_EVENT = 'onVeltInit';
114
114
 
115
115
  var SnippylyProvider = function (props) {
@@ -487,7 +487,7 @@ var VeltNotificationsPanel = function (props) {
487
487
  return (React__default["default"].createElement("velt-notifications-panel", { ref: ref }));
488
488
  };
489
489
 
490
- var VeltNotificationsHistory = function (props) {
490
+ var VeltNotificationsHistoryPanel = function (props) {
491
491
  var embedMode = props.embedMode, onNotificationClick = props.onNotificationClick;
492
492
  var ref = React.useRef();
493
493
  React.useEffect(function () {
@@ -500,7 +500,7 @@ var VeltNotificationsHistory = function (props) {
500
500
  });
501
501
  }
502
502
  }, []);
503
- return (React__default["default"].createElement("velt-notifications-history", { ref: ref, "embed-mode": [true, false].includes(embedMode) ? (embedMode ? 'true' : 'false') : undefined }));
503
+ return (React__default["default"].createElement("velt-notifications-history-panel", { ref: ref, "embed-mode": [true, false].includes(embedMode) ? (embedMode ? 'true' : 'false') : undefined }));
504
504
  };
505
505
 
506
506
  /**
@@ -1028,6 +1028,39 @@ function useUniqueViewsByDate(clientLocationId) {
1028
1028
  return data;
1029
1029
  }
1030
1030
 
1031
+ /**
1032
+ * @beta This hook is in beta
1033
+ */
1034
+ function useNotificationUtils() {
1035
+ var _a = React__default["default"].useState(), notificationElement = _a[0], setNotificationElement = _a[1];
1036
+ var client = useVeltClient().client;
1037
+ React__default["default"].useEffect(function () {
1038
+ if (!client || notificationElement)
1039
+ return;
1040
+ var loadedNotificationElement = client.getNotificationElement();
1041
+ setNotificationElement(loadedNotificationElement);
1042
+ }, [client, setNotificationElement, notificationElement]);
1043
+ return notificationElement;
1044
+ }
1045
+ /**
1046
+ * @beta This hook is in beta
1047
+ */
1048
+ function useNotificationsData() {
1049
+ var notificationElement = useNotificationUtils();
1050
+ var _a = React__default["default"].useState([]), data = _a[0], setData = _a[1];
1051
+ React.useEffect(function () {
1052
+ if (!(notificationElement === null || notificationElement === void 0 ? void 0 : notificationElement.getNotificationsData))
1053
+ return;
1054
+ var subscription = notificationElement.getNotificationsData().subscribe(function (res) {
1055
+ setData(res);
1056
+ });
1057
+ return function () {
1058
+ subscription.unsubscribe();
1059
+ };
1060
+ }, [notificationElement === null || notificationElement === void 0 ? void 0 : notificationElement.getNotificationsData]);
1061
+ return data;
1062
+ }
1063
+
1031
1064
  var sessionId = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
1032
1065
  var getSessionId = function () {
1033
1066
  return sessionId;
@@ -1115,7 +1148,7 @@ exports.VeltCommentsSidebar = SnippylyCommentsSidebar;
1115
1148
  exports.VeltCursor = SnippylyCursor;
1116
1149
  exports.VeltHuddle = SnippylyHuddle;
1117
1150
  exports.VeltHuddleTool = SnippylyHuddleTool;
1118
- exports.VeltNotificationsHistory = VeltNotificationsHistory;
1151
+ exports.VeltNotificationsHistoryPanel = VeltNotificationsHistoryPanel;
1119
1152
  exports.VeltNotificationsPanel = VeltNotificationsPanel;
1120
1153
  exports.VeltNotificationsTool = VeltNotificationsTool;
1121
1154
  exports.VeltPresence = SnippylyPresence;
@@ -1151,6 +1184,8 @@ exports.useLiveSelectionUtils = useLiveSelectionUtils;
1151
1184
  exports.useLiveState = useLiveState;
1152
1185
  exports.useLiveStateData = useLiveStateData;
1153
1186
  exports.useLiveStateSyncUtils = useLiveStateSyncUtils;
1187
+ exports.useNotificationUtils = useNotificationUtils;
1188
+ exports.useNotificationsData = useNotificationsData;
1154
1189
  exports.usePresenceUsers = usePresenceUsers;
1155
1190
  exports.usePresenceUtils = usePresenceUtils;
1156
1191
  exports.useRecorderAddHandler = useRecorderAddHandler;