sanity-plugin-mux-input 2.3.2 → 2.3.3
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/lib/index.cjs +24 -150
- package/lib/index.cjs.map +1 -1
- package/lib/index.esm.js +24 -150
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +24 -150
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/VideoPlayer.tsx +1 -2
package/lib/index.js
CHANGED
|
@@ -191,7 +191,7 @@ function useMuxAssets({ secrets, enabled }) {
|
|
|
191
191
|
return () => subscription.unsubscribe();
|
|
192
192
|
}, [enabled]), state;
|
|
193
193
|
}
|
|
194
|
-
const name
|
|
194
|
+
const name = "mux-input", cacheNs = "sanity-plugin-mux-input", muxSecretsDocumentId = "secrets.mux", DIALOGS_Z_INDEX = 6e4, THUMBNAIL_ASPECT_RATIO = 1.7777777777777777, MIN_ASPECT_RATIO = 5 / 4, path$1 = ["token", "secretKey", "enableSignedUrls", "signingKeyId", "signingKeyPrivate"], useSecretsDocumentValues = () => {
|
|
195
195
|
const { error, isLoading, value } = useDocumentValues(
|
|
196
196
|
muxSecretsDocumentId,
|
|
197
197
|
path$1
|
|
@@ -683,17 +683,17 @@ function SelectSortOptions(props) {
|
|
|
683
683
|
{
|
|
684
684
|
button: /* @__PURE__ */ jsx(Button, { text: "Sort", icon: SortIcon, mode: "bleed", padding: 3, style: { cursor: "pointer" } }),
|
|
685
685
|
id,
|
|
686
|
-
menu: /* @__PURE__ */ jsx(Menu, { children: Object.entries(ASSET_SORT_OPTIONS).map(([
|
|
686
|
+
menu: /* @__PURE__ */ jsx(Menu, { children: Object.entries(ASSET_SORT_OPTIONS).map(([type, { label }]) => /* @__PURE__ */ jsx(
|
|
687
687
|
MenuItem,
|
|
688
688
|
{
|
|
689
689
|
"data-as": "button",
|
|
690
|
-
onClick: () => props.setSort(
|
|
690
|
+
onClick: () => props.setSort(type),
|
|
691
691
|
padding: 3,
|
|
692
692
|
tone: "default",
|
|
693
693
|
text: label,
|
|
694
|
-
pressed:
|
|
694
|
+
pressed: type === props.sort
|
|
695
695
|
},
|
|
696
|
-
|
|
696
|
+
type
|
|
697
697
|
)) }),
|
|
698
698
|
popover: CONTEXT_MENU_POPOVER_PROPS
|
|
699
699
|
}
|
|
@@ -712,11 +712,11 @@ const SpinnerBox = () => /* @__PURE__ */ jsx(
|
|
|
712
712
|
}
|
|
713
713
|
);
|
|
714
714
|
function FormField(props) {
|
|
715
|
-
const { children, title, description
|
|
715
|
+
const { children, title, description, inputId } = props;
|
|
716
716
|
return /* @__PURE__ */ jsxs(Stack, { space: 1, children: [
|
|
717
717
|
/* @__PURE__ */ jsx(Flex, { align: "flex-end", children: /* @__PURE__ */ jsx(Box, { flex: 1, paddingY: 2, children: /* @__PURE__ */ jsxs(Stack, { space: 2, children: [
|
|
718
718
|
/* @__PURE__ */ jsx(Text, { as: "label", htmlFor: inputId, weight: "semibold", size: 1, children: title || /* @__PURE__ */ jsx("em", { children: "Untitled" }) }),
|
|
719
|
-
|
|
719
|
+
description && /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: description })
|
|
720
720
|
] }) }) }),
|
|
721
721
|
/* @__PURE__ */ jsx("div", { children })
|
|
722
722
|
] });
|
|
@@ -769,132 +769,6 @@ function getVideoSrc({ asset, client }) {
|
|
|
769
769
|
}
|
|
770
770
|
return `https://stream.mux.com/${playbackId}.m3u8?${searchParams}`;
|
|
771
771
|
}
|
|
772
|
-
var name = "sanity-plugin-mux-input", version = "2.3.2", description = "An input component that integrates Sanity Studio with Mux video encoding/hosting service.", keywords = [
|
|
773
|
-
"sanity",
|
|
774
|
-
"video",
|
|
775
|
-
"mux",
|
|
776
|
-
"input",
|
|
777
|
-
"plugin",
|
|
778
|
-
"sanity-plugin",
|
|
779
|
-
"media"
|
|
780
|
-
], homepage = "https://github.com/sanity-io/sanity-plugin-mux-input#readme", bugs = {
|
|
781
|
-
url: "https://github.com/sanity-io/sanity-plugin-mux-input/issues"
|
|
782
|
-
}, repository = {
|
|
783
|
-
type: "git",
|
|
784
|
-
url: "git@github.com:sanity-io/sanity-plugin-mux-input.git"
|
|
785
|
-
}, license = "MIT", author = "Sanity.io <hello@sanity.io>", sideEffects = !1, type = "module", exports = {
|
|
786
|
-
".": {
|
|
787
|
-
source: "./src/_exports/index.ts",
|
|
788
|
-
import: "./lib/index.js",
|
|
789
|
-
require: "./lib/index.cjs",
|
|
790
|
-
default: "./lib/index.js"
|
|
791
|
-
},
|
|
792
|
-
"./package.json": "./package.json"
|
|
793
|
-
}, main = "./lib/index.cjs", module = "./lib/index.esm.js", source = "./src/_exports/index.ts", types = "./lib/index.d.ts", files = [
|
|
794
|
-
"src",
|
|
795
|
-
"lib",
|
|
796
|
-
"sanity.json",
|
|
797
|
-
"v2-incompatible.js"
|
|
798
|
-
], scripts = {
|
|
799
|
-
build: "run-s clean && pkg-utils build --strict && pkg-utils --strict",
|
|
800
|
-
clean: "rimraf lib",
|
|
801
|
-
dev: "plugin-kit link-watch",
|
|
802
|
-
format: "prettier --write --cache --ignore-unknown .",
|
|
803
|
-
"link-watch": "plugin-kit link-watch",
|
|
804
|
-
lint: "eslint .",
|
|
805
|
-
prepare: "husky install || true",
|
|
806
|
-
prepublishOnly: "run-s build",
|
|
807
|
-
test: "npm run lint && npm run type-check && npm run build",
|
|
808
|
-
"type-check": "tsc --noEmit",
|
|
809
|
-
watch: "pkg-utils watch --strict"
|
|
810
|
-
}, dependencies = {
|
|
811
|
-
"@mux/mux-player-react": "^2.4.1",
|
|
812
|
-
"@mux/upchunk": "^3.3.2",
|
|
813
|
-
"@sanity/icons": "^2.11.7",
|
|
814
|
-
"@sanity/incompatible-plugin": "^1.0.4",
|
|
815
|
-
"@sanity/ui": "^2.1.0",
|
|
816
|
-
"@sanity/uuid": "^3.0.2",
|
|
817
|
-
"iso-639-1": "^3.1.2",
|
|
818
|
-
"jsonwebtoken-esm": "^1.0.5",
|
|
819
|
-
lodash: "^4.17.21",
|
|
820
|
-
"react-rx": "^2.1.3",
|
|
821
|
-
rxjs: "^7.8.1",
|
|
822
|
-
"scroll-into-view-if-needed": "^3.1.0",
|
|
823
|
-
"suspend-react": "^0.1.3",
|
|
824
|
-
swr: "^2.2.5",
|
|
825
|
-
"type-fest": "^4.10.2",
|
|
826
|
-
"use-error-boundary": "^2.0.6"
|
|
827
|
-
}, devDependencies = {
|
|
828
|
-
"@commitlint/cli": "^19.2.1",
|
|
829
|
-
"@commitlint/config-conventional": "^19.1.0",
|
|
830
|
-
"@sanity/client": "^6.15.11",
|
|
831
|
-
"@sanity/pkg-utils": "^6.0.1",
|
|
832
|
-
"@sanity/plugin-kit": "^3.1.10",
|
|
833
|
-
"@sanity/semantic-release-preset": "^4.1.7",
|
|
834
|
-
"@sanity/vision": "^3.36.4",
|
|
835
|
-
"@types/lodash": "^4.17.0",
|
|
836
|
-
"@types/react": "^18.2.74",
|
|
837
|
-
"@types/react-is": "^18.2.4",
|
|
838
|
-
"@typescript-eslint/eslint-plugin": "^7.6.0",
|
|
839
|
-
"@typescript-eslint/parser": "^7.6.0",
|
|
840
|
-
"cz-conventional-changelog": "^3.3.0",
|
|
841
|
-
eslint: "^8.57.0",
|
|
842
|
-
"eslint-config-prettier": "^9.1.0",
|
|
843
|
-
"eslint-config-sanity": "^7.1.2",
|
|
844
|
-
"eslint-plugin-import": "^2.29.1",
|
|
845
|
-
"eslint-plugin-prettier": "^5.1.3",
|
|
846
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
847
|
-
"eslint-plugin-simple-import-sort": "^12.0.0",
|
|
848
|
-
husky: "^9.0.11",
|
|
849
|
-
"lint-staged": "^15.2.2",
|
|
850
|
-
"npm-run-all2": "^5.0.0",
|
|
851
|
-
prettier: "^3.2.5",
|
|
852
|
-
"prettier-plugin-packagejson": "^2.4.14",
|
|
853
|
-
react: "^18.2.0",
|
|
854
|
-
"react-dom": "^18.2.0",
|
|
855
|
-
"react-is": "^18.2.0",
|
|
856
|
-
rimraf: "^5.0.5",
|
|
857
|
-
sanity: "^3.36.4",
|
|
858
|
-
"semantic-release": "^23.0.7",
|
|
859
|
-
"styled-components": "^6.1.8",
|
|
860
|
-
typescript: "5.4.2",
|
|
861
|
-
yalc: "1.0.0-pre.53"
|
|
862
|
-
}, peerDependencies = {
|
|
863
|
-
react: "^18",
|
|
864
|
-
"react-is": "^18",
|
|
865
|
-
sanity: "^3",
|
|
866
|
-
"styled-components": "^6"
|
|
867
|
-
}, engines = {
|
|
868
|
-
node: ">=14"
|
|
869
|
-
}, publishConfig = {
|
|
870
|
-
access: "public",
|
|
871
|
-
provenance: !0
|
|
872
|
-
}, sanityExchangeUrl = "https://www.sanity.io/plugins/sanity-plugin-mux-input", pluginPkg = {
|
|
873
|
-
name,
|
|
874
|
-
version,
|
|
875
|
-
description,
|
|
876
|
-
keywords,
|
|
877
|
-
homepage,
|
|
878
|
-
bugs,
|
|
879
|
-
repository,
|
|
880
|
-
license,
|
|
881
|
-
author,
|
|
882
|
-
sideEffects,
|
|
883
|
-
type,
|
|
884
|
-
exports,
|
|
885
|
-
main,
|
|
886
|
-
module,
|
|
887
|
-
source,
|
|
888
|
-
types,
|
|
889
|
-
files,
|
|
890
|
-
scripts,
|
|
891
|
-
dependencies,
|
|
892
|
-
devDependencies,
|
|
893
|
-
peerDependencies,
|
|
894
|
-
engines,
|
|
895
|
-
publishConfig,
|
|
896
|
-
sanityExchangeUrl
|
|
897
|
-
};
|
|
898
772
|
function VideoPlayer({
|
|
899
773
|
asset,
|
|
900
774
|
children,
|
|
@@ -928,7 +802,7 @@ function VideoPlayer({
|
|
|
928
802
|
crossOrigin: "anonymous",
|
|
929
803
|
metadata: {
|
|
930
804
|
player_name: "Sanity Admin Dashboard",
|
|
931
|
-
player_version:
|
|
805
|
+
player_version: "2.3.3",
|
|
932
806
|
page_type: "Preview Player"
|
|
933
807
|
},
|
|
934
808
|
style: {
|
|
@@ -2821,12 +2695,12 @@ function ErrorBoundaryCard(props) {
|
|
|
2821
2695
|
});
|
|
2822
2696
|
}
|
|
2823
2697
|
}), handleRetry = useCallback(() => {
|
|
2824
|
-
clear([name
|
|
2698
|
+
clear([name]), reset();
|
|
2825
2699
|
}, [reset]);
|
|
2826
2700
|
return didCatch ? /* @__PURE__ */ jsx(Card, { ref: errorRef, paddingX: [2, 3, 4, 4], height: "fill", shadow: 1, overflow: "auto", children: /* @__PURE__ */ jsx(Flex, { justify: "flex-start", align: "center", height: "fill", children: /* @__PURE__ */ jsxs(Grid, { columns: 1, gap: [2, 3, 4, 4], children: [
|
|
2827
2701
|
/* @__PURE__ */ jsxs(Heading, { as: "h1", children: [
|
|
2828
2702
|
"The ",
|
|
2829
|
-
/* @__PURE__ */ jsx("code", { children: name
|
|
2703
|
+
/* @__PURE__ */ jsx("code", { children: name }),
|
|
2830
2704
|
" plugin crashed"
|
|
2831
2705
|
] }),
|
|
2832
2706
|
(error == null ? void 0 : error.message) && /* @__PURE__ */ jsx(Card, { padding: 3, tone: "critical", shadow: 1, radius: 2, children: /* @__PURE__ */ jsx(Text, { children: error.message }) }),
|
|
@@ -2869,11 +2743,11 @@ function Onboard(props) {
|
|
|
2869
2743
|
}
|
|
2870
2744
|
) }) });
|
|
2871
2745
|
}
|
|
2872
|
-
function createUpChunkObservable(uuid2, uploadUrl2,
|
|
2746
|
+
function createUpChunkObservable(uuid2, uploadUrl2, source) {
|
|
2873
2747
|
return new Observable((subscriber) => {
|
|
2874
2748
|
const upchunk = UpChunk.createUpload({
|
|
2875
2749
|
endpoint: uploadUrl2,
|
|
2876
|
-
file:
|
|
2750
|
+
file: source,
|
|
2877
2751
|
dynamicChunkSize: !0
|
|
2878
2752
|
// changes the chunk size based on network speeds
|
|
2879
2753
|
}), successHandler = () => {
|
|
@@ -3067,8 +2941,8 @@ function isValidUrl(url) {
|
|
|
3067
2941
|
}
|
|
3068
2942
|
}
|
|
3069
2943
|
function extractDroppedFiles(dataTransfer) {
|
|
3070
|
-
const
|
|
3071
|
-
return
|
|
2944
|
+
const files = Array.from(dataTransfer.files || []), items = Array.from(dataTransfer.items || []);
|
|
2945
|
+
return files && files.length > 0 ? Promise.resolve(files) : normalizeItems(items).then((arr) => arr.flat());
|
|
3072
2946
|
}
|
|
3073
2947
|
function normalizeItems(items) {
|
|
3074
2948
|
return Promise.all(
|
|
@@ -3496,7 +3370,7 @@ function TrackEditor({
|
|
|
3496
3370
|
track,
|
|
3497
3371
|
dispatch
|
|
3498
3372
|
}) {
|
|
3499
|
-
const { _id: id, type
|
|
3373
|
+
const { _id: id, type } = track, dispatchTrackAction = (args) => dispatch({ action: "track", id, ...args }), trackTypes = TRACK_TYPES.filter(
|
|
3500
3374
|
({ value }) => !(value === "autogenerated" && !canAutoGenerate)
|
|
3501
3375
|
);
|
|
3502
3376
|
return trackTypes.length === 0 ? null : /* @__PURE__ */ jsx(Card, { border: !0, padding: 3, radius: 2, style: { position: "relative" }, children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
|
|
@@ -3506,7 +3380,7 @@ function TrackEditor({
|
|
|
3506
3380
|
/* @__PURE__ */ jsx(
|
|
3507
3381
|
Radio,
|
|
3508
3382
|
{
|
|
3509
|
-
checked:
|
|
3383
|
+
checked: type === value,
|
|
3510
3384
|
name: "track-type",
|
|
3511
3385
|
onChange: (e) => dispatchTrackAction({
|
|
3512
3386
|
subAction: "update",
|
|
@@ -3631,7 +3505,7 @@ function UploadConfiguration({
|
|
|
3631
3505
|
encoding_tier: action.value,
|
|
3632
3506
|
mp4_support: "none",
|
|
3633
3507
|
max_resolution_tier: "1080p",
|
|
3634
|
-
text_tracks: (_a2 = prev.text_tracks) == null ? void 0 : _a2.filter(({ type
|
|
3508
|
+
text_tracks: (_a2 = prev.text_tracks) == null ? void 0 : _a2.filter(({ type }) => type !== "autogenerated")
|
|
3635
3509
|
}) : Object.assign({}, prev, {
|
|
3636
3510
|
encoding_tier: action.value,
|
|
3637
3511
|
mp4_support: pluginConfig.mp4_support,
|
|
@@ -4072,7 +3946,7 @@ function Uploader(props) {
|
|
|
4072
3946
|
case "commitUpload":
|
|
4073
3947
|
return Object.assign({}, prev, { uploadStatus: { progress: 0 } });
|
|
4074
3948
|
case "progressInfo": {
|
|
4075
|
-
const { type
|
|
3949
|
+
const { type, action: _, ...payload } = action;
|
|
4076
3950
|
return Object.assign({}, prev, {
|
|
4077
3951
|
uploadStatus: {
|
|
4078
3952
|
...prev.uploadStatus,
|
|
@@ -4161,10 +4035,10 @@ function Uploader(props) {
|
|
|
4161
4035
|
complete: () => dispatch({ action: "complete" }),
|
|
4162
4036
|
error: (error) => dispatch({ action: "error", error })
|
|
4163
4037
|
});
|
|
4164
|
-
}, handleUpload = (
|
|
4038
|
+
}, handleUpload = (files) => {
|
|
4165
4039
|
dispatch({
|
|
4166
4040
|
action: "stageUpload",
|
|
4167
|
-
input: { type: "file", files
|
|
4041
|
+
input: { type: "file", files }
|
|
4168
4042
|
});
|
|
4169
4043
|
}, handlePaste = (event) => {
|
|
4170
4044
|
event.preventDefault(), event.stopPropagation();
|
|
@@ -4175,10 +4049,10 @@ function Uploader(props) {
|
|
|
4175
4049
|
}
|
|
4176
4050
|
dispatch({ action: "stageUpload", input: { type: "url", url } });
|
|
4177
4051
|
}, handleDrop = (event) => {
|
|
4178
|
-
setDragState(null), event.preventDefault(), event.stopPropagation(), extractDroppedFiles(event.nativeEvent.dataTransfer).then((
|
|
4052
|
+
setDragState(null), event.preventDefault(), event.stopPropagation(), extractDroppedFiles(event.nativeEvent.dataTransfer).then((files) => {
|
|
4179
4053
|
dispatch({
|
|
4180
4054
|
action: "stageUpload",
|
|
4181
|
-
input: { type: "file", files
|
|
4055
|
+
input: { type: "file", files }
|
|
4182
4056
|
});
|
|
4183
4057
|
});
|
|
4184
4058
|
}, handleDragOver = (event) => {
|
|
@@ -4186,8 +4060,8 @@ function Uploader(props) {
|
|
|
4186
4060
|
}, handleDragEnter = (event) => {
|
|
4187
4061
|
var _a2, _b;
|
|
4188
4062
|
event.stopPropagation(), dragEnteredEls.current.push(event.target);
|
|
4189
|
-
const
|
|
4190
|
-
setDragState(
|
|
4063
|
+
const type = (_b = (_a2 = event.dataTransfer.items) == null ? void 0 : _a2[0]) == null ? void 0 : _b.type;
|
|
4064
|
+
setDragState(type != null && type.startsWith("video/") ? "valid" : "invalid");
|
|
4191
4065
|
}, handleDragLeave = (event) => {
|
|
4192
4066
|
event.stopPropagation();
|
|
4193
4067
|
const idx = dragEnteredEls.current.indexOf(event.target);
|