sanity-plugin-mux-input 3.0.4 → 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.
Files changed (130) hide show
  1. package/README.md +0 -2
  2. package/dist/index.d.ts +134 -193
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +2893 -4417
  5. package/dist/index.js.map +1 -1
  6. package/package.json +33 -43
  7. package/dist/index.cjs +0 -7270
  8. package/dist/index.cjs.map +0 -1
  9. package/dist/index.d.cts +0 -347
  10. package/sanity.json +0 -8
  11. package/src/_exports/index.ts +0 -73
  12. package/src/actions/assets.ts +0 -152
  13. package/src/actions/secrets.ts +0 -111
  14. package/src/actions/upload.ts +0 -310
  15. package/src/clients/upChunkObservable.ts +0 -54
  16. package/src/components/AddCaptionDialog.tsx +0 -440
  17. package/src/components/CaptionsDialog.tsx +0 -23
  18. package/src/components/ConfigureApi.styled.tsx +0 -19
  19. package/src/components/ConfigureApi.tsx +0 -296
  20. package/src/components/DraggableWatermark.tsx +0 -877
  21. package/src/components/EditCaptionDialog.tsx +0 -510
  22. package/src/components/EditThumbnailDialog.tsx +0 -122
  23. package/src/components/ErrorBoundaryCard.tsx +0 -96
  24. package/src/components/FileInputButton.tsx +0 -54
  25. package/src/components/FileInputMenuItem.styled.tsx +0 -36
  26. package/src/components/FileInputMenuItem.tsx +0 -85
  27. package/src/components/FormField.tsx +0 -38
  28. package/src/components/IconInfo.tsx +0 -22
  29. package/src/components/ImportVideosFromMux.tsx +0 -342
  30. package/src/components/Input.styled.tsx +0 -22
  31. package/src/components/Input.tsx +0 -78
  32. package/src/components/InputBrowser.tsx +0 -41
  33. package/src/components/InputError.tsx +0 -17
  34. package/src/components/MuxLogo.tsx +0 -42
  35. package/src/components/Onboard.tsx +0 -65
  36. package/src/components/PageSelector.tsx +0 -54
  37. package/src/components/Player.styled.tsx +0 -55
  38. package/src/components/Player.tsx +0 -117
  39. package/src/components/PlayerActionsMenu.tsx +0 -190
  40. package/src/components/ResyncMetadata.tsx +0 -280
  41. package/src/components/SelectAsset.tsx +0 -39
  42. package/src/components/SelectSortOptions.tsx +0 -45
  43. package/src/components/SpinnerBox.tsx +0 -16
  44. package/src/components/StudioTool.tsx +0 -24
  45. package/src/components/TextTracksEditor.tsx +0 -117
  46. package/src/components/TextTracksManager.tsx +0 -737
  47. package/src/components/UploadConfiguration.tsx +0 -694
  48. package/src/components/UploadPlaceholder.tsx +0 -88
  49. package/src/components/UploadProgress.tsx +0 -80
  50. package/src/components/Uploader.styled.tsx +0 -66
  51. package/src/components/Uploader.tsx +0 -498
  52. package/src/components/VideoDetails/DeleteDialog.tsx +0 -147
  53. package/src/components/VideoDetails/VideoDetails.tsx +0 -358
  54. package/src/components/VideoDetails/VideoReferences.tsx +0 -63
  55. package/src/components/VideoDetails/useVideoDetails.ts +0 -103
  56. package/src/components/VideoInBrowser.tsx +0 -245
  57. package/src/components/VideoMetadata.tsx +0 -45
  58. package/src/components/VideoPlayer.tsx +0 -235
  59. package/src/components/VideoThumbnail.tsx +0 -138
  60. package/src/components/VideosBrowser.tsx +0 -100
  61. package/src/components/documentPreview/DocumentPreview.tsx +0 -83
  62. package/src/components/documentPreview/DraftStatus.tsx +0 -34
  63. package/src/components/documentPreview/MissingSchemaType.tsx +0 -32
  64. package/src/components/documentPreview/PaneItemPreview.tsx +0 -74
  65. package/src/components/documentPreview/PublishedStatus.tsx +0 -35
  66. package/src/components/documentPreview/TimeAgo.tsx +0 -12
  67. package/src/components/documentPreview/paneItemTypes.ts +0 -7
  68. package/src/components/icons/Audio.tsx +0 -13
  69. package/src/components/icons/Resolution.tsx +0 -12
  70. package/src/components/icons/StopWatch.tsx +0 -20
  71. package/src/components/icons/ToolIcon.tsx +0 -19
  72. package/src/components/uploadConfiguration/PlaybackPolicy.tsx +0 -133
  73. package/src/components/uploadConfiguration/PlaybackPolicyOption.tsx +0 -76
  74. package/src/components/uploadConfiguration/PlaybackPolicyWarning.tsx +0 -29
  75. package/src/components/uploadConfiguration/ResolutionTierSelector.tsx +0 -72
  76. package/src/components/uploadConfiguration/StaticRenditionSelector.tsx +0 -180
  77. package/src/components/withFocusRing/helpers.ts +0 -24
  78. package/src/components/withFocusRing/index.ts +0 -1
  79. package/src/components/withFocusRing/withFocusRing.ts +0 -30
  80. package/src/context/DialogStateContext.tsx +0 -36
  81. package/src/context/DrmPlaybackWarningContext.tsx +0 -93
  82. package/src/hooks/useAccessControl.ts +0 -13
  83. package/src/hooks/useAssetDocumentValues.ts +0 -11
  84. package/src/hooks/useAssets.ts +0 -68
  85. package/src/hooks/useCancelUpload.ts +0 -22
  86. package/src/hooks/useClient.ts +0 -8
  87. package/src/hooks/useDialogState.ts +0 -11
  88. package/src/hooks/useDocReferences.ts +0 -21
  89. package/src/hooks/useFetchFileSize.ts +0 -54
  90. package/src/hooks/useImportMuxAssets.ts +0 -132
  91. package/src/hooks/useInView.ts +0 -42
  92. package/src/hooks/useMediaMetadata.ts +0 -103
  93. package/src/hooks/useMuxAssets.ts +0 -179
  94. package/src/hooks/useMuxPolling.ts +0 -49
  95. package/src/hooks/useResyncAsset.ts +0 -110
  96. package/src/hooks/useResyncMuxMetadata.ts +0 -176
  97. package/src/hooks/useSaveSecrets.ts +0 -78
  98. package/src/hooks/useSecretsDocumentValues.ts +0 -38
  99. package/src/hooks/useSecretsFormState.ts +0 -47
  100. package/src/plugin.tsx +0 -31
  101. package/src/sanity-ui.d.ts +0 -5
  102. package/src/schema.ts +0 -196
  103. package/src/util/addKeysToMuxData.ts +0 -30
  104. package/src/util/areSecretsSignable.ts +0 -5
  105. package/src/util/asserters.ts +0 -36
  106. package/src/util/assetTitlePlaceholder.ts +0 -31
  107. package/src/util/constants.ts +0 -15
  108. package/src/util/convertWatermarkToMux.ts +0 -160
  109. package/src/util/createSearchFilter.ts +0 -76
  110. package/src/util/createUrlParamsObject.ts +0 -29
  111. package/src/util/extractFiles.ts +0 -67
  112. package/src/util/formatBytes.ts +0 -32
  113. package/src/util/formatDriveShareLink.ts +0 -64
  114. package/src/util/formatSeconds.ts +0 -49
  115. package/src/util/generateJwt.ts +0 -57
  116. package/src/util/getAnimatedPosterSrc.ts +0 -26
  117. package/src/util/getPlaybackPolicy.ts +0 -69
  118. package/src/util/getPosterSrc.ts +0 -28
  119. package/src/util/getStoryboardSrc.ts +0 -27
  120. package/src/util/getVideoMetadata.ts +0 -23
  121. package/src/util/getVideoSrc.ts +0 -23
  122. package/src/util/isSigned.ts +0 -20
  123. package/src/util/parsers.ts +0 -5
  124. package/src/util/pluginVersion.ts +0 -1
  125. package/src/util/readSecrets.ts +0 -38
  126. package/src/util/roundPxString.ts +0 -16
  127. package/src/util/textTracks.ts +0 -222
  128. package/src/util/tryWithSuspend.ts +0 -22
  129. package/src/util/types.ts +0 -596
  130. package/v2-incompatible.js +0 -11
@@ -1,100 +0,0 @@
1
- import {SearchIcon} from '@sanity/icons'
2
- import {Card, Flex, Grid, Inline, Label, Stack, Text, TextInput} from '@sanity/ui'
3
- import {useMemo, useState} from 'react'
4
-
5
- import {DrmPlaybackWarningContextProvider} from '../context/DrmPlaybackWarningContext'
6
- import useAssets from '../hooks/useAssets'
7
- import type {PluginConfig, VideoAssetDocument} from '../util/types'
8
- import ConfigureApi from './ConfigureApi'
9
- import ImportVideosFromMux from './ImportVideosFromMux'
10
- import PageSelector from './PageSelector'
11
- import ResyncMetadata from './ResyncMetadata'
12
- import {SelectSortOptions} from './SelectSortOptions'
13
- import SpinnerBox from './SpinnerBox'
14
- import type {VideoDetailsProps} from './VideoDetails/useVideoDetails'
15
- import VideoDetails from './VideoDetails/VideoDetails'
16
- import VideoInBrowser from './VideoInBrowser'
17
-
18
- export interface VideosBrowserProps {
19
- config: PluginConfig
20
- onSelect?: (asset: VideoAssetDocument) => void
21
- }
22
-
23
- export default function VideosBrowser({onSelect, config}: VideosBrowserProps) {
24
- const {assets, isLoading, searchQuery, setSearchQuery, setSort, sort} = useAssets()
25
- const [page, setPage] = useState<number>(0)
26
- const pageLimit = 20
27
- const pageTotal = Math.floor(assets.length / pageLimit) + 1
28
- const [editedAsset, setEditedAsset] = useState<VideoDetailsProps['asset'] | null>(null)
29
- const freshEditedAsset = useMemo(
30
- () => assets.find((a) => a._id === editedAsset?._id) || editedAsset,
31
- [editedAsset, assets]
32
- )
33
-
34
- const pageStart = page * pageLimit
35
- const pageEnd = pageStart + pageLimit
36
-
37
- const placement = onSelect ? 'input' : 'tool'
38
- return (
39
- <DrmPlaybackWarningContextProvider config={config}>
40
- <Stack padding={4} space={4} style={{minHeight: '50vh'}}>
41
- <Flex justify="space-between" align="center">
42
- <Flex align="center" gap={3}>
43
- <TextInput
44
- value={searchQuery}
45
- icon={SearchIcon}
46
- onInput={(e: React.FormEvent<HTMLInputElement>) =>
47
- setSearchQuery(e.currentTarget.value)
48
- }
49
- placeholder="Search videos"
50
- />
51
- <SelectSortOptions setSort={setSort} sort={sort} />
52
- <PageSelector page={page} setPage={setPage} total={pageTotal} />
53
- </Flex>
54
- {placement === 'tool' && (
55
- <Inline space={2}>
56
- <ImportVideosFromMux />
57
- <ResyncMetadata />
58
- <ConfigureApi />
59
- </Inline>
60
- )}
61
- </Flex>
62
- <Stack space={3}>
63
- {assets?.length > 0 && (
64
- <Label muted>
65
- {assets.length} video{assets.length > 1 ? 's' : null}{' '}
66
- {searchQuery ? `matching "${searchQuery}"` : 'found'}
67
- </Label>
68
- )}
69
- <Grid
70
- gap={2}
71
- style={{
72
- gridTemplateColumns: 'repeat(auto-fill, minmax(250px, 1fr))',
73
- }}
74
- >
75
- {assets.slice(pageStart, pageEnd).map((asset) => (
76
- <VideoInBrowser
77
- key={asset._id}
78
- asset={asset}
79
- onEdit={setEditedAsset}
80
- onSelect={onSelect}
81
- />
82
- ))}
83
- </Grid>
84
- </Stack>
85
- {isLoading && <SpinnerBox />}
86
-
87
- {!isLoading && assets.length === 0 && (
88
- <Card marginY={4} paddingX={4} paddingY={6} border radius={2} tone="transparent">
89
- <Text align="center" muted size={3}>
90
- {searchQuery ? `No videos found for "${searchQuery}"` : 'No videos in this dataset'}
91
- </Text>
92
- </Card>
93
- )}
94
- </Stack>
95
- {freshEditedAsset && (
96
- <VideoDetails closeDialog={() => setEditedAsset(null)} asset={freshEditedAsset} />
97
- )}
98
- </DrmPlaybackWarningContextProvider>
99
- )
100
- }
@@ -1,83 +0,0 @@
1
- // Adapted from https://github.com/sanity-io/sanity/blob/next/packages/sanity/src/desk/components/paneItem/PaneItem.tsx
2
-
3
- import {DocumentIcon} from '@sanity/icons'
4
- import type {PropsWithChildren} from 'react'
5
- import React, {useMemo} from 'react'
6
- import type {CollatedHit, FIXME, SanityDocument, SchemaType} from 'sanity'
7
- import {PreviewCard, useDocumentPresence, useDocumentPreviewStore, useSchema} from 'sanity'
8
- import {IntentLink} from 'sanity/router'
9
-
10
- import {MissingSchemaType} from './MissingSchemaType'
11
- import {PaneItemPreview} from './PaneItemPreview'
12
-
13
- interface DocumentPreviewProps {
14
- schemaType?: SchemaType
15
- documentPair: CollatedHit<SanityDocument>
16
- }
17
-
18
- /**
19
- * Return `false` if we explicitly disable the icon.
20
- * Otherwise return the passed icon or the schema type icon as a backup.
21
- */
22
- export function getIconWithFallback(
23
- icon: React.ComponentType<any> | false | undefined,
24
- schemaType: SchemaType | undefined,
25
- defaultIcon: React.ComponentType<any>
26
- ): React.ComponentType<any> | false {
27
- if (icon === false) {
28
- return false
29
- }
30
-
31
- return icon || ((schemaType && schemaType.icon) as any) || defaultIcon || false
32
- }
33
-
34
- function DocumentPreviewLink(props: DocumentPreviewProps) {
35
- return (linkProps: PropsWithChildren) => (
36
- <IntentLink intent="edit" params={{id: props.documentPair.id}}>
37
- {linkProps.children}
38
- </IntentLink>
39
- )
40
- }
41
-
42
- export function DocumentPreview(props: DocumentPreviewProps) {
43
- const {schemaType, documentPair} = props
44
- const doc = documentPair?.draft || documentPair?.published
45
- const id = documentPair.id || ''
46
- const documentPreviewStore = useDocumentPreviewStore()
47
- const schema = useSchema()
48
- const documentPresence = useDocumentPresence(id)
49
- const hasSchemaType = Boolean(schemaType && schemaType.name && schema.get(schemaType.name))
50
-
51
- const PreviewComponent = useMemo(() => {
52
- if (!doc) return null
53
-
54
- if (!schemaType || !hasSchemaType) {
55
- return <MissingSchemaType value={doc as SanityDocument} />
56
- }
57
-
58
- return (
59
- <PaneItemPreview
60
- documentPreviewStore={documentPreviewStore}
61
- icon={getIconWithFallback(undefined, schemaType, DocumentIcon)}
62
- schemaType={schemaType}
63
- layout="default"
64
- value={doc}
65
- presence={documentPresence}
66
- />
67
- )
68
- }, [hasSchemaType, schemaType, documentPresence, doc, documentPreviewStore])
69
-
70
- return (
71
- <PreviewCard
72
- __unstable_focusRing
73
- as={DocumentPreviewLink(props) as FIXME}
74
- data-as="a"
75
- data-ui="PaneItem"
76
- padding={2}
77
- radius={2}
78
- tone="inherit"
79
- >
80
- {PreviewComponent}
81
- </PreviewCard>
82
- )
83
- }
@@ -1,34 +0,0 @@
1
- // Adapted from https://github.com/sanity-io/sanity/blob/next/packages/sanity/src/desk/components/DraftStatus.tsx
2
- import {EditIcon} from '@sanity/icons'
3
- import {Box, Text, Tooltip} from '@sanity/ui'
4
- import type {PreviewValue, SanityDocument} from 'sanity'
5
- import {TextWithTone} from 'sanity'
6
-
7
- import {TimeAgo} from './TimeAgo'
8
-
9
- export function DraftStatus(props: {document?: PreviewValue | Partial<SanityDocument> | null}) {
10
- const {document} = props
11
- const updatedAt = document && '_updatedAt' in document && document._updatedAt
12
-
13
- return (
14
- <Tooltip
15
- animate
16
- portal
17
- content={
18
- <Box padding={2}>
19
- <Text size={1}>
20
- {document ? (
21
- <>Edited {updatedAt && <TimeAgo time={updatedAt} />}</>
22
- ) : (
23
- <>No unpublished edits</>
24
- )}
25
- </Text>
26
- </Box>
27
- }
28
- >
29
- <TextWithTone tone="caution" dimmed={!document} muted={!document} size={1}>
30
- <EditIcon />
31
- </TextWithTone>
32
- </Tooltip>
33
- )
34
- }
@@ -1,32 +0,0 @@
1
- // Adapted from https://github.com/sanity-io/sanity/blob/next/packages/sanity/src/desk/components/MissingSchemaType.tsx
2
- import {WarningOutlineIcon} from '@sanity/icons'
3
- import type {SanityDocument} from 'sanity'
4
- import type {GeneralPreviewLayoutKey} from 'sanity'
5
- import {SanityDefaultPreview} from 'sanity'
6
-
7
- export interface MissingSchemaTypeProps {
8
- layout?: GeneralPreviewLayoutKey
9
- value: SanityDocument
10
- }
11
-
12
- const getUnknownTypeFallback = (id: string, typeName: string) => ({
13
- title: (
14
- <em>
15
- No schema found for type <code>{typeName}</code>
16
- </em>
17
- ),
18
- subtitle: (
19
- <em>
20
- Document: <code>{id}</code>
21
- </em>
22
- ),
23
- media: () => <WarningOutlineIcon />,
24
- })
25
-
26
- export function MissingSchemaType(props: MissingSchemaTypeProps) {
27
- const {layout, value} = props
28
-
29
- return (
30
- <SanityDefaultPreview {...getUnknownTypeFallback(value._id, value._type)} layout={layout} />
31
- )
32
- }
@@ -1,74 +0,0 @@
1
- // Adapted from:
2
- // https://github.com/sanity-io/sanity/blob/next/packages/sanity/src/desk/components/paneItem/PaneItemPreview.tsx
3
- import {Inline} from '@sanity/ui'
4
- import {isNumber, isString} from 'lodash'
5
- import {isValidElement, useMemo} from 'react'
6
- import {useObservable} from 'react-rx'
7
- import type {SanityDocument, SchemaType} from 'sanity'
8
- import type {PreviewValue} from 'sanity'
9
- import {
10
- type DocumentPresence,
11
- DocumentPreviewPresence,
12
- type DocumentPreviewStore,
13
- type GeneralPreviewLayoutKey,
14
- getPreviewStateObservable,
15
- getPreviewValueWithFallback,
16
- isRecord,
17
- SanityDefaultPreview,
18
- } from 'sanity'
19
-
20
- import {DraftStatus} from './DraftStatus'
21
- import {PublishedStatus} from './PublishedStatus'
22
-
23
- export interface PaneItemPreviewState {
24
- isLoading?: boolean
25
- draft?: PreviewValue | Partial<SanityDocument> | null
26
- published?: PreviewValue | Partial<SanityDocument> | null
27
- }
28
-
29
- export interface PaneItemPreviewProps {
30
- documentPreviewStore: DocumentPreviewStore
31
- icon: React.ComponentType | false
32
- layout: GeneralPreviewLayoutKey
33
- presence?: DocumentPresence[]
34
- schemaType: SchemaType
35
- value: SanityDocument
36
- }
37
-
38
- export function PaneItemPreview(props: PaneItemPreviewProps) {
39
- const {icon, layout, presence, schemaType, value} = props
40
- const title =
41
- (isRecord(value.title) && isValidElement(value.title)) ||
42
- isString(value.title) ||
43
- isNumber(value.title)
44
- ? value.title
45
- : null
46
-
47
- const observable = useMemo(
48
- () => getPreviewStateObservable(props.documentPreviewStore, schemaType, value._id),
49
- [props.documentPreviewStore, schemaType, value._id]
50
- )
51
- const {snapshot, original, isLoading} = useObservable(observable, {
52
- isLoading: true,
53
- snapshot: null,
54
- original: null,
55
- })
56
-
57
- const status = isLoading ? null : (
58
- <Inline space={4}>
59
- {presence && presence.length > 0 && <DocumentPreviewPresence presence={presence} />}
60
- <PublishedStatus document={original} />
61
- <DraftStatus document={snapshot} />
62
- </Inline>
63
- )
64
-
65
- return (
66
- <SanityDefaultPreview
67
- {...(getPreviewValueWithFallback({snapshot, original, fallback: {title}}) as any)}
68
- isPlaceholder={isLoading}
69
- icon={icon}
70
- layout={layout}
71
- status={status}
72
- />
73
- )
74
- }
@@ -1,35 +0,0 @@
1
- // Adapted from https://github.com/sanity-io/sanity/blob/next/packages/sanity/src/desk/components/PublishedStatus.tsx
2
-
3
- import {PublishIcon} from '@sanity/icons'
4
- import {Box, Text, Tooltip} from '@sanity/ui'
5
- import type {PreviewValue, SanityDocument} from 'sanity'
6
- import {TextWithTone} from 'sanity'
7
-
8
- import {TimeAgo} from './TimeAgo'
9
-
10
- export function PublishedStatus(props: {document?: PreviewValue | Partial<SanityDocument> | null}) {
11
- const {document} = props
12
- const updatedAt = document && '_updatedAt' in document && document._updatedAt
13
-
14
- return (
15
- <Tooltip
16
- animate
17
- portal
18
- content={
19
- <Box padding={2}>
20
- <Text size={1}>
21
- {document ? (
22
- <>Published {updatedAt && <TimeAgo time={updatedAt} />}</>
23
- ) : (
24
- <>Not published</>
25
- )}
26
- </Text>
27
- </Box>
28
- }
29
- >
30
- <TextWithTone tone="positive" dimmed={!document} muted={!document} size={1}>
31
- <PublishIcon />
32
- </TextWithTone>
33
- </Tooltip>
34
- )
35
- }
@@ -1,12 +0,0 @@
1
- // Adapted from https://github.com/sanity-io/sanity/blob/next/packages/sanity/src/desk/components/TimeAgo.tsx
2
- import {useTimeAgo} from 'sanity'
3
-
4
- export interface TimeAgoProps {
5
- time: string | Date
6
- }
7
-
8
- export function TimeAgo({time}: TimeAgoProps) {
9
- const timeAgo = useTimeAgo(time)
10
-
11
- return <span title={timeAgo}>{timeAgo} ago</span>
12
- }
@@ -1,7 +0,0 @@
1
- import type {PreviewValue, SanityDocument} from 'sanity'
2
-
3
- export interface PaneItemPreviewState {
4
- isLoading?: boolean
5
- draft?: PreviewValue | Partial<SanityDocument> | null
6
- published?: PreviewValue | Partial<SanityDocument> | null
7
- }
@@ -1,13 +0,0 @@
1
- import type {SVGProps} from 'react'
2
-
3
- export function AudioIcon(props: SVGProps<SVGSVGElement>) {
4
- return (
5
- <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...props}>
6
- <path
7
- fill="currentColor"
8
- style={{opacity: '0.65'}}
9
- d="M10.75 19q.95 0 1.6-.65t.65-1.6V13h3v-2h-4v3.875q-.275-.2-.587-.288t-.663-.087q-.95 0-1.6.65t-.65 1.6t.65 1.6t1.6.65M6 22q-.825 0-1.412-.587T4 20V4q0-.825.588-1.412T6 2h8l6 6v12q0 .825-.587 1.413T18 22zm7-13V4H6v16h12V9zM6 4v5zv16z"
10
- />
11
- </svg>
12
- )
13
- }
@@ -1,12 +0,0 @@
1
- import type {SVGProps} from 'react'
2
-
3
- export function ResolutionIcon(props: SVGProps<SVGSVGElement>) {
4
- return (
5
- <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...props}>
6
- <path
7
- fill="currentColor"
8
- d="M20 9V6h-3V4h5v5h-2ZM2 9V4h5v2H4v3H2Zm15 11v-2h3v-3h2v5h-5ZM2 20v-5h2v3h3v2H2Zm4-4V8h12v8H6Zm2-2h8v-4H8v4Zm0 0v-4v4Z"
9
- />
10
- </svg>
11
- )
12
- }
@@ -1,20 +0,0 @@
1
- import type {SVGProps} from 'react'
2
-
3
- export function StopWatchIcon(props: SVGProps<SVGSVGElement>) {
4
- return (
5
- <svg
6
- xmlns="http://www.w3.org/2000/svg"
7
- width="1em"
8
- height="1em"
9
- viewBox="0 0 512 512"
10
- {...props}
11
- >
12
- <path d="M232 306.667h48V176h-48v130.667z" fill="currentColor" />
13
- <path
14
- d="M407.67 170.271l30.786-30.786-33.942-33.941-30.785 30.786C341.217 111.057 300.369 96 256 96 149.961 96 64 181.961 64 288s85.961 192 192 192 192-85.961 192-192c0-44.369-15.057-85.217-40.33-117.729zm-45.604 223.795C333.734 422.398 296.066 438 256 438s-77.735-15.602-106.066-43.934C121.602 365.735 106 328.066 106 288s15.602-77.735 43.934-106.066C178.265 153.602 215.934 138 256 138s77.734 15.602 106.066 43.934C390.398 210.265 406 247.934 406 288s-15.602 77.735-43.934 106.066z"
15
- fill="currentColor"
16
- />
17
- <path d="M192 32h128v48H192z" fill="currentColor" />
18
- </svg>
19
- )
20
- }
@@ -1,19 +0,0 @@
1
- /**
2
- * Icon of a monitor with a play button.
3
- * Credits: material design icons & react-icons
4
- */
5
- const ToolIcon = () => (
6
- <svg
7
- stroke="currentColor"
8
- fill="currentColor"
9
- strokeWidth="0"
10
- viewBox="0 0 24 24"
11
- height="1em"
12
- width="1em"
13
- xmlns="http://www.w3.org/2000/svg"
14
- >
15
- <path d="M21 3H3c-1.11 0-2 .89-2 2v12c0 1.1.89 2 2 2h5v2h8v-2h5c1.1 0 1.99-.9 1.99-2L23 5c0-1.11-.9-2-2-2zm0 14H3V5h18v12zm-5-6l-7 4V7z" />
16
- </svg>
17
- )
18
-
19
- export default ToolIcon
@@ -1,133 +0,0 @@
1
- import {Code, Grid, Text} from '@sanity/ui'
2
- import {ActionDispatch} from 'react'
3
-
4
- import {Secrets, UploadConfig} from '../../util/types'
5
- import {UploadConfigurationStateAction} from '../UploadConfiguration'
6
- import PlaybackPolicyOption from './PlaybackPolicyOption'
7
- import PlaybackPolicyWarning from './PlaybackPolicyWarning'
8
-
9
- export default function PlaybackPolicy({
10
- id,
11
- config,
12
- secrets,
13
- dispatch,
14
- }: {
15
- id: string
16
- config: UploadConfig
17
- secrets: Secrets
18
- dispatch: ActionDispatch<[action: UploadConfigurationStateAction]>
19
- }) {
20
- const noPolicySelected = !(config.public_policy || config.signed_policy || config.drm_policy)
21
- const drmPolicyDisabled = !secrets.drmConfigId
22
- return (
23
- <Grid gap={3}>
24
- <Text weight="bold">Advanced Playback Policies</Text>
25
- <PlaybackPolicyOption
26
- id={`${id}--public`}
27
- checked={config.public_policy}
28
- optionName="Public"
29
- description={
30
- <>
31
- <Text size={2} muted>
32
- Playback IDs are accessible by constructing an HLS URL like
33
- </Text>
34
- <Code>{'https://stream.mux.com/{PLAYBACK_ID}'}</Code>
35
- </>
36
- }
37
- dispatch={dispatch}
38
- action="public_policy"
39
- />
40
- {secrets.enableSignedUrls && (
41
- <PlaybackPolicyOption
42
- id={`${id}--signed`}
43
- checked={config.signed_policy}
44
- optionName="Signed"
45
- description={
46
- <>
47
- <Text size={2} muted>
48
- Playback IDs should be used with tokens
49
- </Text>
50
- <Code>{'https://stream.mux.com/{PLAYBACK_ID}?token={TOKEN}'}</Code>
51
- <Text size={2} muted>
52
- See{' '}
53
- <a
54
- href="https://www.mux.com/docs/guides/secure-video-playback"
55
- target="_blank"
56
- rel="noopener noreferrer"
57
- >
58
- Secure video playback
59
- </a>{' '}
60
- for details about creating tokens.
61
- </Text>
62
- </>
63
- }
64
- // See Secure video playback for details about creating tokens."
65
- dispatch={dispatch}
66
- action="signed_policy"
67
- />
68
- )}
69
- {drmPolicyDisabled ? (
70
- <PlaybackPolicyOption
71
- id={`${id}--drm`}
72
- checked={false}
73
- optionName="DRM - Disabled"
74
- description={
75
- <>
76
- <Text size={2} muted>
77
- To enable DRM add your DRM Configuration Id to your plugin configuration in the API
78
- Credentials view.{' '}
79
- <a
80
- href="https://www.mux.com/support/human"
81
- target="_blank"
82
- rel="noopener noreferrer"
83
- >
84
- Contact us
85
- </a>{' '}
86
- to get started using DRM.
87
- </Text>
88
- </>
89
- }
90
- dispatch={dispatch}
91
- disabled
92
- />
93
- ) : (
94
- <PlaybackPolicyOption
95
- id={`${id}--drm`}
96
- checked={config.drm_policy}
97
- optionName="DRM"
98
- description={
99
- <>
100
- <Text size={2} muted>
101
- Playback IDs should be used with tokens as with Signed playback, but require extra
102
- configuration.
103
- </Text>
104
- <Code>{'https://stream.mux.com/{PLAYBACK_ID}?token={TOKEN}'}</Code>
105
- <Text size={2} muted>
106
- See{' '}
107
- <a
108
- href="https://www.mux.com/docs/guides/protect-videos-with-drm#play-drm-protected-videos"
109
- target="_blank"
110
- rel="noopener noreferrer"
111
- >
112
- Protect videos with DRM
113
- </a>{' '}
114
- for details about configuring your player for DRM playback and{' '}
115
- <a
116
- href="https://www.mux.com/docs/guides/secure-video-playback"
117
- target="_blank"
118
- rel="noopener noreferrer"
119
- >
120
- Secure video playback
121
- </a>{' '}
122
- for details about creating tokens.
123
- </Text>
124
- </>
125
- }
126
- dispatch={dispatch}
127
- action="drm_policy"
128
- />
129
- )}
130
- {noPolicySelected && <PlaybackPolicyWarning />}
131
- </Grid>
132
- )
133
- }
@@ -1,76 +0,0 @@
1
- import {Checkbox, Flex, Grid, Text} from '@sanity/ui'
2
- import {ActionDispatch, CSSProperties, ReactNode, useState} from 'react'
3
-
4
- import {UploadConfigurationStateAction} from '../UploadConfiguration'
5
-
6
- export default function PlaybackPolicyOption({
7
- id,
8
- checked,
9
- optionName,
10
- description,
11
- dispatch,
12
- action,
13
- disabled,
14
- }: {
15
- id: string
16
- checked: boolean
17
- optionName: string
18
- description: string | ReactNode
19
- dispatch: ActionDispatch<[action: UploadConfigurationStateAction]>
20
- action?: 'public_policy' | 'signed_policy' | 'drm_policy'
21
- disabled?: boolean
22
- }) {
23
- const [scale, setScale] = useState(1)
24
-
25
- const boxStyle: CSSProperties = {
26
- outline: '0.01rem solid grey',
27
- transform: `scale(${scale})`,
28
- transition: 'transform 0.1s ease-in-out',
29
- cursor: disabled ? 'not-allowed' : 'pointer',
30
- borderRadius: '0.25rem',
31
- }
32
-
33
- const triggerAnimation = () => {
34
- setScale(0.98)
35
- setTimeout(() => {
36
- setScale(1)
37
- }, 100)
38
- }
39
-
40
- const handleBoxClick = () => {
41
- if (!action) return
42
- triggerAnimation()
43
- dispatch({
44
- action,
45
- value: !checked,
46
- })
47
- }
48
-
49
- const descriptionJsx =
50
- typeof description === 'string' ? (
51
- <Text size={2} muted>
52
- {description}
53
- </Text>
54
- ) : (
55
- description
56
- )
57
- return (
58
- <label>
59
- <Flex gap={3} padding={3} style={boxStyle}>
60
- <Checkbox
61
- id={id}
62
- required
63
- checked={checked}
64
- onChange={handleBoxClick}
65
- disabled={disabled}
66
- />
67
- <Grid gap={3}>
68
- <Text size={3} weight="bold">
69
- {optionName}
70
- </Text>
71
- {descriptionJsx}
72
- </Grid>
73
- </Flex>
74
- </label>
75
- )
76
- }