sanity-plugin-mux-input 3.0.4 → 3.0.5
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/README.md +0 -2
- package/dist/index.cjs +2876 -4400
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +134 -193
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +134 -193
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2877 -4401
- package/dist/index.js.map +1 -1
- package/package.json +36 -36
- package/src/_exports/index.ts +1 -1
- package/src/actions/assets.ts +5 -5
- package/src/actions/secrets.ts +5 -6
- package/src/actions/upload.ts +32 -34
- package/src/components/AddCaptionDialog.tsx +3 -3
- package/src/components/ConfigureApi.tsx +7 -7
- package/src/components/DraggableWatermark.tsx +15 -7
- package/src/components/EditCaptionDialog.tsx +6 -5
- package/src/components/EditThumbnailDialog.tsx +4 -5
- package/src/components/ErrorBoundaryCard.tsx +1 -0
- package/src/components/FileInputButton.tsx +1 -1
- package/src/components/FileInputMenuItem.tsx +10 -10
- package/src/components/ImportVideosFromMux.tsx +0 -3
- package/src/components/MuxLogo.tsx +1 -1
- package/src/components/Onboard.tsx +1 -1
- package/src/components/PageSelector.tsx +1 -1
- package/src/components/Player.styled.tsx +0 -44
- package/src/components/Player.tsx +1 -1
- package/src/components/PlayerActionsMenu.tsx +3 -2
- package/src/components/ResyncMetadata.tsx +4 -6
- package/src/components/SelectAsset.tsx +2 -2
- package/src/components/SelectSortOptions.tsx +3 -3
- package/src/components/TextTracksEditor.tsx +2 -2
- package/src/components/TextTracksManager.tsx +5 -4
- package/src/components/UploadConfiguration.tsx +17 -15
- package/src/components/UploadPlaceholder.tsx +1 -1
- package/src/components/UploadProgress.tsx +4 -4
- package/src/components/Uploader.styled.tsx +1 -2
- package/src/components/Uploader.tsx +15 -14
- package/src/components/VideoDetails/DeleteDialog.tsx +2 -1
- package/src/components/VideoDetails/VideoDetails.tsx +3 -3
- package/src/components/VideoDetails/useVideoDetails.ts +2 -2
- package/src/components/VideoInBrowser.tsx +1 -1
- package/src/components/VideoMetadata.tsx +1 -1
- package/src/components/VideoPlayer.tsx +12 -6
- package/src/components/VideoThumbnail.tsx +4 -3
- package/src/components/VideosBrowser.tsx +1 -1
- package/src/components/documentPreview/DocumentPreview.tsx +4 -3
- package/src/components/documentPreview/PaneItemPreview.tsx +5 -12
- package/src/components/uploadConfiguration/PlaybackPolicy.tsx +3 -3
- package/src/components/uploadConfiguration/PlaybackPolicyOption.tsx +2 -2
- package/src/components/uploadConfiguration/PlaybackPolicyWarning.tsx +1 -1
- package/src/components/uploadConfiguration/ResolutionTierSelector.tsx +2 -2
- package/src/components/uploadConfiguration/StaticRenditionSelector.tsx +4 -4
- package/src/components/withFocusRing/withFocusRing.ts +1 -1
- package/src/context/DialogStateContext.tsx +3 -6
- package/src/context/DrmPlaybackWarningContext.tsx +14 -10
- package/src/hooks/useAccessControl.ts +1 -1
- package/src/hooks/useAssetDocumentValues.ts +2 -2
- package/src/hooks/useAssets.ts +11 -6
- package/src/hooks/useCancelUpload.ts +2 -2
- package/src/hooks/useDocReferences.ts +2 -2
- package/src/hooks/useFetchFileSize.ts +4 -3
- package/src/hooks/useImportMuxAssets.ts +3 -3
- package/src/hooks/useInView.ts +3 -4
- package/src/hooks/useMediaMetadata.ts +5 -4
- package/src/hooks/useMuxAssets.ts +15 -15
- package/src/hooks/useMuxPolling.ts +6 -3
- package/src/hooks/useResyncAsset.ts +1 -1
- package/src/hooks/useResyncMuxMetadata.ts +4 -11
- package/src/hooks/useSaveSecrets.ts +4 -4
- package/src/hooks/useSecretsDocumentValues.ts +1 -1
- package/src/util/asserters.ts +0 -13
- package/src/util/convertWatermarkToMux.ts +4 -4
- package/src/util/createUrlParamsObject.ts +3 -3
- package/src/util/extractFiles.ts +3 -3
- package/src/util/formatBytes.ts +0 -1
- package/src/util/formatSeconds.ts +0 -1
- package/src/util/generateJwt.ts +3 -3
- package/src/util/getAnimatedPosterSrc.ts +1 -1
- package/src/util/getPlaybackPolicy.ts +6 -6
- package/src/util/getPosterSrc.ts +1 -1
- package/src/util/pluginVersion.ts +5 -1
- package/src/util/readSecrets.ts +1 -1
- package/src/util/textTracks.ts +5 -5
- package/src/util/tryWithSuspend.ts +1 -1
- package/src/util/types.ts +2 -32
- package/src/components/InputError.tsx +0 -17
- package/src/components/documentPreview/paneItemTypes.ts +0 -7
- package/src/util/areSecretsSignable.ts +0 -5
- package/src/util/getStoryboardSrc.ts +0 -27
- package/src/util/isSigned.ts +0 -20
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type {SanityClient} from 'sanity'
|
|
2
|
-
|
|
3
|
-
import {getPlaybackId} from '../util/getPlaybackPolicy'
|
|
4
|
-
import {generateJwt} from './generateJwt'
|
|
5
|
-
import {getPlaybackPolicyById} from './getPlaybackPolicy'
|
|
6
|
-
import type {MuxStoryboardUrl, VideoAssetDocument} from './types'
|
|
7
|
-
|
|
8
|
-
interface StoryboardSrcOptions {
|
|
9
|
-
asset: VideoAssetDocument
|
|
10
|
-
client: SanityClient
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* May throw a Promise. Call this with {@link tryWithSuspend} or rethrow the Promise
|
|
15
|
-
*/
|
|
16
|
-
export function getStoryboardSrc({asset, client}: StoryboardSrcOptions): MuxStoryboardUrl {
|
|
17
|
-
const playbackId = getPlaybackId(asset)
|
|
18
|
-
const searchParams = new URLSearchParams()
|
|
19
|
-
|
|
20
|
-
const playbackPolicy = getPlaybackPolicyById(asset, playbackId)?.policy
|
|
21
|
-
if (playbackPolicy === 'signed' || playbackPolicy === 'drm') {
|
|
22
|
-
const token = generateJwt(client, playbackId, 's')
|
|
23
|
-
searchParams.set('token', token)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return `https://image.mux.com/${playbackId}/storyboard.vtt?${searchParams}`
|
|
27
|
-
}
|
package/src/util/isSigned.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import {areSecretsSignable} from './areSecretsSignable'
|
|
2
|
-
import type {Secrets, VideoAssetDocument} from './types'
|
|
3
|
-
|
|
4
|
-
export function isSigned(asset: VideoAssetDocument, secrets: Secrets): boolean {
|
|
5
|
-
const isAssetSigned = asset.data?.playback_ids?.[0]?.policy === 'signed'
|
|
6
|
-
if (!isAssetSigned) {
|
|
7
|
-
return false
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
if (areSecretsSignable(secrets)) {
|
|
11
|
-
return true
|
|
12
|
-
}
|
|
13
|
-
console.error(
|
|
14
|
-
'Asset is signed',
|
|
15
|
-
{asset},
|
|
16
|
-
'but secrets are missing signingKeyId and signingKeyPrivate',
|
|
17
|
-
secrets
|
|
18
|
-
)
|
|
19
|
-
throw new TypeError(`Unable to access asset as signing keys are missing`)
|
|
20
|
-
}
|