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