@geekapps/silo-elements-nextjs 0.2.60 → 0.2.62
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/dist/FileUploader.d.ts +1 -1
- package/dist/FileUploader.js +16 -3
- package/dist/FileUploader.js.map +1 -1
- package/dist/MediaUploader.js +16 -3
- package/dist/MediaUploader.js.map +1 -1
- package/dist/VideoPlayer.js +14 -0
- package/dist/VideoPlayer.js.map +1 -1
- package/dist/index.js +30 -3
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -759,6 +759,8 @@ function FileUploader({
|
|
|
759
759
|
showVideoOptions = false,
|
|
760
760
|
image,
|
|
761
761
|
video,
|
|
762
|
+
isPrivate,
|
|
763
|
+
captionLanguage,
|
|
762
764
|
theme,
|
|
763
765
|
renderIcon,
|
|
764
766
|
renderProgress,
|
|
@@ -804,7 +806,13 @@ function FileUploader({
|
|
|
804
806
|
const effectiveVideo = showVideoOptions ? resolvedVideo : video ?? resolvedVideo;
|
|
805
807
|
if (multiple && files.length > 1) {
|
|
806
808
|
try {
|
|
807
|
-
const results = await batch.upload(files, {
|
|
809
|
+
const results = await batch.upload(files, {
|
|
810
|
+
...bucket !== void 0 && { bucket },
|
|
811
|
+
image: effectiveImage,
|
|
812
|
+
video: effectiveVideo,
|
|
813
|
+
...isPrivate !== void 0 && { isPrivate },
|
|
814
|
+
...captionLanguage && { captionLanguage }
|
|
815
|
+
});
|
|
808
816
|
onBatchUpload?.(results);
|
|
809
817
|
results.forEach((r) => onUpload?.(r));
|
|
810
818
|
} catch (err) {
|
|
@@ -814,13 +822,18 @@ function FileUploader({
|
|
|
814
822
|
const file = files[0];
|
|
815
823
|
if (!file) return;
|
|
816
824
|
try {
|
|
817
|
-
const result = await single.upload(file, {
|
|
825
|
+
const result = await single.upload(file, {
|
|
826
|
+
...bucket !== void 0 && { bucket },
|
|
827
|
+
image: effectiveImage,
|
|
828
|
+
video: effectiveVideo,
|
|
829
|
+
...isPrivate !== void 0 && { isPrivate }
|
|
830
|
+
});
|
|
818
831
|
if (result) onUpload?.(result);
|
|
819
832
|
} catch (err) {
|
|
820
833
|
onError?.(err instanceof Error ? err : new Error(String(err)));
|
|
821
834
|
}
|
|
822
835
|
}
|
|
823
|
-
}, [single, batch, multiple, bucket, image, video, imageOpts, videoOpts, showImageOptions, showVideoOptions, onUpload, onBatchUpload, onError]);
|
|
836
|
+
}, [single, batch, multiple, bucket, image, video, isPrivate, captionLanguage, imageOpts, videoOpts, showImageOptions, showVideoOptions, onUpload, onBatchUpload, onError]);
|
|
824
837
|
const handleFiles = useCallback(async (files) => {
|
|
825
838
|
const needsStaging = allowRename || showImageOptions && files.some((f) => f.type.startsWith("image/")) || showVideoOptions && files.some((f) => f.type.startsWith("video/"));
|
|
826
839
|
if (needsStaging) {
|
|
@@ -1286,6 +1299,20 @@ function Video({
|
|
|
1286
1299
|
const [userReaction, setUserReaction] = useState(parsed.rating?.userReaction ?? null);
|
|
1287
1300
|
const userReactionRef = useRef(userReaction);
|
|
1288
1301
|
userReactionRef.current = userReaction;
|
|
1302
|
+
const ratingInitializedRef = useRef(false);
|
|
1303
|
+
const incomingCounts = parsed.rating?.counts;
|
|
1304
|
+
const incomingUserReaction = parsed.rating?.userReaction;
|
|
1305
|
+
useEffect(() => {
|
|
1306
|
+
if (ratingInitializedRef.current) return;
|
|
1307
|
+
if (!incomingCounts && incomingUserReaction === void 0) return;
|
|
1308
|
+
ratingInitializedRef.current = true;
|
|
1309
|
+
if (incomingCounts) {
|
|
1310
|
+
setRatingCounts({ LOVE: incomingCounts.LOVE ?? 0, LIKE: incomingCounts.LIKE ?? 0, DISLIKE: incomingCounts.DISLIKE ?? 0 });
|
|
1311
|
+
}
|
|
1312
|
+
if (incomingUserReaction !== void 0) {
|
|
1313
|
+
setUserReaction(incomingUserReaction ?? null);
|
|
1314
|
+
}
|
|
1315
|
+
}, [incomingCounts?.LOVE, incomingCounts?.LIKE, incomingCounts?.DISLIKE, incomingUserReaction]);
|
|
1289
1316
|
const onReactRef = useRef(parsed.rating?.onReact);
|
|
1290
1317
|
onReactRef.current = parsed.rating?.onReact;
|
|
1291
1318
|
const [preview, setPreview] = useState(null);
|