@veltdev/react 3.0.61 → 3.0.63
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 +55 -15
- package/cjs/index.js.map +1 -1
- package/cjs/types/components/VeltCommentPlayerTimeline/VeltCommentPlayerTimeline.d.ts +1 -0
- package/cjs/types/constants.d.ts +1 -1
- package/cjs/types/hooks/LiveStateSyncElement.d.ts +1 -1
- package/esm/index.js +55 -15
- package/esm/index.js.map +1 -1
- package/esm/types/components/VeltCommentPlayerTimeline/VeltCommentPlayerTimeline.d.ts +1 -0
- package/esm/types/constants.d.ts +1 -1
- package/esm/types/hooks/LiveStateSyncElement.d.ts +1 -1
- package/index.d.ts +2 -1
- package/package.json +1 -1
package/cjs/index.js
CHANGED
|
@@ -140,7 +140,7 @@ var loadVelt = function (callback, version, staging, develop, proxyDomain) {
|
|
|
140
140
|
}
|
|
141
141
|
};
|
|
142
142
|
|
|
143
|
-
var VELT_SDK_VERSION = '3.0.
|
|
143
|
+
var VELT_SDK_VERSION = '3.0.63';
|
|
144
144
|
var VELT_SDK_INIT_EVENT = 'onVeltInit';
|
|
145
145
|
var VELT_TAB_ID = 'veltTabId';
|
|
146
146
|
|
|
@@ -754,7 +754,7 @@ var SnippylyUserRequestTool = function (props) {
|
|
|
754
754
|
};
|
|
755
755
|
|
|
756
756
|
var VeltCommentPlayerTimeline = function (props) {
|
|
757
|
-
var totalMediaLength = props.totalMediaLength, onCommentClick = props.onCommentClick, shadowDom = props.shadowDom, videoPlayerId = props.videoPlayerId, onReactionClick = props.onReactionClick;
|
|
757
|
+
var totalMediaLength = props.totalMediaLength, offset = props.offset, onCommentClick = props.onCommentClick, shadowDom = props.shadowDom, videoPlayerId = props.videoPlayerId, onReactionClick = props.onReactionClick;
|
|
758
758
|
var ref = React.useRef();
|
|
759
759
|
var onCommentClickRef = React.useRef(onCommentClick);
|
|
760
760
|
var onReactionClickRef = React.useRef(onReactionClick);
|
|
@@ -791,7 +791,7 @@ var VeltCommentPlayerTimeline = function (props) {
|
|
|
791
791
|
}
|
|
792
792
|
};
|
|
793
793
|
}, []);
|
|
794
|
-
return (React__default["default"].createElement("velt-comment-player-timeline", { ref: ref, "shadow-dom": [true, false].includes(shadowDom) ? (shadowDom ? 'true' : 'false') : undefined, "total-media-length": totalMediaLength, "video-player-id": videoPlayerId }));
|
|
794
|
+
return (React__default["default"].createElement("velt-comment-player-timeline", { ref: ref, "shadow-dom": [true, false].includes(shadowDom) ? (shadowDom ? 'true' : 'false') : undefined, "total-media-length": totalMediaLength, offset: offset, "video-player-id": videoPlayerId }));
|
|
795
795
|
};
|
|
796
796
|
|
|
797
797
|
var VeltVideoPlayer = function (props) {
|
|
@@ -4768,25 +4768,43 @@ function useLiveStateSyncUtils() {
|
|
|
4768
4768
|
function useLiveStateData(liveStateDataId, liveStateDataConfig) {
|
|
4769
4769
|
var liveStateSyncElement = useLiveStateSyncUtils();
|
|
4770
4770
|
var _a = React__default["default"].useState(), data = _a[0], setData = _a[1];
|
|
4771
|
+
var subscriptionRef = React__default["default"].useRef();
|
|
4772
|
+
// Memoize inputs
|
|
4773
|
+
var inputs = React__default["default"].useMemo(function () {
|
|
4774
|
+
return { liveStateDataId: liveStateDataId, liveStateDataConfig: liveStateDataConfig };
|
|
4775
|
+
}, [liveStateDataId, JSON.stringify(liveStateDataConfig)]);
|
|
4771
4776
|
React.useEffect(function () {
|
|
4772
4777
|
if (!(liveStateSyncElement === null || liveStateSyncElement === void 0 ? void 0 : liveStateSyncElement.getLiveStateData))
|
|
4773
4778
|
return;
|
|
4774
|
-
|
|
4779
|
+
if (subscriptionRef.current) {
|
|
4780
|
+
subscriptionRef.current.unsubscribe();
|
|
4781
|
+
}
|
|
4782
|
+
var subscription = liveStateSyncElement.getLiveStateData(inputs.liveStateDataId, inputs.liveStateDataConfig)
|
|
4783
|
+
.subscribe(function (res) {
|
|
4775
4784
|
setData(res);
|
|
4776
4785
|
});
|
|
4786
|
+
subscriptionRef.current = subscription;
|
|
4777
4787
|
return function () {
|
|
4778
|
-
|
|
4788
|
+
if (subscriptionRef.current) {
|
|
4789
|
+
subscriptionRef.current.unsubscribe();
|
|
4790
|
+
}
|
|
4779
4791
|
};
|
|
4780
|
-
}, [liveStateSyncElement === null || liveStateSyncElement === void 0 ? void 0 : liveStateSyncElement.getLiveStateData]);
|
|
4792
|
+
}, [liveStateSyncElement === null || liveStateSyncElement === void 0 ? void 0 : liveStateSyncElement.getLiveStateData, inputs]);
|
|
4781
4793
|
return data;
|
|
4782
4794
|
}
|
|
4783
4795
|
function useSetLiveStateData(liveStateDataId, liveStateData) {
|
|
4784
4796
|
var liveStateSyncElement = useLiveStateSyncUtils();
|
|
4797
|
+
// Memoize inputs
|
|
4798
|
+
var inputs = React__default["default"].useMemo(function () {
|
|
4799
|
+
return { liveStateDataId: liveStateDataId, liveStateData: liveStateData };
|
|
4800
|
+
}, [liveStateDataId, JSON.stringify(liveStateData)]);
|
|
4785
4801
|
React__default["default"].useEffect(function () {
|
|
4786
|
-
if (liveStateSyncElement
|
|
4787
|
-
|
|
4802
|
+
if (!(liveStateSyncElement === null || liveStateSyncElement === void 0 ? void 0 : liveStateSyncElement.setLiveStateData))
|
|
4803
|
+
return;
|
|
4804
|
+
if (inputs.liveStateDataId && inputs.liveStateData) {
|
|
4805
|
+
liveStateSyncElement.setLiveStateData(inputs.liveStateDataId, inputs.liveStateData);
|
|
4788
4806
|
}
|
|
4789
|
-
}, [liveStateSyncElement === null || liveStateSyncElement === void 0 ? void 0 : liveStateSyncElement.setLiveStateData]);
|
|
4807
|
+
}, [liveStateSyncElement === null || liveStateSyncElement === void 0 ? void 0 : liveStateSyncElement.setLiveStateData, inputs]);
|
|
4790
4808
|
}
|
|
4791
4809
|
function useUserEditorState() {
|
|
4792
4810
|
var liveStateSyncElement = useLiveStateSyncUtils();
|
|
@@ -5082,31 +5100,53 @@ function useViewsUtils() {
|
|
|
5082
5100
|
function useUniqueViewsByUser(clientLocationId) {
|
|
5083
5101
|
var viewsElement = useViewsUtils();
|
|
5084
5102
|
var _a = React__default["default"].useState(null), data = _a[0], setData = _a[1];
|
|
5103
|
+
var subscriptionRef = React__default["default"].useRef();
|
|
5104
|
+
// Memoize the input
|
|
5105
|
+
var memoizedClientLocationId = React__default["default"].useMemo(function () { return clientLocationId; }, [clientLocationId]);
|
|
5085
5106
|
React.useEffect(function () {
|
|
5086
5107
|
if (!(viewsElement === null || viewsElement === void 0 ? void 0 : viewsElement.getUniqueViewsByUser))
|
|
5087
5108
|
return;
|
|
5088
|
-
|
|
5109
|
+
// Unsubscribe from the previous subscription if it exists
|
|
5110
|
+
if (subscriptionRef.current) {
|
|
5111
|
+
subscriptionRef.current.unsubscribe();
|
|
5112
|
+
}
|
|
5113
|
+
var subscription = viewsElement.getUniqueViewsByUser(memoizedClientLocationId).subscribe(function (res) {
|
|
5089
5114
|
setData(res);
|
|
5090
5115
|
});
|
|
5116
|
+
// Store the new subscription
|
|
5117
|
+
subscriptionRef.current = subscription;
|
|
5091
5118
|
return function () {
|
|
5092
|
-
|
|
5119
|
+
if (subscriptionRef.current) {
|
|
5120
|
+
subscriptionRef.current.unsubscribe();
|
|
5121
|
+
}
|
|
5093
5122
|
};
|
|
5094
|
-
}, [viewsElement === null || viewsElement === void 0 ? void 0 : viewsElement.getUniqueViewsByUser]);
|
|
5123
|
+
}, [viewsElement === null || viewsElement === void 0 ? void 0 : viewsElement.getUniqueViewsByUser, memoizedClientLocationId]);
|
|
5095
5124
|
return data;
|
|
5096
5125
|
}
|
|
5097
5126
|
function useUniqueViewsByDate(clientLocationId) {
|
|
5098
5127
|
var viewsElement = useViewsUtils();
|
|
5099
5128
|
var _a = React__default["default"].useState(null), data = _a[0], setData = _a[1];
|
|
5129
|
+
var subscriptionRef = React__default["default"].useRef();
|
|
5130
|
+
// Memoize the input
|
|
5131
|
+
var memoizedClientLocationId = React__default["default"].useMemo(function () { return clientLocationId; }, [clientLocationId]);
|
|
5100
5132
|
React.useEffect(function () {
|
|
5101
5133
|
if (!(viewsElement === null || viewsElement === void 0 ? void 0 : viewsElement.getUniqueViewsByDate))
|
|
5102
5134
|
return;
|
|
5103
|
-
|
|
5135
|
+
// Unsubscribe from the previous subscription if it exists
|
|
5136
|
+
if (subscriptionRef.current) {
|
|
5137
|
+
subscriptionRef.current.unsubscribe();
|
|
5138
|
+
}
|
|
5139
|
+
var subscription = viewsElement.getUniqueViewsByDate(memoizedClientLocationId).subscribe(function (res) {
|
|
5104
5140
|
setData(res);
|
|
5105
5141
|
});
|
|
5142
|
+
// Store the new subscription
|
|
5143
|
+
subscriptionRef.current = subscription;
|
|
5106
5144
|
return function () {
|
|
5107
|
-
|
|
5145
|
+
if (subscriptionRef.current) {
|
|
5146
|
+
subscriptionRef.current.unsubscribe();
|
|
5147
|
+
}
|
|
5108
5148
|
};
|
|
5109
|
-
}, [viewsElement === null || viewsElement === void 0 ? void 0 : viewsElement.getUniqueViewsByDate]);
|
|
5149
|
+
}, [viewsElement === null || viewsElement === void 0 ? void 0 : viewsElement.getUniqueViewsByDate, memoizedClientLocationId]);
|
|
5110
5150
|
return data;
|
|
5111
5151
|
}
|
|
5112
5152
|
|