sanity-plugin-mux-input 3.0.5 → 4.0.0
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 +28 -28
- package/dist/index.js.map +1 -1
- package/package.json +5 -15
- package/dist/index.cjs +0 -5746
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -288
- package/dist/index.d.cts.map +0 -1
- package/sanity.json +0 -8
- package/src/_exports/index.ts +0 -73
- package/src/actions/assets.ts +0 -152
- package/src/actions/secrets.ts +0 -110
- package/src/actions/upload.ts +0 -308
- package/src/clients/upChunkObservable.ts +0 -54
- package/src/components/AddCaptionDialog.tsx +0 -440
- package/src/components/CaptionsDialog.tsx +0 -23
- package/src/components/ConfigureApi.styled.tsx +0 -19
- package/src/components/ConfigureApi.tsx +0 -296
- package/src/components/DraggableWatermark.tsx +0 -885
- package/src/components/EditCaptionDialog.tsx +0 -511
- package/src/components/EditThumbnailDialog.tsx +0 -121
- package/src/components/ErrorBoundaryCard.tsx +0 -97
- package/src/components/FileInputButton.tsx +0 -54
- package/src/components/FileInputMenuItem.styled.tsx +0 -36
- package/src/components/FileInputMenuItem.tsx +0 -85
- package/src/components/FormField.tsx +0 -38
- package/src/components/IconInfo.tsx +0 -22
- package/src/components/ImportVideosFromMux.tsx +0 -339
- package/src/components/Input.styled.tsx +0 -22
- package/src/components/Input.tsx +0 -78
- package/src/components/InputBrowser.tsx +0 -41
- package/src/components/MuxLogo.tsx +0 -42
- package/src/components/Onboard.tsx +0 -65
- package/src/components/PageSelector.tsx +0 -54
- package/src/components/Player.styled.tsx +0 -11
- package/src/components/Player.tsx +0 -117
- package/src/components/PlayerActionsMenu.tsx +0 -191
- package/src/components/ResyncMetadata.tsx +0 -278
- package/src/components/SelectAsset.tsx +0 -39
- package/src/components/SelectSortOptions.tsx +0 -45
- package/src/components/SpinnerBox.tsx +0 -16
- package/src/components/StudioTool.tsx +0 -24
- package/src/components/TextTracksEditor.tsx +0 -117
- package/src/components/TextTracksManager.tsx +0 -738
- package/src/components/UploadConfiguration.tsx +0 -696
- package/src/components/UploadPlaceholder.tsx +0 -88
- package/src/components/UploadProgress.tsx +0 -80
- package/src/components/Uploader.styled.tsx +0 -65
- package/src/components/Uploader.tsx +0 -499
- package/src/components/VideoDetails/DeleteDialog.tsx +0 -148
- package/src/components/VideoDetails/VideoDetails.tsx +0 -358
- package/src/components/VideoDetails/VideoReferences.tsx +0 -63
- package/src/components/VideoDetails/useVideoDetails.ts +0 -103
- package/src/components/VideoInBrowser.tsx +0 -245
- package/src/components/VideoMetadata.tsx +0 -45
- package/src/components/VideoPlayer.tsx +0 -241
- package/src/components/VideoThumbnail.tsx +0 -139
- package/src/components/VideosBrowser.tsx +0 -100
- package/src/components/documentPreview/DocumentPreview.tsx +0 -84
- package/src/components/documentPreview/DraftStatus.tsx +0 -34
- package/src/components/documentPreview/MissingSchemaType.tsx +0 -32
- package/src/components/documentPreview/PaneItemPreview.tsx +0 -67
- package/src/components/documentPreview/PublishedStatus.tsx +0 -35
- package/src/components/documentPreview/TimeAgo.tsx +0 -12
- package/src/components/icons/Audio.tsx +0 -13
- package/src/components/icons/Resolution.tsx +0 -12
- package/src/components/icons/StopWatch.tsx +0 -20
- package/src/components/icons/ToolIcon.tsx +0 -19
- package/src/components/uploadConfiguration/PlaybackPolicy.tsx +0 -133
- package/src/components/uploadConfiguration/PlaybackPolicyOption.tsx +0 -76
- package/src/components/uploadConfiguration/PlaybackPolicyWarning.tsx +0 -29
- package/src/components/uploadConfiguration/ResolutionTierSelector.tsx +0 -72
- package/src/components/uploadConfiguration/StaticRenditionSelector.tsx +0 -180
- package/src/components/withFocusRing/helpers.ts +0 -24
- package/src/components/withFocusRing/index.ts +0 -1
- package/src/components/withFocusRing/withFocusRing.ts +0 -30
- package/src/context/DialogStateContext.tsx +0 -33
- package/src/context/DrmPlaybackWarningContext.tsx +0 -97
- package/src/hooks/useAccessControl.ts +0 -13
- package/src/hooks/useAssetDocumentValues.ts +0 -11
- package/src/hooks/useAssets.ts +0 -73
- package/src/hooks/useCancelUpload.ts +0 -22
- package/src/hooks/useClient.ts +0 -8
- package/src/hooks/useDialogState.ts +0 -11
- package/src/hooks/useDocReferences.ts +0 -21
- package/src/hooks/useFetchFileSize.ts +0 -55
- package/src/hooks/useImportMuxAssets.ts +0 -132
- package/src/hooks/useInView.ts +0 -41
- package/src/hooks/useMediaMetadata.ts +0 -104
- package/src/hooks/useMuxAssets.ts +0 -179
- package/src/hooks/useMuxPolling.ts +0 -52
- package/src/hooks/useResyncAsset.ts +0 -110
- package/src/hooks/useResyncMuxMetadata.ts +0 -169
- package/src/hooks/useSaveSecrets.ts +0 -78
- package/src/hooks/useSecretsDocumentValues.ts +0 -38
- package/src/hooks/useSecretsFormState.ts +0 -47
- package/src/plugin.tsx +0 -31
- package/src/sanity-ui.d.ts +0 -5
- package/src/schema.ts +0 -196
- package/src/util/addKeysToMuxData.ts +0 -30
- package/src/util/asserters.ts +0 -23
- package/src/util/assetTitlePlaceholder.ts +0 -31
- package/src/util/constants.ts +0 -15
- package/src/util/convertWatermarkToMux.ts +0 -160
- package/src/util/createSearchFilter.ts +0 -76
- package/src/util/createUrlParamsObject.ts +0 -29
- package/src/util/extractFiles.ts +0 -67
- package/src/util/formatBytes.ts +0 -31
- package/src/util/formatDriveShareLink.ts +0 -64
- package/src/util/formatSeconds.ts +0 -48
- package/src/util/generateJwt.ts +0 -57
- package/src/util/getAnimatedPosterSrc.ts +0 -26
- package/src/util/getPlaybackPolicy.ts +0 -69
- package/src/util/getPosterSrc.ts +0 -28
- package/src/util/getVideoMetadata.ts +0 -23
- package/src/util/getVideoSrc.ts +0 -23
- package/src/util/parsers.ts +0 -5
- package/src/util/pluginVersion.ts +0 -5
- package/src/util/readSecrets.ts +0 -38
- package/src/util/roundPxString.ts +0 -16
- package/src/util/textTracks.ts +0 -222
- package/src/util/tryWithSuspend.ts +0 -22
- package/src/util/types.ts +0 -566
- package/v2-incompatible.js +0 -11
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { useClient as useClient$1, createHookFromObservableFactory, useDocumentS
|
|
|
2
2
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { ErrorOutlineIcon, InfoOutlineIcon, RetryIcon, CheckmarkCircleIcon, RetrieveIcon, ChevronLeftIcon, ChevronRightIcon, SyncIcon, SortIcon, UploadIcon, TranslateIcon, DownloadIcon, AddIcon, ChevronUpIcon, ChevronDownIcon, TrashIcon, EditIcon, WarningOutlineIcon, PublishIcon, DocumentIcon, RevertIcon, SearchIcon, ClockIcon, CropIcon, CalendarIcon, TagIcon, CheckmarkIcon, LockIcon, PlayIcon, PlugIcon, EllipsisHorizontalIcon, ImageIcon, ResetIcon, WarningFilledIcon, DocumentVideoIcon } from "@sanity/icons";
|
|
4
4
|
import { Dialog, Stack, Card, Text, Button, useTheme_v2, Flex, Box, TextInput, Checkbox, Code, Inline, Spinner, Heading, Label as Label$1, Radio, MenuButton, Menu, MenuItem, useToast, Autocomplete, Tooltip, TabList, Tab, TabPanel, Grid, useClickOutsideEvent, Popover, MenuDivider, rem } from "@sanity/ui";
|
|
5
|
-
import
|
|
5
|
+
import r, { createContext, useState, useCallback, useMemo, useContext, useReducer, useId, memo, useRef, useEffect, Suspense, isValidElement, PureComponent, forwardRef } from "react";
|
|
6
6
|
import compact from "lodash/compact.js";
|
|
7
7
|
import toLower from "lodash/toLower.js";
|
|
8
8
|
import trim from "lodash/trim.js";
|
|
@@ -141,7 +141,7 @@ function useDialogState() {
|
|
|
141
141
|
const PLUGIN_VERSION_QUERY = {
|
|
142
142
|
sanityVersion: (
|
|
143
143
|
// @ts-expect-error - this constant is search/replaced so must be exact, not accessed with an index signature
|
|
144
|
-
"
|
|
144
|
+
"4.0.0"
|
|
145
145
|
)
|
|
146
146
|
};
|
|
147
147
|
function saveSecrets(client, token, secretKey, enableSignedUrls, signingKeyId, signingKeyPrivate, drmConfigId) {
|
|
@@ -2559,7 +2559,7 @@ function VideoPlayer({
|
|
|
2559
2559
|
/* @__PURE__ */ jsx(MuxPlayer, { poster: isAudio ? void 0 : poster, ref: muxPlayer, ...props, playsInline: !0, playbackId, tokens, preload: "metadata", crossOrigin: "anonymous", metadata: {
|
|
2560
2560
|
player_name: "Sanity Admin Dashboard",
|
|
2561
2561
|
// @ts-expect-error - this constant is search/replaced so must be exact, not accessed with an index signature
|
|
2562
|
-
player_version: "
|
|
2562
|
+
player_version: "4.0.0",
|
|
2563
2563
|
page_type: "Preview Player"
|
|
2564
2564
|
}, audio: isAudio, _hlsConfig: hlsConfig, style: {
|
|
2565
2565
|
...!isAudio && {
|
|
@@ -2913,7 +2913,7 @@ const AssetInput = (props) => /* @__PURE__ */ jsx(FormField, { title: props.labe
|
|
|
2913
2913
|
saveChanges,
|
|
2914
2914
|
handleResync,
|
|
2915
2915
|
isResyncing
|
|
2916
|
-
} = useVideoDetails(props), isSaving = state === "saving", [containerHeight, setContainerHeight] = useState(null), contentsRef =
|
|
2916
|
+
} = useVideoDetails(props), isSaving = state === "saving", [containerHeight, setContainerHeight] = useState(null), contentsRef = useRef(null);
|
|
2917
2917
|
return useEffect(() => {
|
|
2918
2918
|
!contentsRef.current || !("getBoundingClientRect" in contentsRef.current) || setContainerHeight(contentsRef.current.getBoundingClientRect().height);
|
|
2919
2919
|
}, []), /* @__PURE__ */ jsxs(Dialog, { animate: !0, header: displayInfo.title, zOffset: DIALOGS_Z_INDEX, id: "video-details-dialog", onClose: handleClose, onClickOutside: handleClose, width: 2, position: "fixed", footer: /* @__PURE__ */ jsx(Card, { padding: 3, children: /* @__PURE__ */ jsxs(Flex, { justify: "space-between", align: "center", children: [
|
|
@@ -3011,7 +3011,7 @@ function VideoInBrowser({
|
|
|
3011
3011
|
onEdit,
|
|
3012
3012
|
asset
|
|
3013
3013
|
}) {
|
|
3014
|
-
const [renderVideo, setRenderVideo] = useState(!1), select =
|
|
3014
|
+
const [renderVideo, setRenderVideo] = useState(!1), select = useCallback(() => onSelect?.(asset), [onSelect, asset]), edit = useCallback(() => onEdit?.(asset), [onEdit, asset]), {
|
|
3015
3015
|
hasShownWarning
|
|
3016
3016
|
} = useDrmPlaybackWarningContext();
|
|
3017
3017
|
if (!asset)
|
|
@@ -3163,31 +3163,31 @@ const useAccessControl = (config) => {
|
|
|
3163
3163
|
dedupingInterval: 1e3
|
|
3164
3164
|
});
|
|
3165
3165
|
};
|
|
3166
|
-
var c = (function(
|
|
3166
|
+
var c = (function(r2) {
|
|
3167
3167
|
var t, e;
|
|
3168
3168
|
function n(t2) {
|
|
3169
3169
|
var e2;
|
|
3170
|
-
return (e2 =
|
|
3170
|
+
return (e2 = r2.call(this, t2) || this).state = {
|
|
3171
3171
|
hasError: !1,
|
|
3172
3172
|
error: null
|
|
3173
3173
|
}, e2;
|
|
3174
3174
|
}
|
|
3175
|
-
e =
|
|
3175
|
+
e = r2, (t = n).prototype = Object.create(e.prototype), t.prototype.constructor = t, t.__proto__ = e, n.getDerivedStateFromError = function(r3) {
|
|
3176
3176
|
return {
|
|
3177
3177
|
hasError: !0,
|
|
3178
|
-
error:
|
|
3178
|
+
error: r3
|
|
3179
3179
|
};
|
|
3180
3180
|
};
|
|
3181
3181
|
var o = n.prototype;
|
|
3182
|
-
return o.componentDidCatch = function(
|
|
3183
|
-
return this.props.onDidCatch(
|
|
3182
|
+
return o.componentDidCatch = function(r3, t2) {
|
|
3183
|
+
return this.props.onDidCatch(r3, t2);
|
|
3184
3184
|
}, o.render = function() {
|
|
3185
|
-
var
|
|
3186
|
-
return
|
|
3187
|
-
error:
|
|
3185
|
+
var r3 = this.state, t2 = this.props, e2 = t2.render, n2 = t2.children, o2 = t2.renderError;
|
|
3186
|
+
return r3.hasError ? o2 ? o2({
|
|
3187
|
+
error: r3.error
|
|
3188
3188
|
}) : null : e2 ? e2() : n2 || null;
|
|
3189
3189
|
}, n;
|
|
3190
|
-
})(PureComponent), u = function(
|
|
3190
|
+
})(PureComponent), u = function(r2, t) {
|
|
3191
3191
|
switch (t.type) {
|
|
3192
3192
|
case "catch":
|
|
3193
3193
|
return {
|
|
@@ -3200,7 +3200,7 @@ var c = (function(r) {
|
|
|
3200
3200
|
error: null
|
|
3201
3201
|
};
|
|
3202
3202
|
default:
|
|
3203
|
-
return
|
|
3203
|
+
return r2;
|
|
3204
3204
|
}
|
|
3205
3205
|
};
|
|
3206
3206
|
function a(t) {
|
|
@@ -3209,13 +3209,13 @@ function a(t) {
|
|
|
3209
3209
|
error: null
|
|
3210
3210
|
}), i = a2[0], d = a2[1], h = useRef(null);
|
|
3211
3211
|
function l() {
|
|
3212
|
-
return e = function(
|
|
3212
|
+
return e = function(r2, e2) {
|
|
3213
3213
|
d({
|
|
3214
3214
|
type: "catch",
|
|
3215
|
-
error:
|
|
3216
|
-
}), t && t.onDidCatch && t.onDidCatch(
|
|
3215
|
+
error: r2
|
|
3216
|
+
}), t && t.onDidCatch && t.onDidCatch(r2, e2);
|
|
3217
3217
|
}, function(t2) {
|
|
3218
|
-
return
|
|
3218
|
+
return r.createElement(c, {
|
|
3219
3219
|
onDidCatch: e,
|
|
3220
3220
|
children: t2.children,
|
|
3221
3221
|
render: t2.render,
|
|
@@ -3947,10 +3947,10 @@ function formatBytes(bytes, si = !1, dp = 1) {
|
|
|
3947
3947
|
return bytes + " B";
|
|
3948
3948
|
const units = si ? ["kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"] : ["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"];
|
|
3949
3949
|
let u2 = -1;
|
|
3950
|
-
const
|
|
3950
|
+
const r2 = 10 ** dp;
|
|
3951
3951
|
do
|
|
3952
3952
|
bytes /= thresh, ++u2;
|
|
3953
|
-
while (Math.round(Math.abs(bytes) *
|
|
3953
|
+
while (Math.round(Math.abs(bytes) * r2) / r2 >= thresh && u2 < units.length - 1);
|
|
3954
3954
|
return bytes.toFixed(dp) + " " + units[u2];
|
|
3955
3955
|
}
|
|
3956
3956
|
const RangeInput = styled.input.withConfig({
|
|
@@ -4687,11 +4687,11 @@ const RESOLUTION_TIERS = [{
|
|
|
4687
4687
|
config,
|
|
4688
4688
|
dispatch
|
|
4689
4689
|
}) => {
|
|
4690
|
-
const isAdvancedMode = useMemo(() => config.static_renditions.filter((
|
|
4690
|
+
const isAdvancedMode = useMemo(() => config.static_renditions.filter((r2) => r2 !== "highest" && r2 !== "audio-only").length > 0, [config.static_renditions]), [renditionMode, setRenditionMode] = useState(isAdvancedMode ? "advanced" : "standard"), toggleRendition = (rendition) => {
|
|
4691
4691
|
const current = config.static_renditions, hasRendition = current.includes(rendition);
|
|
4692
4692
|
dispatch(hasRendition ? {
|
|
4693
4693
|
action: "static_renditions",
|
|
4694
|
-
value: current.filter((
|
|
4694
|
+
value: current.filter((r2) => r2 !== rendition)
|
|
4695
4695
|
} : {
|
|
4696
4696
|
action: "static_renditions",
|
|
4697
4697
|
value: [...current, rendition]
|
|
@@ -4699,10 +4699,10 @@ const RESOLUTION_TIERS = [{
|
|
|
4699
4699
|
}, handleModeChange = (mode) => {
|
|
4700
4700
|
setRenditionMode(mode), dispatch(mode === "standard" ? {
|
|
4701
4701
|
action: "static_renditions",
|
|
4702
|
-
value: config.static_renditions.filter((
|
|
4702
|
+
value: config.static_renditions.filter((r2) => r2 === "highest" || r2 === "audio-only")
|
|
4703
4703
|
} : {
|
|
4704
4704
|
action: "static_renditions",
|
|
4705
|
-
value: config.static_renditions.filter((
|
|
4705
|
+
value: config.static_renditions.filter((r2) => r2 !== "highest")
|
|
4706
4706
|
});
|
|
4707
4707
|
};
|
|
4708
4708
|
return /* @__PURE__ */ jsx(Stack, { space: 3, children: /* @__PURE__ */ jsx(FormField$2, { path: [], title: "Static Renditions", description: "Generate downloadable MP4 or M4A files. Note: Mux will not upscale to produce MP4 renditions - renditions that would cause upscaling are skipped.", children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
|
|
@@ -4763,8 +4763,8 @@ const RESOLUTION_TIERS = [{
|
|
|
4763
4763
|
label: "Premium"
|
|
4764
4764
|
}];
|
|
4765
4765
|
function sanitizeStaticRenditions(renditions) {
|
|
4766
|
-
const hasHighest = renditions.includes("highest"), hasSpecificResolutions = renditions.some((
|
|
4767
|
-
return hasHighest && hasSpecificResolutions ? renditions.filter((
|
|
4766
|
+
const hasHighest = renditions.includes("highest"), hasSpecificResolutions = renditions.some((r2) => r2 !== "highest" && r2 !== "audio-only");
|
|
4767
|
+
return hasHighest && hasSpecificResolutions ? renditions.filter((r2) => r2 === "highest" || r2 === "audio-only") : renditions;
|
|
4768
4768
|
}
|
|
4769
4769
|
function UploadConfiguration({
|
|
4770
4770
|
stagedUpload,
|