@veltdev/react 1.0.50 → 1.0.52
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 +425 -5
- package/cjs/index.js.map +1 -1
- package/cjs/types/components/SnippylyCommentsSidebar/SnippylyCommentsSidebar.d.ts +1 -0
- package/cjs/types/components/SnippylyUserInviteTool/SnippylyUserInviteTool.d.ts +1 -0
- package/cjs/types/constants.d.ts +1 -1
- package/cjs/types/hooks/Client.d.ts +19 -7
- package/cjs/types/hooks/CommentElement.d.ts +24 -7
- package/cjs/types/hooks/CursorElement.d.ts +8 -2
- package/cjs/types/hooks/HuddleElement.d.ts +4 -0
- package/cjs/types/hooks/LiveStateSyncElement.d.ts +16 -3
- package/cjs/types/hooks/PresenceElement.d.ts +8 -2
- package/cjs/types/hooks/RecorderElement.d.ts +8 -2
- package/cjs/types/hooks/RewriterElement.d.ts +4 -1
- package/cjs/types/hooks/SelectionElement.d.ts +4 -1
- package/cjs/types/hooks/TagElement.d.ts +8 -2
- package/cjs/types/hooks/index.d.ts +10 -9
- package/cjs/types/index.d.ts +1 -0
- package/esm/index.js +400 -6
- package/esm/index.js.map +1 -1
- package/esm/types/components/SnippylyCommentsSidebar/SnippylyCommentsSidebar.d.ts +1 -0
- package/esm/types/components/SnippylyUserInviteTool/SnippylyUserInviteTool.d.ts +1 -0
- package/esm/types/constants.d.ts +1 -1
- package/esm/types/hooks/Client.d.ts +19 -7
- package/esm/types/hooks/CommentElement.d.ts +24 -7
- package/esm/types/hooks/CursorElement.d.ts +8 -2
- package/esm/types/hooks/HuddleElement.d.ts +4 -0
- package/esm/types/hooks/LiveStateSyncElement.d.ts +16 -3
- package/esm/types/hooks/PresenceElement.d.ts +8 -2
- package/esm/types/hooks/RecorderElement.d.ts +8 -2
- package/esm/types/hooks/RewriterElement.d.ts +4 -1
- package/esm/types/hooks/SelectionElement.d.ts +4 -1
- package/esm/types/hooks/TagElement.d.ts +8 -2
- package/esm/types/hooks/index.d.ts +10 -9
- package/esm/types/index.d.ts +1 -0
- package/index.d.ts +118 -2
- package/package.json +1 -1
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { Location } from "@veltdev/types";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* @beta This hook is in beta
|
|
4
|
+
*/
|
|
5
|
+
export declare function useTagUtils(): any | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* @beta This hook is in beta
|
|
8
|
+
*/
|
|
9
|
+
export declare function useTagAnnotations(documentId?: string, location?: Location): any;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export { useAddLocation,
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
1
|
+
export { useAddLocation, useSetLocation, useSetDocumentId, useIdentify, useClient, } from './Client';
|
|
2
|
+
export { useCommentUtils, useCommentAnnotations, useCommentAddHandler, useCommentModeState, useCommentUpdateHandler, useCommentDialogSidebarClickHandler, } from './CommentElement';
|
|
3
|
+
export { useCursorUtils, useCursorUsers, } from './CursorElement';
|
|
4
|
+
export { useHuddleUtils, } from './HuddleElement';
|
|
5
|
+
export { useLiveStateSyncUtils, useLiveStateData, useSetLiveStateData, useUserEditorState, } from './LiveStateSyncElement';
|
|
6
|
+
export { usePresenceUtils, usePresenceUsers, } from './PresenceElement';
|
|
7
|
+
export { useRecorderUtils, useRecorderAddHandler, } from './RecorderElement';
|
|
8
|
+
export { useAIRewriterUtils, } from './RewriterElement';
|
|
9
|
+
export { useLiveSelectionUtils, } from './SelectionElement';
|
|
10
|
+
export { useTagUtils, useTagAnnotations, } from './TagElement';
|
package/cjs/types/index.d.ts
CHANGED
package/esm/index.js
CHANGED
|
@@ -86,7 +86,7 @@ var loadVelt = function (callback, version, staging) {
|
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
-
var VELT_SDK_VERSION = '1.0.
|
|
89
|
+
var VELT_SDK_VERSION = '1.0.62';
|
|
90
90
|
|
|
91
91
|
var SnippylyProvider = function (props) {
|
|
92
92
|
var apiKey = props.apiKey, user = props.user, config = props.config, documentId = props.documentId, language = props.language, translations = props.translations, autoTranslation = props.autoTranslation, onClientLoad = props.onClientLoad, children = props.children;
|
|
@@ -233,7 +233,7 @@ var SnippylyComments = function (props) {
|
|
|
233
233
|
};
|
|
234
234
|
|
|
235
235
|
var SnippylyCommentsSidebar = function (props) {
|
|
236
|
-
var embedMode = props.embedMode, enableUrlNavigation = props.enableUrlNavigation, urlNavigation = props.urlNavigation, pageMode = props.pageMode, openSidebar = props.openSidebar, onSidebarOpen = props.onSidebarOpen, onSidebarCommentClick = props.onSidebarCommentClick, onCommentClick = props.onCommentClick;
|
|
236
|
+
var embedMode = props.embedMode, enableUrlNavigation = props.enableUrlNavigation, urlNavigation = props.urlNavigation, pageMode = props.pageMode, currentLocationSuffix = props.currentLocationSuffix, openSidebar = props.openSidebar, onSidebarOpen = props.onSidebarOpen, onSidebarCommentClick = props.onSidebarCommentClick, onCommentClick = props.onCommentClick;
|
|
237
237
|
var ref = useRef();
|
|
238
238
|
useEffect(function () {
|
|
239
239
|
if (ref.current) {
|
|
@@ -256,7 +256,7 @@ var SnippylyCommentsSidebar = function (props) {
|
|
|
256
256
|
});
|
|
257
257
|
}
|
|
258
258
|
}, []);
|
|
259
|
-
return (React.createElement("velt-comments-sidebar", { ref: ref, "embed-mode": [true, false].includes(embedMode) ? (embedMode ? 'true' : 'false') : undefined, "enable-url-navigation": [true, false].includes(enableUrlNavigation) ? (enableUrlNavigation ? 'true' : 'false') : undefined, "url-navigation": [true, false].includes(urlNavigation) ? (urlNavigation ? 'true' : 'false') : undefined, "page-mode": [true, false].includes(pageMode) ? (pageMode ? 'true' : 'false') : undefined }));
|
|
259
|
+
return (React.createElement("velt-comments-sidebar", { ref: ref, "embed-mode": [true, false].includes(embedMode) ? (embedMode ? 'true' : 'false') : undefined, "enable-url-navigation": [true, false].includes(enableUrlNavigation) ? (enableUrlNavigation ? 'true' : 'false') : undefined, "url-navigation": [true, false].includes(urlNavigation) ? (urlNavigation ? 'true' : 'false') : undefined, "page-mode": [true, false].includes(pageMode) ? (pageMode ? 'true' : 'false') : undefined, "current-location-suffix": [true, false].includes(currentLocationSuffix) ? (currentLocationSuffix ? 'true' : 'false') : undefined }));
|
|
260
260
|
};
|
|
261
261
|
|
|
262
262
|
var SnippylyCommentTool = function (props) {
|
|
@@ -393,8 +393,8 @@ var SnippylyArrowTool = function (props) {
|
|
|
393
393
|
};
|
|
394
394
|
|
|
395
395
|
var SnippylyUserInviteTool = function (props) {
|
|
396
|
-
var type = props.type, source = props.source, title = props.title, placeholder = props.placeholder, accessControlDropdown = props.accessControlDropdown;
|
|
397
|
-
return (React.createElement("velt-user-invite-tool", { type: type, source: source, title: title, placeholder: placeholder, "access-control-dropdown": [true, false].includes(accessControlDropdown) ? accessControlDropdown : undefined }));
|
|
396
|
+
var type = props.type, source = props.source, title = props.title, placeholder = props.placeholder, accessControlDropdown = props.accessControlDropdown, documentUserAccessList = props.documentUserAccessList;
|
|
397
|
+
return (React.createElement("velt-user-invite-tool", { type: type, source: source, title: title, placeholder: placeholder, "access-control-dropdown": [true, false].includes(accessControlDropdown) ? accessControlDropdown : undefined, "document-user-access-list": [true, false].includes(documentUserAccessList) ? documentUserAccessList : undefined }));
|
|
398
398
|
};
|
|
399
399
|
|
|
400
400
|
var SnippylyUserRequestTool = function (props) {
|
|
@@ -423,5 +423,399 @@ var VeltVideoPlayer = function (props) {
|
|
|
423
423
|
return (React.createElement("velt-video-player", { src: src, "dark-mode": [true, false].includes(darkMode) ? (darkMode ? 'true' : 'false') : undefined, sync: [true, false].includes(sync) ? (sync ? 'true' : 'false') : undefined }));
|
|
424
424
|
};
|
|
425
425
|
|
|
426
|
-
|
|
426
|
+
/**
|
|
427
|
+
* @beta This hook is in beta
|
|
428
|
+
*/
|
|
429
|
+
function useClient() {
|
|
430
|
+
var client = useVeltClient().client;
|
|
431
|
+
var _a = React.useState(), veltClient = _a[0], setVeltClient = _a[1];
|
|
432
|
+
React.useEffect(function () {
|
|
433
|
+
if (!client || veltClient)
|
|
434
|
+
return;
|
|
435
|
+
setVeltClient(client);
|
|
436
|
+
}, [client, setVeltClient, veltClient]);
|
|
437
|
+
return veltClient;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* @beta This hook is in beta
|
|
441
|
+
*/
|
|
442
|
+
function useIdentify(user, userOptions) {
|
|
443
|
+
var client = useVeltClient().client;
|
|
444
|
+
React.useEffect(function () {
|
|
445
|
+
client && client.identify(user, userOptions);
|
|
446
|
+
}, [client]);
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* @beta This hook is in beta
|
|
450
|
+
*/
|
|
451
|
+
function useSetDocumentId(documentId) {
|
|
452
|
+
var client = useVeltClient().client;
|
|
453
|
+
React.useEffect(function () {
|
|
454
|
+
client && client.setDocumentId(documentId);
|
|
455
|
+
}, [client]);
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* @beta This hook is in beta
|
|
459
|
+
*/
|
|
460
|
+
function useSetLocation(location) {
|
|
461
|
+
var client = useVeltClient().client;
|
|
462
|
+
React.useEffect(function () {
|
|
463
|
+
client && client.setLocation(location);
|
|
464
|
+
}, [client]);
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* @beta This hook is in beta
|
|
468
|
+
*/
|
|
469
|
+
function useAddLocation(location) {
|
|
470
|
+
var client = useVeltClient().client;
|
|
471
|
+
React.useEffect(function () {
|
|
472
|
+
client && client.addLocation(location);
|
|
473
|
+
}, [client]);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* @beta This hook is in beta
|
|
478
|
+
*/
|
|
479
|
+
function useCommentUtils() {
|
|
480
|
+
var _a = React.useState(), commentElement = _a[0], setCommentElement = _a[1];
|
|
481
|
+
var client = useVeltClient().client;
|
|
482
|
+
React.useEffect(function () {
|
|
483
|
+
if (!client || commentElement)
|
|
484
|
+
return;
|
|
485
|
+
var loadedCommentElement = client.getCommentElement();
|
|
486
|
+
setCommentElement(loadedCommentElement);
|
|
487
|
+
}, [client, setCommentElement, commentElement]);
|
|
488
|
+
return commentElement;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* @beta This hook is in beta
|
|
492
|
+
*/
|
|
493
|
+
function useCommentAnnotations(documentId, location) {
|
|
494
|
+
var commentElement = useCommentUtils();
|
|
495
|
+
var _a = React.useState([]), data = _a[0], setData = _a[1];
|
|
496
|
+
useEffect(function () {
|
|
497
|
+
if (!(commentElement === null || commentElement === void 0 ? void 0 : commentElement.getAllCommentAnnotations))
|
|
498
|
+
return;
|
|
499
|
+
var subscription = commentElement.getAllCommentAnnotations(documentId, location).subscribe(function (res) {
|
|
500
|
+
setData(res);
|
|
501
|
+
});
|
|
502
|
+
return function () {
|
|
503
|
+
subscription.unsubscribe();
|
|
504
|
+
};
|
|
505
|
+
}, [commentElement === null || commentElement === void 0 ? void 0 : commentElement.getAllCommentAnnotations]);
|
|
506
|
+
return data;
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* @beta This hook is in beta
|
|
510
|
+
*/
|
|
511
|
+
function useCommentModeState() {
|
|
512
|
+
var commentElement = useCommentUtils();
|
|
513
|
+
var _a = React.useState(), data = _a[0], setData = _a[1];
|
|
514
|
+
useEffect(function () {
|
|
515
|
+
if (!(commentElement === null || commentElement === void 0 ? void 0 : commentElement.onCommentModeChange))
|
|
516
|
+
return;
|
|
517
|
+
var subscription = commentElement.onCommentModeChange().subscribe(function (res) {
|
|
518
|
+
setData(res);
|
|
519
|
+
});
|
|
520
|
+
return function () {
|
|
521
|
+
subscription.unsubscribe();
|
|
522
|
+
};
|
|
523
|
+
}, [commentElement === null || commentElement === void 0 ? void 0 : commentElement.onCommentModeChange]);
|
|
524
|
+
return data;
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* @beta This hook is in beta
|
|
528
|
+
*/
|
|
529
|
+
function useCommentAddHandler() {
|
|
530
|
+
var commentElement = useCommentUtils();
|
|
531
|
+
var _a = React.useState(), data = _a[0], setData = _a[1];
|
|
532
|
+
useEffect(function () {
|
|
533
|
+
if (!(commentElement === null || commentElement === void 0 ? void 0 : commentElement.onCommentAdd))
|
|
534
|
+
return;
|
|
535
|
+
var subscription = commentElement.onCommentAdd().subscribe(function (res) {
|
|
536
|
+
setData(res);
|
|
537
|
+
});
|
|
538
|
+
return function () {
|
|
539
|
+
subscription.unsubscribe();
|
|
540
|
+
};
|
|
541
|
+
}, [commentElement === null || commentElement === void 0 ? void 0 : commentElement.onCommentAdd]);
|
|
542
|
+
return data;
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* @beta This hook is in beta
|
|
546
|
+
*/
|
|
547
|
+
function useCommentUpdateHandler() {
|
|
548
|
+
var commentElement = useCommentUtils();
|
|
549
|
+
var _a = React.useState(), data = _a[0], setData = _a[1];
|
|
550
|
+
useEffect(function () {
|
|
551
|
+
if (!(commentElement === null || commentElement === void 0 ? void 0 : commentElement.onCommentUpdate))
|
|
552
|
+
return;
|
|
553
|
+
var subscription = commentElement.onCommentUpdate().subscribe(function (res) {
|
|
554
|
+
setData(res);
|
|
555
|
+
});
|
|
556
|
+
return function () {
|
|
557
|
+
subscription.unsubscribe();
|
|
558
|
+
};
|
|
559
|
+
}, [commentElement === null || commentElement === void 0 ? void 0 : commentElement.onCommentUpdate]);
|
|
560
|
+
return data;
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* @beta This hook is in beta
|
|
564
|
+
*/
|
|
565
|
+
function useCommentDialogSidebarClickHandler() {
|
|
566
|
+
var commentElement = useCommentUtils();
|
|
567
|
+
var _a = React.useState(), data = _a[0], setData = _a[1];
|
|
568
|
+
useEffect(function () {
|
|
569
|
+
if (!(commentElement === null || commentElement === void 0 ? void 0 : commentElement.onSidebarButtonOnCommentDialogClick))
|
|
570
|
+
return;
|
|
571
|
+
var subscription = commentElement.onSidebarButtonOnCommentDialogClick().subscribe(function (res) {
|
|
572
|
+
setData(res === undefined ? new Date().getTime() : res);
|
|
573
|
+
});
|
|
574
|
+
return function () {
|
|
575
|
+
subscription.unsubscribe();
|
|
576
|
+
};
|
|
577
|
+
}, [commentElement === null || commentElement === void 0 ? void 0 : commentElement.onSidebarButtonOnCommentDialogClick]);
|
|
578
|
+
return data;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* @beta This hook is in beta
|
|
583
|
+
*/
|
|
584
|
+
function useCursorUtils() {
|
|
585
|
+
var _a = React.useState(), cursorElement = _a[0], setCursorElement = _a[1];
|
|
586
|
+
var client = useVeltClient().client;
|
|
587
|
+
React.useEffect(function () {
|
|
588
|
+
if (!client || cursorElement)
|
|
589
|
+
return;
|
|
590
|
+
var loadedCursorElement = client.getCursorElement();
|
|
591
|
+
setCursorElement(loadedCursorElement);
|
|
592
|
+
}, [client, setCursorElement, cursorElement]);
|
|
593
|
+
return cursorElement;
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* @beta This hook is in beta
|
|
597
|
+
*/
|
|
598
|
+
function useCursorUsers() {
|
|
599
|
+
var cursorElement = useCursorUtils();
|
|
600
|
+
var _a = React.useState(), data = _a[0], setData = _a[1];
|
|
601
|
+
useEffect(function () {
|
|
602
|
+
if (!cursorElement)
|
|
603
|
+
return;
|
|
604
|
+
var subscription = cursorElement.getOnlineUsersOnCurrentDocument().subscribe(function (res) {
|
|
605
|
+
setData(res);
|
|
606
|
+
});
|
|
607
|
+
return function () {
|
|
608
|
+
subscription.unsubscribe();
|
|
609
|
+
};
|
|
610
|
+
}, [cursorElement]);
|
|
611
|
+
return data;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* @beta This hook is in beta
|
|
616
|
+
*/
|
|
617
|
+
function useHuddleUtils() {
|
|
618
|
+
var _a = React.useState(), huddleElement = _a[0], setHuddleElement = _a[1];
|
|
619
|
+
var client = useVeltClient().client;
|
|
620
|
+
React.useEffect(function () {
|
|
621
|
+
if (!client || huddleElement)
|
|
622
|
+
return;
|
|
623
|
+
var loadedHuddleElement = client.getHuddleElement();
|
|
624
|
+
setHuddleElement(loadedHuddleElement);
|
|
625
|
+
}, [client, setHuddleElement, huddleElement]);
|
|
626
|
+
return huddleElement;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* @beta This hook is in beta
|
|
631
|
+
*/
|
|
632
|
+
function useLiveStateSyncUtils() {
|
|
633
|
+
var _a = React.useState(), liveStateSyncElement = _a[0], setLiveStateSyncElement = _a[1];
|
|
634
|
+
var client = useVeltClient().client;
|
|
635
|
+
React.useEffect(function () {
|
|
636
|
+
if (!client || liveStateSyncElement)
|
|
637
|
+
return;
|
|
638
|
+
var loadedLiveStateSyncElement = client.getLiveStateSyncElement();
|
|
639
|
+
setLiveStateSyncElement(loadedLiveStateSyncElement);
|
|
640
|
+
}, [client, setLiveStateSyncElement, liveStateSyncElement]);
|
|
641
|
+
return liveStateSyncElement;
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* @beta This hook is in beta
|
|
645
|
+
*/
|
|
646
|
+
function useLiveStateData(liveStateDataId) {
|
|
647
|
+
var liveStateSyncElement = useLiveStateSyncUtils();
|
|
648
|
+
var _a = React.useState(), data = _a[0], setData = _a[1];
|
|
649
|
+
useEffect(function () {
|
|
650
|
+
if (!(liveStateSyncElement === null || liveStateSyncElement === void 0 ? void 0 : liveStateSyncElement.getLiveStateData))
|
|
651
|
+
return;
|
|
652
|
+
var subscription = liveStateSyncElement.getLiveStateData(liveStateDataId).subscribe(function (res) {
|
|
653
|
+
setData(res);
|
|
654
|
+
});
|
|
655
|
+
return function () {
|
|
656
|
+
subscription.unsubscribe();
|
|
657
|
+
};
|
|
658
|
+
}, [liveStateSyncElement === null || liveStateSyncElement === void 0 ? void 0 : liveStateSyncElement.getLiveStateData]);
|
|
659
|
+
return data;
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* @beta This hook is in beta
|
|
663
|
+
*/
|
|
664
|
+
function useSetLiveStateData(liveStateDataId, liveStateData) {
|
|
665
|
+
var liveStateSyncElement = useLiveStateSyncUtils();
|
|
666
|
+
React.useEffect(function () {
|
|
667
|
+
if (liveStateSyncElement && liveStateDataId && liveStateData) {
|
|
668
|
+
liveStateSyncElement === null || liveStateSyncElement === void 0 ? void 0 : liveStateSyncElement.setLiveStateData(liveStateDataId, liveStateData);
|
|
669
|
+
}
|
|
670
|
+
}, [liveStateSyncElement === null || liveStateSyncElement === void 0 ? void 0 : liveStateSyncElement.setLiveStateData]);
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* @beta This hook is in beta
|
|
674
|
+
*/
|
|
675
|
+
function useUserEditorState() {
|
|
676
|
+
var liveStateSyncElement = useLiveStateSyncUtils();
|
|
677
|
+
var _a = React.useState(), data = _a[0], setData = _a[1];
|
|
678
|
+
useEffect(function () {
|
|
679
|
+
if (!(liveStateSyncElement === null || liveStateSyncElement === void 0 ? void 0 : liveStateSyncElement.isUserEditor))
|
|
680
|
+
return;
|
|
681
|
+
var subscription = liveStateSyncElement.isUserEditor().subscribe(function (res) {
|
|
682
|
+
setData(res);
|
|
683
|
+
});
|
|
684
|
+
return function () {
|
|
685
|
+
subscription.unsubscribe();
|
|
686
|
+
};
|
|
687
|
+
}, [liveStateSyncElement === null || liveStateSyncElement === void 0 ? void 0 : liveStateSyncElement.isUserEditor]);
|
|
688
|
+
return data;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* @beta This hook is in beta
|
|
693
|
+
*/
|
|
694
|
+
function usePresenceUtils() {
|
|
695
|
+
var _a = React.useState(), presenceElement = _a[0], setPresenceElement = _a[1];
|
|
696
|
+
var client = useVeltClient().client;
|
|
697
|
+
React.useEffect(function () {
|
|
698
|
+
if (!client || presenceElement)
|
|
699
|
+
return;
|
|
700
|
+
var loadedPresenceElement = client.getPresenceElement();
|
|
701
|
+
setPresenceElement(loadedPresenceElement);
|
|
702
|
+
}, [client, setPresenceElement, presenceElement]);
|
|
703
|
+
return presenceElement;
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* @beta This hook is in beta
|
|
707
|
+
*/
|
|
708
|
+
function usePresenceUsers() {
|
|
709
|
+
var presenceElement = usePresenceUtils();
|
|
710
|
+
var _a = React.useState(), data = _a[0], setData = _a[1];
|
|
711
|
+
useEffect(function () {
|
|
712
|
+
if (!presenceElement)
|
|
713
|
+
return;
|
|
714
|
+
var subscription = presenceElement.getOnlineUsersOnCurrentDocument().subscribe(function (res) {
|
|
715
|
+
setData(res);
|
|
716
|
+
});
|
|
717
|
+
return function () {
|
|
718
|
+
subscription.unsubscribe();
|
|
719
|
+
};
|
|
720
|
+
}, [presenceElement]);
|
|
721
|
+
return data;
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
* @beta This hook is in beta
|
|
726
|
+
*/
|
|
727
|
+
function useRecorderUtils() {
|
|
728
|
+
var _a = React.useState(), recorderElement = _a[0], setRecorderElement = _a[1];
|
|
729
|
+
var client = useVeltClient().client;
|
|
730
|
+
React.useEffect(function () {
|
|
731
|
+
if (!client || recorderElement)
|
|
732
|
+
return;
|
|
733
|
+
var loadedRecorderElement = client.getRecorderElement();
|
|
734
|
+
setRecorderElement(loadedRecorderElement);
|
|
735
|
+
}, [client, setRecorderElement, recorderElement]);
|
|
736
|
+
return recorderElement;
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
739
|
+
* @beta This hook is in beta
|
|
740
|
+
*/
|
|
741
|
+
function useRecorderAddHandler() {
|
|
742
|
+
var recorderElement = useRecorderUtils();
|
|
743
|
+
var _a = React.useState(), data = _a[0], setData = _a[1];
|
|
744
|
+
useEffect(function () {
|
|
745
|
+
if (!recorderElement)
|
|
746
|
+
return;
|
|
747
|
+
var subscription = recorderElement.onRecordedData().subscribe(function (res) {
|
|
748
|
+
setData(res);
|
|
749
|
+
});
|
|
750
|
+
return function () {
|
|
751
|
+
subscription.unsubscribe();
|
|
752
|
+
};
|
|
753
|
+
}, [recorderElement]);
|
|
754
|
+
return data;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
/**
|
|
758
|
+
* @beta This hook is in beta
|
|
759
|
+
*/
|
|
760
|
+
function useAIRewriterUtils() {
|
|
761
|
+
var _a = React.useState(), rewriterElement = _a[0], setRewriterElement = _a[1];
|
|
762
|
+
var client = useVeltClient().client;
|
|
763
|
+
React.useEffect(function () {
|
|
764
|
+
if (!client || rewriterElement)
|
|
765
|
+
return;
|
|
766
|
+
var loadedRewriterElement = client.getRewriterElement();
|
|
767
|
+
setRewriterElement(loadedRewriterElement);
|
|
768
|
+
}, [client, setRewriterElement, rewriterElement]);
|
|
769
|
+
return rewriterElement;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* @beta This hook is in beta
|
|
774
|
+
*/
|
|
775
|
+
function useLiveSelectionUtils() {
|
|
776
|
+
var _a = React.useState(), selectionElement = _a[0], setSelectionElement = _a[1];
|
|
777
|
+
var client = useVeltClient().client;
|
|
778
|
+
React.useEffect(function () {
|
|
779
|
+
if (!client || selectionElement)
|
|
780
|
+
return;
|
|
781
|
+
var loadedSelectionElement = client.getSelectionElement();
|
|
782
|
+
setSelectionElement(loadedSelectionElement);
|
|
783
|
+
}, [client, setSelectionElement, selectionElement]);
|
|
784
|
+
return selectionElement;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
/**
|
|
788
|
+
* @beta This hook is in beta
|
|
789
|
+
*/
|
|
790
|
+
function useTagUtils() {
|
|
791
|
+
var _a = React.useState(), tagElement = _a[0], setTagElement = _a[1];
|
|
792
|
+
var client = useVeltClient().client;
|
|
793
|
+
React.useEffect(function () {
|
|
794
|
+
if (!client || tagElement)
|
|
795
|
+
return;
|
|
796
|
+
var loadedTagElement = client.getTagElement();
|
|
797
|
+
setTagElement(loadedTagElement);
|
|
798
|
+
}, [client, setTagElement, tagElement]);
|
|
799
|
+
return tagElement;
|
|
800
|
+
}
|
|
801
|
+
/**
|
|
802
|
+
* @beta This hook is in beta
|
|
803
|
+
*/
|
|
804
|
+
function useTagAnnotations(documentId, location) {
|
|
805
|
+
var tagElement = useTagUtils();
|
|
806
|
+
var _a = React.useState(), data = _a[0], setData = _a[1];
|
|
807
|
+
useEffect(function () {
|
|
808
|
+
if (!tagElement)
|
|
809
|
+
return;
|
|
810
|
+
var subscription = tagElement.getAllTagAnnotations(documentId, location).subscribe(function (res) {
|
|
811
|
+
setData(res);
|
|
812
|
+
});
|
|
813
|
+
return function () {
|
|
814
|
+
subscription.unsubscribe();
|
|
815
|
+
};
|
|
816
|
+
}, [tagElement]);
|
|
817
|
+
return data;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
export { SnippylyArrowTool as VeltArrowTool, SnippylyArrows as VeltArrows, SnippylyCommentBubble as VeltCommentBubble, VeltCommentPlayerTimeline, SnippylyCommentTool as VeltCommentTool, SnippylyComments as VeltComments, SnippylyCommentsSidebar as VeltCommentsSidebar, SnippylyCursor as VeltCursor, SnippylyHuddle as VeltHuddle, SnippylyHuddleTool as VeltHuddleTool, SnippylyPresence as VeltPresence, SnippylyProvider as VeltProvider, SnippylyRecorderControlPanel as VeltRecorderControlPanel, SnippylyRecorderNotes as VeltRecorderNotes, SnippylyRecorderPlayer as VeltRecorderPlayer, SnippylyRecorderTool as VeltRecorderTool, SnippylySidebarButton as VeltSidebarButton, SnippylyTagTool as VeltTagTool, SnippylyTags as VeltTags, SnippylyUserInviteTool as VeltUserInviteTool, SnippylyUserRequestTool as VeltUserRequestTool, VeltVideoPlayer, useAIRewriterUtils, useAddLocation, useClient, useCommentAddHandler, useCommentAnnotations, useCommentDialogSidebarClickHandler, useCommentModeState, useCommentUpdateHandler, useCommentUtils, useCursorUsers, useCursorUtils, useHuddleUtils, useIdentify, useLiveSelectionUtils, useLiveStateData, useLiveStateSyncUtils, usePresenceUsers, usePresenceUtils, useRecorderAddHandler, useRecorderUtils, useSetDocumentId, useSetLiveStateData, useSetLocation, useTagAnnotations, useTagUtils, useUserEditorState, useVeltClient };
|
|
427
821
|
//# sourceMappingURL=index.js.map
|