@veltdev/react 1.0.93 → 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.
Files changed (26) hide show
  1. package/cjs/index.js +87 -1
  2. package/cjs/index.js.map +1 -1
  3. package/cjs/types/components/VeltNotificationsHistoryPanel/VeltNotificationsHistoryPanel.d.ts +7 -0
  4. package/cjs/types/components/VeltNotificationsHistoryPanel/index.d.ts +1 -0
  5. package/cjs/types/components/VeltNotificationsPanel/VeltNotificationsPanel.d.ts +6 -0
  6. package/cjs/types/components/VeltNotificationsPanel/index.d.ts +1 -0
  7. package/cjs/types/components/VeltNotificationsTool/VeltNotificationsTool.d.ts +6 -0
  8. package/cjs/types/components/VeltNotificationsTool/index.d.ts +1 -0
  9. package/cjs/types/components/index.d.ts +3 -0
  10. package/cjs/types/constants.d.ts +1 -1
  11. package/cjs/types/hooks/NotificationElement.d.ts +9 -0
  12. package/cjs/types/hooks/index.d.ts +1 -0
  13. package/esm/index.js +83 -2
  14. package/esm/index.js.map +1 -1
  15. package/esm/types/components/VeltNotificationsHistoryPanel/VeltNotificationsHistoryPanel.d.ts +7 -0
  16. package/esm/types/components/VeltNotificationsHistoryPanel/index.d.ts +1 -0
  17. package/esm/types/components/VeltNotificationsPanel/VeltNotificationsPanel.d.ts +6 -0
  18. package/esm/types/components/VeltNotificationsPanel/index.d.ts +1 -0
  19. package/esm/types/components/VeltNotificationsTool/VeltNotificationsTool.d.ts +6 -0
  20. package/esm/types/components/VeltNotificationsTool/index.d.ts +1 -0
  21. package/esm/types/components/index.d.ts +3 -0
  22. package/esm/types/constants.d.ts +1 -1
  23. package/esm/types/hooks/NotificationElement.d.ts +9 -0
  24. package/esm/types/hooks/index.d.ts +1 -0
  25. package/index.d.ts +27 -2
  26. package/package.json +1 -1
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.108';
112
+ var VELT_SDK_VERSION = '1.0.110';
113
113
  var VELT_SDK_INIT_EVENT = 'onVeltInit';
114
114
 
115
115
  var SnippylyProvider = function (props) {
@@ -455,6 +455,54 @@ var VeltCommentThread = function (props) {
455
455
  return (React__default["default"].createElement("velt-comment-thread", { "annotation-id": annotationId }));
456
456
  };
457
457
 
458
+ var VeltNotificationsTool = function (props) {
459
+ var children = props.children, onNotificationClick = props.onNotificationClick;
460
+ var ref = React.useRef();
461
+ React.useEffect(function () {
462
+ if (ref.current) {
463
+ var element = ref.current;
464
+ element.addEventListener('onNotificationClick', function (event) {
465
+ if (onNotificationClick) {
466
+ onNotificationClick(event === null || event === void 0 ? void 0 : event.detail);
467
+ }
468
+ });
469
+ }
470
+ }, []);
471
+ return (React__default["default"].createElement("velt-notifications-tool", { ref: ref }, children));
472
+ };
473
+
474
+ var VeltNotificationsPanel = function (props) {
475
+ var onNotificationClick = props.onNotificationClick;
476
+ var ref = React.useRef();
477
+ React.useEffect(function () {
478
+ if (ref.current) {
479
+ var element = ref.current;
480
+ element.addEventListener('onNotificationClick', function (event) {
481
+ if (onNotificationClick) {
482
+ onNotificationClick(event === null || event === void 0 ? void 0 : event.detail);
483
+ }
484
+ });
485
+ }
486
+ }, []);
487
+ return (React__default["default"].createElement("velt-notifications-panel", { ref: ref }));
488
+ };
489
+
490
+ var VeltNotificationsHistoryPanel = function (props) {
491
+ var embedMode = props.embedMode, onNotificationClick = props.onNotificationClick;
492
+ var ref = React.useRef();
493
+ React.useEffect(function () {
494
+ if (ref.current) {
495
+ var element = ref.current;
496
+ element.addEventListener('onNotificationClick', function (event) {
497
+ if (onNotificationClick) {
498
+ onNotificationClick(event === null || event === void 0 ? void 0 : event.detail);
499
+ }
500
+ });
501
+ }
502
+ }, []);
503
+ return (React__default["default"].createElement("velt-notifications-history-panel", { ref: ref, "embed-mode": [true, false].includes(embedMode) ? (embedMode ? 'true' : 'false') : undefined }));
504
+ };
505
+
458
506
  /**
459
507
  * @beta This hook is in beta
460
508
  */
@@ -980,6 +1028,39 @@ function useUniqueViewsByDate(clientLocationId) {
980
1028
  return data;
981
1029
  }
982
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
+
983
1064
  var sessionId = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
984
1065
  var getSessionId = function () {
985
1066
  return sessionId;
@@ -1067,6 +1148,9 @@ exports.VeltCommentsSidebar = SnippylyCommentsSidebar;
1067
1148
  exports.VeltCursor = SnippylyCursor;
1068
1149
  exports.VeltHuddle = SnippylyHuddle;
1069
1150
  exports.VeltHuddleTool = SnippylyHuddleTool;
1151
+ exports.VeltNotificationsHistoryPanel = VeltNotificationsHistoryPanel;
1152
+ exports.VeltNotificationsPanel = VeltNotificationsPanel;
1153
+ exports.VeltNotificationsTool = VeltNotificationsTool;
1070
1154
  exports.VeltPresence = SnippylyPresence;
1071
1155
  exports.VeltProvider = SnippylyProvider;
1072
1156
  exports.VeltRecorderControlPanel = SnippylyRecorderControlPanel;
@@ -1100,6 +1184,8 @@ exports.useLiveSelectionUtils = useLiveSelectionUtils;
1100
1184
  exports.useLiveState = useLiveState;
1101
1185
  exports.useLiveStateData = useLiveStateData;
1102
1186
  exports.useLiveStateSyncUtils = useLiveStateSyncUtils;
1187
+ exports.useNotificationUtils = useNotificationUtils;
1188
+ exports.useNotificationsData = useNotificationsData;
1103
1189
  exports.usePresenceUsers = usePresenceUsers;
1104
1190
  exports.usePresenceUtils = usePresenceUtils;
1105
1191
  exports.useRecorderAddHandler = useRecorderAddHandler;