sanity-plugin-mux-input 3.0.0 → 3.0.1
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 +3 -49
- package/dist/index.d.mts +160 -159
- package/dist/index.d.ts +160 -159
- package/dist/index.js +19 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -37
package/dist/index.d.ts
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
import type MuxPlayerElement from
|
|
2
|
-
import type {PartialDeep} from
|
|
3
|
-
import {Plugin as Plugin_2} from
|
|
1
|
+
import type MuxPlayerElement from "@mux/mux-player";
|
|
2
|
+
import type { PartialDeep } from "type-fest";
|
|
3
|
+
import { Plugin as Plugin_2 } from "sanity";
|
|
4
4
|
|
|
5
|
-
export declare const defaultConfig: PluginConfig
|
|
5
|
+
export declare const defaultConfig: PluginConfig;
|
|
6
6
|
|
|
7
7
|
declare interface MuxAsset {
|
|
8
|
-
id: string
|
|
8
|
+
id: string;
|
|
9
9
|
/** In seconds (instead of JS's default milliseconds) */
|
|
10
|
-
created_at: string
|
|
11
|
-
status:
|
|
12
|
-
duration: number
|
|
13
|
-
max_stored_resolution:
|
|
14
|
-
max_stored_frame_rate: -1 | number
|
|
15
|
-
aspect_ratio: `${number}:${number}
|
|
16
|
-
playback_ids: MuxPlaybackId[]
|
|
17
|
-
tracks: MuxTrack[]
|
|
18
|
-
errors?: MuxErrors
|
|
19
|
-
upload_id: string
|
|
20
|
-
is_live?: boolean
|
|
21
|
-
passthrough: string
|
|
22
|
-
live_stream_id?: string
|
|
10
|
+
created_at: string;
|
|
11
|
+
status: "preparing" | "ready" | "errored";
|
|
12
|
+
duration: number;
|
|
13
|
+
max_stored_resolution: "Audio only" | "SD" | "HD" | "FHD" | "UHD";
|
|
14
|
+
max_stored_frame_rate: -1 | number;
|
|
15
|
+
aspect_ratio: `${number}:${number}`;
|
|
16
|
+
playback_ids: MuxPlaybackId[];
|
|
17
|
+
tracks: MuxTrack[];
|
|
18
|
+
errors?: MuxErrors;
|
|
19
|
+
upload_id: string;
|
|
20
|
+
is_live?: boolean;
|
|
21
|
+
passthrough: string;
|
|
22
|
+
live_stream_id?: string;
|
|
23
23
|
master?: {
|
|
24
|
-
status:
|
|
25
|
-
url: string
|
|
26
|
-
}
|
|
27
|
-
master_access:
|
|
28
|
-
mp4_support:
|
|
29
|
-
source_asset_id?: string
|
|
30
|
-
normalize_audio?: boolean
|
|
24
|
+
status: "ready" | "preparing" | "errored";
|
|
25
|
+
url: string;
|
|
26
|
+
};
|
|
27
|
+
master_access: "temporary" | "none";
|
|
28
|
+
mp4_support: "standard" | "none";
|
|
29
|
+
source_asset_id?: string;
|
|
30
|
+
normalize_audio?: boolean;
|
|
31
31
|
static_renditions?: {
|
|
32
|
-
status:
|
|
32
|
+
status: "ready" | "preparing" | "disabled" | "errored";
|
|
33
33
|
files: {
|
|
34
|
-
name: string
|
|
35
|
-
ext:
|
|
36
|
-
height: number
|
|
37
|
-
width: number
|
|
38
|
-
bitrate: number
|
|
39
|
-
filesize: string
|
|
40
|
-
type:
|
|
41
|
-
status:
|
|
42
|
-
resolution_tier?: string
|
|
43
|
-
resolution?: string
|
|
44
|
-
id: string
|
|
45
|
-
passthrough?: string
|
|
46
|
-
}[]
|
|
47
|
-
}
|
|
34
|
+
name: string;
|
|
35
|
+
ext: "mp4" | "m4a";
|
|
36
|
+
height: number;
|
|
37
|
+
width: number;
|
|
38
|
+
bitrate: number;
|
|
39
|
+
filesize: string;
|
|
40
|
+
type: "standard" | "advanced";
|
|
41
|
+
status: "ready" | "preparing" | "skipped" | "errored";
|
|
42
|
+
resolution_tier?: string;
|
|
43
|
+
resolution?: string;
|
|
44
|
+
id: string;
|
|
45
|
+
passthrough?: string;
|
|
46
|
+
}[];
|
|
47
|
+
};
|
|
48
48
|
recording_times?: {
|
|
49
|
-
started_at: string
|
|
50
|
-
duration: number
|
|
51
|
-
type:
|
|
52
|
-
}[]
|
|
49
|
+
started_at: string;
|
|
50
|
+
duration: number;
|
|
51
|
+
type: "content" | "slate";
|
|
52
|
+
}[];
|
|
53
53
|
non_standard_input_reasons?: {
|
|
54
|
-
video_codec?: string
|
|
55
|
-
audio_codec?: string
|
|
56
|
-
video_gop_size?:
|
|
57
|
-
video_frame_rate?: string
|
|
58
|
-
video_resolution?: string
|
|
59
|
-
video_bitrate?:
|
|
60
|
-
pixel_aspect_ratio?: string
|
|
61
|
-
video_edit_list?:
|
|
62
|
-
audio_edit_list?:
|
|
63
|
-
unexpected_media_file_parameters?:
|
|
64
|
-
test?: boolean
|
|
65
|
-
}
|
|
54
|
+
video_codec?: string;
|
|
55
|
+
audio_codec?: string;
|
|
56
|
+
video_gop_size?: "high";
|
|
57
|
+
video_frame_rate?: string;
|
|
58
|
+
video_resolution?: string;
|
|
59
|
+
video_bitrate?: "high";
|
|
60
|
+
pixel_aspect_ratio?: string;
|
|
61
|
+
video_edit_list?: "non-standard";
|
|
62
|
+
audio_edit_list?: "non-standard";
|
|
63
|
+
unexpected_media_file_parameters?: "non-standard";
|
|
64
|
+
test?: boolean;
|
|
65
|
+
};
|
|
66
66
|
meta?: {
|
|
67
|
-
title?: string
|
|
68
|
-
}
|
|
67
|
+
title?: string;
|
|
68
|
+
};
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
declare interface MuxAudioTrack {
|
|
72
|
-
type:
|
|
73
|
-
id: string
|
|
74
|
-
duration?: number
|
|
75
|
-
max_channels: number
|
|
76
|
-
max_channel_layout:
|
|
72
|
+
type: "audio";
|
|
73
|
+
id: string;
|
|
74
|
+
duration?: number;
|
|
75
|
+
max_channels: number;
|
|
76
|
+
max_channel_layout: "stereo" | string;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
declare interface MuxErrors {
|
|
80
|
-
type: string
|
|
81
|
-
messages: string[]
|
|
80
|
+
type: string;
|
|
81
|
+
messages: string[];
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
export declare const muxInput: Plugin_2<void | Partial<PluginConfig
|
|
84
|
+
export declare const muxInput: Plugin_2<void | Partial<PluginConfig>>;
|
|
85
85
|
|
|
86
86
|
declare interface MuxInputConfig {
|
|
87
87
|
/**
|
|
@@ -95,7 +95,7 @@ declare interface MuxInputConfig {
|
|
|
95
95
|
* @see {@link https://docs.mux.com/guides/video/enable-static-mp4-renditions}
|
|
96
96
|
* @defaultValue []
|
|
97
97
|
*/
|
|
98
|
-
static_renditions: StaticRenditionResolution[]
|
|
98
|
+
static_renditions: StaticRenditionResolution[];
|
|
99
99
|
/**
|
|
100
100
|
* @deprecated Use `static_renditions` instead. This field is kept for backward compatibility.
|
|
101
101
|
* Enable static renditions by setting this to 'standard'. Can be overwritten on a per-asset basis.
|
|
@@ -103,14 +103,14 @@ declare interface MuxInputConfig {
|
|
|
103
103
|
* @see {@link https://docs.mux.com/guides/video/enable-static-mp4-renditions#why-enable-mp4-support}
|
|
104
104
|
* @defaultValue 'none'
|
|
105
105
|
*/
|
|
106
|
-
mp4_support:
|
|
106
|
+
mp4_support: "none" | "standard";
|
|
107
107
|
/**
|
|
108
108
|
* Max resolution tier can be used to control the maximum resolution_tier your asset is encoded, stored, and streamed at.
|
|
109
109
|
* Requires `"video_quality": "plus"`
|
|
110
110
|
* @see {@link https://docs.mux.com/guides/stream-videos-in-4k}
|
|
111
111
|
* @defaultValue '1080p'
|
|
112
112
|
*/
|
|
113
|
-
max_resolution_tier:
|
|
113
|
+
max_resolution_tier: "2160p" | "1440p" | "1080p";
|
|
114
114
|
/**
|
|
115
115
|
* @deprecated Use {@link video_quality}
|
|
116
116
|
* <br>
|
|
@@ -118,36 +118,36 @@ declare interface MuxInputConfig {
|
|
|
118
118
|
* @see {@link https://docs.mux.com/guides/use-encoding-tiers}
|
|
119
119
|
* @defaultValue 'smart'
|
|
120
120
|
*/
|
|
121
|
-
encoding_tier?:
|
|
121
|
+
encoding_tier?: "baseline" | "smart";
|
|
122
122
|
/**
|
|
123
123
|
* The video quality level informs the cost, quality, and available platform features for the asset.
|
|
124
124
|
* @see {@link https://www.mux.com/docs/guides/use-video-quality-levels}
|
|
125
125
|
* @defaultValue 'plus'
|
|
126
126
|
*/
|
|
127
|
-
video_quality:
|
|
127
|
+
video_quality: "basic" | "plus" | "premium";
|
|
128
128
|
/**
|
|
129
129
|
* Normalize the audio track loudness level.
|
|
130
130
|
* @see {@link https://docs.mux.com/guides/adjust-audio-levels#how-to-turn-on-audio-normalization}
|
|
131
131
|
* @defaultValue false
|
|
132
132
|
*/
|
|
133
|
-
normalize_audio: boolean
|
|
133
|
+
normalize_audio: boolean;
|
|
134
134
|
/**
|
|
135
135
|
* Enables signed URLs by default, if you configured them with your API token.
|
|
136
136
|
* @see {@link https://docs.mux.com/guides/secure-video-playback}
|
|
137
137
|
* @defaultValue false
|
|
138
138
|
*/
|
|
139
|
-
defaultSigned?: boolean
|
|
139
|
+
defaultSigned?: boolean;
|
|
140
140
|
/**
|
|
141
141
|
* Enables public URLs by default.
|
|
142
142
|
* @defaultValue true
|
|
143
143
|
*/
|
|
144
|
-
defaultPublic?: boolean
|
|
144
|
+
defaultPublic?: boolean;
|
|
145
145
|
/**
|
|
146
146
|
* Enables DRM Protection by default, if you configured your DRM Configuration Id.
|
|
147
147
|
* @see {@link https://www.mux.com/docs/guides/protect-videos-with-drm}
|
|
148
148
|
* @defaultValue true
|
|
149
149
|
*/
|
|
150
|
-
defaultDrm?: boolean
|
|
150
|
+
defaultDrm?: boolean;
|
|
151
151
|
/**
|
|
152
152
|
* Auto-generate captions for these languages by default.
|
|
153
153
|
* Requires `"video_quality": "plus"`
|
|
@@ -155,14 +155,14 @@ declare interface MuxInputConfig {
|
|
|
155
155
|
* @see {@link https://docs.mux.com/guides/add-autogenerated-captions-and-use-transcripts}
|
|
156
156
|
* @deprecated use `defaultAutogeneratedSubtitleLang` instead. Only a single autogenerated
|
|
157
157
|
*/
|
|
158
|
-
defaultAutogeneratedSubtitleLangs?: SupportedMuxLanguage[]
|
|
158
|
+
defaultAutogeneratedSubtitleLangs?: SupportedMuxLanguage[];
|
|
159
159
|
/**
|
|
160
160
|
* Auto-generate captions for this language by default. Users can still
|
|
161
161
|
* Requires `"video_quality": "plus"`
|
|
162
162
|
*
|
|
163
163
|
* @see {@link https://docs.mux.com/guides/add-autogenerated-captions-and-use-transcripts}
|
|
164
164
|
*/
|
|
165
|
-
defaultAutogeneratedSubtitleLang?: SupportedMuxLanguage
|
|
165
|
+
defaultAutogeneratedSubtitleLang?: SupportedMuxLanguage;
|
|
166
166
|
/**
|
|
167
167
|
* Whether or not to allow content editors to override asset upload
|
|
168
168
|
* configuration settings when uploading a video to Mux.
|
|
@@ -170,7 +170,7 @@ declare interface MuxInputConfig {
|
|
|
170
170
|
* @see {@link https://docs.mux.com/guides/secure-video-playback}
|
|
171
171
|
* @defaultValue false
|
|
172
172
|
*/
|
|
173
|
-
disableUploadConfig?: boolean
|
|
173
|
+
disableUploadConfig?: boolean;
|
|
174
174
|
/**
|
|
175
175
|
* Whether or not to allow content editors to add text tracks alongside their
|
|
176
176
|
* asset when uploading a video to Mux.
|
|
@@ -178,13 +178,13 @@ declare interface MuxInputConfig {
|
|
|
178
178
|
* @see {@link https://docs.mux.com/guides/secure-video-playback}
|
|
179
179
|
* @defaultValue false
|
|
180
180
|
*/
|
|
181
|
-
disableTextTrackConfig?: boolean
|
|
181
|
+
disableTextTrackConfig?: boolean;
|
|
182
182
|
/**
|
|
183
183
|
* Whether or not to show the playback warning when trying to watch DRM content for the first time.
|
|
184
184
|
*
|
|
185
185
|
* @defaultValue false
|
|
186
186
|
*/
|
|
187
|
-
disableDrmPlaybackWarning?: boolean
|
|
187
|
+
disableDrmPlaybackWarning?: boolean;
|
|
188
188
|
/**
|
|
189
189
|
* The mime types that are accepted by the input.
|
|
190
190
|
*
|
|
@@ -192,7 +192,7 @@ declare interface MuxInputConfig {
|
|
|
192
192
|
* @defaultValue ['video/*','audio/*']
|
|
193
193
|
|
|
194
194
|
*/
|
|
195
|
-
acceptedMimeTypes?: (
|
|
195
|
+
acceptedMimeTypes?: ("audio/*" | "video/*")[];
|
|
196
196
|
/**
|
|
197
197
|
* Maximum file size allowed for video uploads in bytes.
|
|
198
198
|
* If not specified, no file size validation will be performed.
|
|
@@ -200,7 +200,7 @@ declare interface MuxInputConfig {
|
|
|
200
200
|
* @example 1024 * 1024 * 1024 // 1 GB
|
|
201
201
|
* @defaultValue undefined
|
|
202
202
|
*/
|
|
203
|
-
maxAssetFileSize?: number
|
|
203
|
+
maxAssetFileSize?: number;
|
|
204
204
|
/**
|
|
205
205
|
* Maximum video duration allowed in seconds.
|
|
206
206
|
* If not specified, no duration validation will be performed.
|
|
@@ -208,7 +208,7 @@ declare interface MuxInputConfig {
|
|
|
208
208
|
* @example 2 * 60 * 60 // 2 hours
|
|
209
209
|
* @defaultValue undefined
|
|
210
210
|
*/
|
|
211
|
-
maxAssetDuration?: number
|
|
211
|
+
maxAssetDuration?: number;
|
|
212
212
|
/**
|
|
213
213
|
* HLS.js configuration options to be passed to the Mux Player.
|
|
214
214
|
* These options allow you to customize the underlying HLS.js playback engine behavior.
|
|
@@ -224,47 +224,47 @@ declare interface MuxInputConfig {
|
|
|
224
224
|
* }
|
|
225
225
|
* ```
|
|
226
226
|
*/
|
|
227
|
-
hlsConfig?: MuxPlayerElement[
|
|
227
|
+
hlsConfig?: MuxPlayerElement["_hlsConfig"];
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
declare interface MuxPlaybackId {
|
|
231
|
-
id: string
|
|
232
|
-
policy: PlaybackPolicy
|
|
231
|
+
id: string;
|
|
232
|
+
policy: PlaybackPolicy;
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
declare interface MuxTextTrack {
|
|
236
|
-
type:
|
|
237
|
-
id: string
|
|
238
|
-
text_type?:
|
|
236
|
+
type: "text";
|
|
237
|
+
id: string;
|
|
238
|
+
text_type?: "subtitles";
|
|
239
239
|
text_source?:
|
|
240
|
-
|
|
|
241
|
-
|
|
|
242
|
-
|
|
|
243
|
-
|
|
|
244
|
-
|
|
|
245
|
-
language_code?:
|
|
246
|
-
name?:
|
|
247
|
-
closed_captions?: boolean
|
|
248
|
-
passthrough?: string
|
|
249
|
-
status:
|
|
240
|
+
| "uploaded"
|
|
241
|
+
| "embedded"
|
|
242
|
+
| "generated_live"
|
|
243
|
+
| "generated_live_final"
|
|
244
|
+
| "generated_vod";
|
|
245
|
+
language_code?: "en" | "en-US" | string;
|
|
246
|
+
name?: "English" | string;
|
|
247
|
+
closed_captions?: boolean;
|
|
248
|
+
passthrough?: string;
|
|
249
|
+
status: "preparing" | "ready" | "errored";
|
|
250
250
|
error?: {
|
|
251
|
-
type: string
|
|
252
|
-
messages?: string[]
|
|
253
|
-
}
|
|
251
|
+
type: string;
|
|
252
|
+
messages?: string[];
|
|
253
|
+
};
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
declare type MuxTrack = MuxVideoTrack | MuxAudioTrack | MuxTextTrack
|
|
256
|
+
declare type MuxTrack = MuxVideoTrack | MuxAudioTrack | MuxTextTrack;
|
|
257
257
|
|
|
258
258
|
declare interface MuxVideoTrack {
|
|
259
|
-
type:
|
|
260
|
-
id: string
|
|
261
|
-
max_width: number
|
|
262
|
-
max_height: number
|
|
263
|
-
max_frame_rate: -1 | number
|
|
264
|
-
duration?: number
|
|
259
|
+
type: "video";
|
|
260
|
+
id: string;
|
|
261
|
+
max_width: number;
|
|
262
|
+
max_height: number;
|
|
263
|
+
max_frame_rate: -1 | number;
|
|
264
|
+
duration?: number;
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
-
declare type PlaybackPolicy =
|
|
267
|
+
declare type PlaybackPolicy = "signed" | "public" | "drm";
|
|
268
268
|
|
|
269
269
|
declare interface PluginConfig extends MuxInputConfig {
|
|
270
270
|
/**
|
|
@@ -276,71 +276,72 @@ declare interface PluginConfig extends MuxInputConfig {
|
|
|
276
276
|
tool:
|
|
277
277
|
| false
|
|
278
278
|
| {
|
|
279
|
-
title?: string
|
|
280
|
-
icon?: React.ComponentType
|
|
281
|
-
}
|
|
279
|
+
title?: string;
|
|
280
|
+
icon?: React.ComponentType;
|
|
281
|
+
};
|
|
282
282
|
/**
|
|
283
283
|
* The roles that are allowed to configure the plugin.
|
|
284
284
|
*
|
|
285
285
|
* If not set, all roles will be allowed to configure the plugin.
|
|
286
286
|
* @defaultValue []
|
|
287
287
|
*/
|
|
288
|
-
allowedRolesForConfiguration: string[]
|
|
288
|
+
allowedRolesForConfiguration: string[];
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
/**
|
|
292
292
|
* All static rendition resolution options supported by Mux
|
|
293
293
|
*/
|
|
294
294
|
declare type StaticRenditionResolution =
|
|
295
|
-
|
|
|
296
|
-
|
|
|
297
|
-
|
|
|
298
|
-
|
|
|
299
|
-
|
|
|
300
|
-
|
|
|
301
|
-
|
|
|
302
|
-
|
|
|
303
|
-
|
|
|
304
|
-
|
|
|
295
|
+
| "highest"
|
|
296
|
+
| "audio-only"
|
|
297
|
+
| "270p"
|
|
298
|
+
| "360p"
|
|
299
|
+
| "480p"
|
|
300
|
+
| "540p"
|
|
301
|
+
| "720p"
|
|
302
|
+
| "1080p"
|
|
303
|
+
| "1440p"
|
|
304
|
+
| "2160p";
|
|
305
305
|
|
|
306
306
|
declare const SUPPORTED_MUX_LANGUAGES_VALUES: (
|
|
307
|
-
|
|
|
308
|
-
|
|
|
309
|
-
|
|
|
310
|
-
|
|
|
311
|
-
|
|
|
312
|
-
|
|
|
313
|
-
|
|
|
314
|
-
|
|
|
315
|
-
|
|
|
316
|
-
|
|
|
317
|
-
|
|
|
318
|
-
|
|
|
319
|
-
|
|
|
320
|
-
|
|
|
321
|
-
|
|
|
322
|
-
|
|
|
323
|
-
|
|
|
324
|
-
|
|
|
325
|
-
|
|
|
326
|
-
|
|
|
327
|
-
|
|
|
328
|
-
|
|
|
329
|
-
)[]
|
|
307
|
+
| "en"
|
|
308
|
+
| "es"
|
|
309
|
+
| "it"
|
|
310
|
+
| "pt"
|
|
311
|
+
| "de"
|
|
312
|
+
| "fr"
|
|
313
|
+
| "pl"
|
|
314
|
+
| "ru"
|
|
315
|
+
| "nl"
|
|
316
|
+
| "ca"
|
|
317
|
+
| "tr"
|
|
318
|
+
| "sv"
|
|
319
|
+
| "uk"
|
|
320
|
+
| "no"
|
|
321
|
+
| "fi"
|
|
322
|
+
| "sk"
|
|
323
|
+
| "el"
|
|
324
|
+
| "cs"
|
|
325
|
+
| "hr"
|
|
326
|
+
| "da"
|
|
327
|
+
| "ro"
|
|
328
|
+
| "bg"
|
|
329
|
+
)[];
|
|
330
330
|
|
|
331
|
-
declare type SupportedMuxLanguage =
|
|
331
|
+
declare type SupportedMuxLanguage =
|
|
332
|
+
(typeof SUPPORTED_MUX_LANGUAGES_VALUES)[number];
|
|
332
333
|
|
|
333
334
|
export declare interface VideoAssetDocument {
|
|
334
|
-
_id: string
|
|
335
|
-
_type:
|
|
336
|
-
_createdAt: string
|
|
337
|
-
_updatedAt?: string
|
|
338
|
-
status?: string
|
|
339
|
-
assetId?: string
|
|
340
|
-
playbackId?: string
|
|
341
|
-
filename?: string
|
|
342
|
-
thumbTime?: number
|
|
343
|
-
data?: PartialDeep<MuxAsset
|
|
335
|
+
_id: string;
|
|
336
|
+
_type: "mux.videoAsset";
|
|
337
|
+
_createdAt: string;
|
|
338
|
+
_updatedAt?: string;
|
|
339
|
+
status?: string;
|
|
340
|
+
assetId?: string;
|
|
341
|
+
playbackId?: string;
|
|
342
|
+
filename?: string;
|
|
343
|
+
thumbTime?: number;
|
|
344
|
+
data?: PartialDeep<MuxAsset>;
|
|
344
345
|
}
|
|
345
346
|
|
|
346
|
-
export {}
|
|
347
|
+
export {};
|
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
19
19
|
mod
|
|
20
20
|
));
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
22
|
-
var sanity = require("sanity"), jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), ui = require("@sanity/ui"), React = require("react"), compact = require("lodash/compact.js"), toLower = require("lodash/toLower.js"), trim = require("lodash/trim.js"), uniq = require("lodash/uniq.js"), words = require("lodash/words.js"), suspendReact = require("suspend-react"), rxjs = require("rxjs"), styledComponents = require("styled-components"), uuid = require("@sanity/uuid"), operators = require("rxjs/operators"), LanguagesList = require("iso-639-1"), MuxPlayer = require("@mux/mux-player-react/lazy"), router = require("sanity/router"), isNumber = require("lodash/isNumber.js"), isString = require("lodash/isString.js"), reactRx = require("react-rx"), useSWR = require("swr"), scrollIntoView = require("scroll-into-view-if-needed"), upchunk = require("@mux/upchunk"), reactIs = require("react-is");
|
|
22
|
+
var sanity = require("sanity"), jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), ui = require("@sanity/ui"), React = require("react"), compact = require("lodash/compact.js"), toLower = require("lodash/toLower.js"), trim = require("lodash/trim.js"), uniq = require("lodash/uniq.js"), words = require("lodash/words.js"), suspendReact = require("suspend-react"), rxjs = require("rxjs"), styledComponents = require("styled-components"), uuid = require("@sanity/uuid"), operators = require("rxjs/operators"), LanguagesList = require("iso-639-1"), MuxPlayer = require("@mux/mux-player-react/lazy"), useDevicePixelRatio = require("use-device-pixel-ratio"), router = require("sanity/router"), isNumber = require("lodash/isNumber.js"), isString = require("lodash/isString.js"), reactRx = require("react-rx"), useSWR = require("swr"), scrollIntoView = require("scroll-into-view-if-needed"), upchunk = require("@mux/upchunk"), reactIs = require("react-is");
|
|
23
23
|
function _interopDefaultCompat(e) {
|
|
24
24
|
return e && typeof e == "object" && "default" in e ? e : { default: e };
|
|
25
25
|
}
|
|
@@ -147,7 +147,7 @@ function useAssets() {
|
|
|
147
147
|
function useDialogState() {
|
|
148
148
|
return React.useState(!1);
|
|
149
149
|
}
|
|
150
|
-
const PLUGIN_VERSION_QUERY = { sanityVersion: "3.0.
|
|
150
|
+
const PLUGIN_VERSION_QUERY = { sanityVersion: "3.0.1" };
|
|
151
151
|
function saveSecrets(client, token, secretKey, enableSignedUrls, signingKeyId, signingKeyPrivate, drmConfigId) {
|
|
152
152
|
const doc = {
|
|
153
153
|
_id: "secrets.mux",
|
|
@@ -391,7 +391,7 @@ const Logo = styledComponents.styled.span`
|
|
|
391
391
|
/* @__PURE__ */ jsxRuntime.jsx(Logo, { children: /* @__PURE__ */ jsxRuntime.jsx(MuxLogo, { height: 13 }) }),
|
|
392
392
|
"API Credentials"
|
|
393
393
|
] });
|
|
394
|
-
function FormField(props) {
|
|
394
|
+
function FormField$1(props) {
|
|
395
395
|
const { children, title, description, inputId } = props;
|
|
396
396
|
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 1, children: [
|
|
397
397
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { align: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { flex: 1, paddingY: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 2, children: [
|
|
@@ -401,7 +401,7 @@ function FormField(props) {
|
|
|
401
401
|
/* @__PURE__ */ jsxRuntime.jsx("div", { children })
|
|
402
402
|
] });
|
|
403
403
|
}
|
|
404
|
-
var FormField
|
|
404
|
+
var FormField = React.memo(FormField$1);
|
|
405
405
|
const fieldNames = ["token", "secretKey", "enableSignedUrls", "drmConfigId"];
|
|
406
406
|
function ConfigureApiDialog({ secrets, setDialogState }) {
|
|
407
407
|
const client = useClient(), [state, dispatch] = useSecretsFormState(secrets), hasSecretsInitially = React.useMemo(() => secrets.token && secrets.secretKey, [secrets]), handleClose = React.useCallback(() => setDialogState(!1), [setDialogState]), dirty = React.useMemo(
|
|
@@ -498,7 +498,7 @@ function ConfigureApiDialog({ secrets, setDialogState }) {
|
|
|
498
498
|
"The credentials will be stored safely in a hidden document only available to editors."
|
|
499
499
|
] })
|
|
500
500
|
] }) }),
|
|
501
|
-
/* @__PURE__ */ jsxRuntime.jsx(FormField
|
|
501
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormField, { title: "Access Token", inputId: tokenId, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
502
502
|
ui.TextInput,
|
|
503
503
|
{
|
|
504
504
|
id: tokenId,
|
|
@@ -509,7 +509,7 @@ function ConfigureApiDialog({ secrets, setDialogState }) {
|
|
|
509
509
|
required: !!state.secretKey || state.enableSignedUrls
|
|
510
510
|
}
|
|
511
511
|
) }),
|
|
512
|
-
/* @__PURE__ */ jsxRuntime.jsx(FormField
|
|
512
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormField, { title: "Secret Key", inputId: secretKeyId, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
513
513
|
ui.TextInput,
|
|
514
514
|
{
|
|
515
515
|
id: secretKeyId,
|
|
@@ -542,7 +542,7 @@ function ConfigureApiDialog({ secrets, setDialogState }) {
|
|
|
542
542
|
] })
|
|
543
543
|
] }) }) : null
|
|
544
544
|
] }),
|
|
545
|
-
/* @__PURE__ */ jsxRuntime.jsx(FormField
|
|
545
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormField, { title: "DRM Configuration ID", inputId: drmConfigIdId, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
546
546
|
ui.TextInput,
|
|
547
547
|
{
|
|
548
548
|
id: drmConfigIdId,
|
|
@@ -2974,14 +2974,6 @@ function CaptionsDialog({ asset }) {
|
|
|
2974
2974
|
const { setDialogState } = useDialogStateContext(), dialogId = `CaptionsDialog${React.useId()}`;
|
|
2975
2975
|
return /* @__PURE__ */ jsxRuntime.jsx(ui.Dialog, { id: dialogId, header: "Edit Captions", onClose: () => setDialogState(!1), width: 1, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(TextTracksManager, { asset }) }) });
|
|
2976
2976
|
}
|
|
2977
|
-
function getDevicePixelRatio(options) {
|
|
2978
|
-
const {
|
|
2979
|
-
defaultDpr = 1,
|
|
2980
|
-
maxDpr = 3,
|
|
2981
|
-
round = !0
|
|
2982
|
-
} = options || {}, dpr = typeof window < "u" && typeof window.devicePixelRatio == "number" ? window.devicePixelRatio : defaultDpr;
|
|
2983
|
-
return Math.min(Math.max(1, round ? Math.floor(dpr) : dpr), maxDpr);
|
|
2984
|
-
}
|
|
2985
2977
|
function formatSeconds(seconds) {
|
|
2986
2978
|
if (typeof seconds != "number" || Number.isNaN(seconds))
|
|
2987
2979
|
return "";
|
|
@@ -3005,7 +2997,7 @@ function EditThumbnailDialog({ asset, currentTime = 0 }) {
|
|
|
3005
2997
|
() => formatSecondsToHHMMSS(currentTime)
|
|
3006
2998
|
), [nextTime, setNextTime] = React.useState(currentTime), [inputError, setInputError] = React.useState(""), assetWithNewThumbnail = React.useMemo(() => ({ ...asset, thumbTime: nextTime }), [asset, nextTime]), [saving, setSaving] = React.useState(!1), [saveThumbnailError, setSaveThumbnailError] = React.useState(null), handleSave = () => {
|
|
3007
2999
|
setSaving(!0), client.patch(asset._id).set({ thumbTime: nextTime }).commit({ returnDocuments: !1 }).then(() => void setDialogState(!1)).catch(setSaveThumbnailError).finally(() => void setSaving(!1));
|
|
3008
|
-
}, width = 300 * getDevicePixelRatio({ maxDpr: 2 });
|
|
3000
|
+
}, width = 300 * useDevicePixelRatio.getDevicePixelRatio({ maxDpr: 2 });
|
|
3009
3001
|
if (saveThumbnailError)
|
|
3010
3002
|
throw saveThumbnailError;
|
|
3011
3003
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3173,7 +3165,7 @@ function VideoPlayer({
|
|
|
3173
3165
|
crossOrigin: "anonymous",
|
|
3174
3166
|
metadata: {
|
|
3175
3167
|
player_name: "Sanity Admin Dashboard",
|
|
3176
|
-
player_version: "3.0.
|
|
3168
|
+
player_version: "3.0.1",
|
|
3177
3169
|
page_type: "Preview Player"
|
|
3178
3170
|
},
|
|
3179
3171
|
audio: isAudio,
|
|
@@ -3541,7 +3533,7 @@ function useVideoDetails(props) {
|
|
|
3541
3533
|
isResyncing
|
|
3542
3534
|
};
|
|
3543
3535
|
}
|
|
3544
|
-
const AssetInput = (props) => /* @__PURE__ */ jsxRuntime.jsx(FormField
|
|
3536
|
+
const AssetInput = (props) => /* @__PURE__ */ jsxRuntime.jsx(FormField, { title: props.label, description: props.description, inputId: props.label, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3545
3537
|
ui.TextInput,
|
|
3546
3538
|
{
|
|
3547
3539
|
id: props.label,
|
|
@@ -4233,7 +4225,7 @@ function a(t) {
|
|
|
4233
4225
|
}, []);
|
|
4234
4226
|
return { ErrorBoundary: (p = h.current, p !== null ? p : (h.current = l(), h.current)), didCatch: i.didCatch, error: i.error, reset: s };
|
|
4235
4227
|
}
|
|
4236
|
-
function ErrorBoundaryCard(props) {
|
|
4228
|
+
function ErrorBoundaryCard$1(props) {
|
|
4237
4229
|
const { children, schemaType } = props, { push: pushToast } = ui.useToast(), errorRef = React.useRef(null), { ErrorBoundary, didCatch, error, reset } = a({
|
|
4238
4230
|
onDidCatch: (err, errorInfo) => {
|
|
4239
4231
|
console.group(err.toString()), console.groupCollapsed("console.error"), console.error(err), console.groupEnd(), err.stack && (console.groupCollapsed("error.stack"), console.log(err.stack), console.groupEnd()), errorInfo?.componentStack && (console.groupCollapsed("errorInfo.componentStack"), console.log(errorInfo.componentStack), console.groupEnd()), console.groupEnd(), pushToast({
|
|
@@ -4274,7 +4266,7 @@ function ErrorBoundaryCard(props) {
|
|
|
4274
4266
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Inline, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { onClick: handleRetry, text: "Retry" }) })
|
|
4275
4267
|
] }) }) }) : /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children });
|
|
4276
4268
|
}
|
|
4277
|
-
var ErrorBoundaryCard
|
|
4269
|
+
var ErrorBoundaryCard = React.memo(ErrorBoundaryCard$1);
|
|
4278
4270
|
const InputFallback = () => /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4279
4271
|
ui.Card,
|
|
4280
4272
|
{
|
|
@@ -4870,7 +4862,7 @@ const FileButton = styledComponents.styled(ui.MenuItem)(({ theme }) => {
|
|
|
4870
4862
|
background: transparent;
|
|
4871
4863
|
color: white;
|
|
4872
4864
|
`, isVideoAsset = (asset) => asset._type === "mux.videoAsset";
|
|
4873
|
-
function PlayerActionsMenu(props) {
|
|
4865
|
+
function PlayerActionsMenu$1(props) {
|
|
4874
4866
|
const { asset, readOnly, dialogState, setDialogState, onChange, onSelect, accept } = props, [open, setOpen] = React.useState(!1), [menuElement, setMenuRef] = React.useState(null), isSigned = React.useMemo(() => getPlaybackPolicy(asset)?.policy === "signed", [asset]), { hasConfigAccess } = useAccessControl(props.config), { resyncAsset, isResyncing } = useResyncAsset({ showToast: !0 }), onReset = React.useCallback(() => onChange(sanity.PatchEvent.from(sanity.unset([]))), [onChange]), handleResync = React.useCallback(async () => {
|
|
4875
4867
|
setOpen(!1), await resyncAsset(asset);
|
|
4876
4868
|
}, [resyncAsset, asset]);
|
|
@@ -4982,7 +4974,7 @@ function PlayerActionsMenu(props) {
|
|
|
4982
4974
|
)
|
|
4983
4975
|
] });
|
|
4984
4976
|
}
|
|
4985
|
-
var PlayerActionsMenu
|
|
4977
|
+
var PlayerActionsMenu = React.memo(PlayerActionsMenu$1);
|
|
4986
4978
|
function useFetchFileSize(stagedUpload, maxFileSize) {
|
|
4987
4979
|
const [fileSize, setFileSize] = React.useState(null), [isLoadingFileSize, setIsLoadingFileSize] = React.useState(!1), [canSkipFileSizeValidation, setCanSkipFileSizeValidation] = React.useState(!1);
|
|
4988
4980
|
return React.useEffect(() => {
|
|
@@ -6953,7 +6945,7 @@ function Uploader(props) {
|
|
|
6953
6945
|
onChange: props.onChange,
|
|
6954
6946
|
config: props.config,
|
|
6955
6947
|
buttons: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6956
|
-
PlayerActionsMenu
|
|
6948
|
+
PlayerActionsMenu,
|
|
6957
6949
|
{
|
|
6958
6950
|
accept: acceptMimeString,
|
|
6959
6951
|
asset: props.asset,
|
|
@@ -6993,12 +6985,12 @@ function Uploader(props) {
|
|
|
6993
6985
|
)
|
|
6994
6986
|
] });
|
|
6995
6987
|
}
|
|
6996
|
-
const Input = (props) => {
|
|
6988
|
+
const Input$1 = (props) => {
|
|
6997
6989
|
const client = useClient(), secretDocumentValues = useSecretsDocumentValues(), assetDocumentValues = useAssetDocumentValues(props.value?.asset), poll = useMuxPolling(props.readOnly ? void 0 : assetDocumentValues?.value || void 0), [dialogState, setDialogState] = useDialogState(), { hasConfigAccess } = useAccessControl(props.config), error = secretDocumentValues.error || assetDocumentValues.error || poll.error;
|
|
6998
6990
|
if (error)
|
|
6999
6991
|
throw error;
|
|
7000
6992
|
const isLoading = secretDocumentValues.isLoading || assetDocumentValues.isLoading;
|
|
7001
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundaryCard
|
|
6993
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundaryCard, { schemaType: props.schemaType, children: /* @__PURE__ */ jsxRuntime.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(InputFallback, {}), children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(InputFallback, {}) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7002
6994
|
secretDocumentValues.value.needsSetup && !assetDocumentValues.value ? /* @__PURE__ */ jsxRuntime.jsx(Onboard, { setDialogState, config: props.config }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
7003
6995
|
Uploader,
|
|
7004
6996
|
{
|
|
@@ -7022,11 +7014,11 @@ const Input = (props) => {
|
|
|
7022
7014
|
)
|
|
7023
7015
|
] }) }) }) });
|
|
7024
7016
|
};
|
|
7025
|
-
var Input
|
|
7017
|
+
var Input = React.memo(Input$1);
|
|
7026
7018
|
function muxVideoCustomRendering(config) {
|
|
7027
7019
|
return {
|
|
7028
7020
|
components: {
|
|
7029
|
-
input: (props) => /* @__PURE__ */ jsxRuntime.jsx(Input
|
|
7021
|
+
input: (props) => /* @__PURE__ */ jsxRuntime.jsx(Input, { config: { ...config, ...props.schemaType.options }, ...props })
|
|
7030
7022
|
},
|
|
7031
7023
|
preview: {
|
|
7032
7024
|
select: {
|