@geekapps/silo-elements-nextjs 0.2.68 → 0.2.69

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/index.js CHANGED
@@ -737,6 +737,7 @@ function FileUploader({
737
737
  video,
738
738
  isPrivate,
739
739
  captionLanguages,
740
+ chapterLanguages,
740
741
  theme,
741
742
  renderIcon,
742
743
  renderProgress,
@@ -780,12 +781,21 @@ function FileUploader({
780
781
  const resolvedVideo = overrideVideo ?? videoOpts;
781
782
  const effectiveImage = showImageOptions ? resolvedImage : image ?? resolvedImage;
782
783
  const effectiveVideo = showVideoOptions ? resolvedVideo : video ?? resolvedVideo;
784
+ const videoWithLangs = (base) => {
785
+ if (!captionLanguages?.length && !chapterLanguages?.length) return base;
786
+ return {
787
+ ...base ?? {},
788
+ ...captionLanguages?.length && { languages: captionLanguages },
789
+ ...chapterLanguages?.length && { chapterLanguages }
790
+ };
791
+ };
783
792
  if (multiple && files.length > 1) {
784
793
  try {
794
+ const batchVideo = videoWithLangs(effectiveVideo);
785
795
  const results = await batch.upload(files, {
786
796
  ...bucket !== void 0 && { bucket },
787
797
  image: effectiveImage,
788
- video: effectiveVideo,
798
+ ...batchVideo !== void 0 && { video: batchVideo },
789
799
  ...isPrivate !== void 0 && { isPrivate },
790
800
  ...captionLanguages?.length && { captionLanguages }
791
801
  });
@@ -798,10 +808,11 @@ function FileUploader({
798
808
  const file = files[0];
799
809
  if (!file) return;
800
810
  try {
811
+ const singleVideo = videoWithLangs(effectiveVideo);
801
812
  const result = await single.upload(file, {
802
813
  ...bucket !== void 0 && { bucket },
803
814
  image: effectiveImage,
804
- video: effectiveVideo ? { ...effectiveVideo, ...captionLanguages?.length && { languages: captionLanguages } } : captionLanguages?.length ? { languages: captionLanguages } : effectiveVideo,
815
+ ...singleVideo !== void 0 && { video: singleVideo },
805
816
  ...isPrivate !== void 0 && { isPrivate }
806
817
  });
807
818
  if (result) onUpload?.(result);
@@ -809,7 +820,7 @@ function FileUploader({
809
820
  onError?.(err instanceof Error ? err : new Error(String(err)));
810
821
  }
811
822
  }
812
- }, [single, batch, multiple, bucket, image, video, isPrivate, captionLanguages, imageOpts, videoOpts, showImageOptions, showVideoOptions, onUpload, onBatchUpload, onError]);
823
+ }, [single, batch, multiple, bucket, image, video, isPrivate, captionLanguages, chapterLanguages, imageOpts, videoOpts, showImageOptions, showVideoOptions, onUpload, onBatchUpload, onError]);
813
824
  const handleFiles = useCallback(async (files) => {
814
825
  const needsStaging = allowRename || showImageOptions && files.some((f) => f.type.startsWith("image/")) || showVideoOptions && files.some((f) => f.type.startsWith("video/"));
815
826
  if (needsStaging) {