sanity-plugin-mux-input 2.0.3 → 2.0.4
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/_chunks/{Input-aa6d929b.js → Input-4e0aa2ef.js} +64 -48
- package/lib/_chunks/Input-4e0aa2ef.js.map +1 -0
- package/lib/_chunks/{Input-4ec3c050.js → Input-7fb0dcd2.js} +64 -48
- package/lib/_chunks/Input-7fb0dcd2.js.map +1 -0
- package/lib/_chunks/{Preview-43ce9c72.js → Preview-3e4c2ec9.js} +2 -2
- package/lib/_chunks/{Preview-43ce9c72.js.map → Preview-3e4c2ec9.js.map} +1 -1
- package/lib/_chunks/{Preview-1664b7d5.js → Preview-e6f7e765.js} +2 -2
- package/lib/_chunks/{Preview-1664b7d5.js.map → Preview-e6f7e765.js.map} +1 -1
- package/lib/_chunks/{VideoSource.styled-99ffa712.js → VideoSource.styled-70d38762.js} +3 -3
- package/lib/_chunks/VideoSource.styled-70d38762.js.map +1 -0
- package/lib/_chunks/{VideoSource.styled-24577ec8.js → VideoSource.styled-e880b6e4.js} +3 -3
- package/lib/_chunks/VideoSource.styled-e880b6e4.js.map +1 -0
- package/lib/_chunks/{index-c54f5393.js → index-a9d40189.js} +14 -13
- package/lib/_chunks/{index-c54f5393.js.map → index-a9d40189.js.map} +1 -1
- package/lib/_chunks/{index-9933dea2.js → index-adfcd166.js} +14 -13
- package/lib/_chunks/{index-9933dea2.js.map → index-adfcd166.js.map} +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +6 -6
- package/src/actions/assets.ts +1 -1
- package/src/actions/secrets.ts +12 -3
- package/src/actions/upload.ts +1 -1
- package/src/components/__legacy__Uploader.tsx +1 -1
- package/src/hooks/useSaveSecrets.ts +1 -1
- package/src/util/generateJwt.ts +1 -1
- package/src/util/getAnimatedPosterSrc.ts +1 -1
- package/src/util/getPosterSrc.ts +1 -1
- package/src/util/getStoryboardSrc.ts +1 -1
- package/src/util/getVideoSrc.ts +1 -1
- package/src/util/readSecrets.ts +1 -1
- package/lib/_chunks/Input-4ec3c050.js.map +0 -1
- package/lib/_chunks/Input-aa6d929b.js.map +0 -1
- package/lib/_chunks/VideoSource.styled-24577ec8.js.map +0 -1
- package/lib/_chunks/VideoSource.styled-99ffa712.js.map +0 -1
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const _excluded = ["icon", "id", "accept", "capture", "fontSize", "multiple", "onSelect", "padding", "space", "textAlign", "text", "disabled"],
|
|
4
|
-
_excluded2 = ["onSelect"];
|
|
5
3
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19;
|
|
6
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
7
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
8
4
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
9
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
13
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
14
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
15
6
|
var React = require('react');
|
|
16
|
-
var VideoSource_styled = require('./VideoSource.styled-
|
|
7
|
+
var VideoSource_styled = require('./VideoSource.styled-70d38762.js');
|
|
17
8
|
var sanity = require('sanity');
|
|
18
9
|
var useSWR = require('swr');
|
|
19
|
-
var index = require('./index-
|
|
10
|
+
var index = require('./index-adfcd166.js');
|
|
20
11
|
var rxjs = require('rxjs');
|
|
21
12
|
var operators = require('rxjs/operators');
|
|
22
13
|
var uuid = require('@sanity/uuid');
|
|
@@ -124,7 +115,9 @@ function createUpChunkObservable(uuid, uploadUrl, source) {
|
|
|
124
115
|
endpoint: uploadUrl,
|
|
125
116
|
file: source,
|
|
126
117
|
dynamicChunkSize: true
|
|
118
|
+
// changes the chunk size based on network speeds
|
|
127
119
|
});
|
|
120
|
+
|
|
128
121
|
const successHandler = () => {
|
|
129
122
|
subscriber.next({
|
|
130
123
|
type: "success",
|
|
@@ -327,14 +320,23 @@ function uploadFile(config, client, file) {
|
|
|
327
320
|
},
|
|
328
321
|
body
|
|
329
322
|
})).pipe(operators.mergeMap(result => {
|
|
330
|
-
return createUpChunkObservable(uuid$1, result.upload.url, file).pipe(
|
|
323
|
+
return createUpChunkObservable(uuid$1, result.upload.url, file).pipe(
|
|
324
|
+
// eslint-disable-next-line no-warning-comments
|
|
325
|
+
// @TODO type the observable events
|
|
326
|
+
// eslint-disable-next-line max-nested-callbacks
|
|
327
|
+
operators.mergeMap(event => {
|
|
331
328
|
if (event.type !== "success") {
|
|
332
329
|
return rxjs.of(event);
|
|
333
330
|
}
|
|
334
|
-
return rxjs.from(updateAssetDocumentFromUpload(client, uuid$1)).pipe(
|
|
331
|
+
return rxjs.from(updateAssetDocumentFromUpload(client, uuid$1)).pipe(
|
|
332
|
+
// eslint-disable-next-line max-nested-callbacks
|
|
333
|
+
operators.mergeMap(doc => rxjs.of({
|
|
334
|
+
...event,
|
|
335
335
|
asset: doc
|
|
336
|
-
})))
|
|
337
|
-
}),
|
|
336
|
+
})));
|
|
337
|
+
}),
|
|
338
|
+
// eslint-disable-next-line max-nested-callbacks
|
|
339
|
+
operators.catchError(err => {
|
|
338
340
|
return cancelUpload(client, uuid$1).pipe(operators.mergeMapTo(rxjs.throwError(err)));
|
|
339
341
|
}));
|
|
340
342
|
})));
|
|
@@ -775,7 +777,8 @@ const PER_PAGE = 200;
|
|
|
775
777
|
function createQuery() {
|
|
776
778
|
let start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
777
779
|
let end = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : PER_PAGE;
|
|
778
|
-
return "*[_type == \"mux.videoAsset\"] | order(_updatedAt desc) [".concat(start, "...").concat(end, "]")
|
|
780
|
+
return (/* groq */"*[_type == \"mux.videoAsset\"] | order(_updatedAt desc) [".concat(start, "...").concat(end, "]")
|
|
781
|
+
);
|
|
779
782
|
}
|
|
780
783
|
function SelectAssets(_ref3) {
|
|
781
784
|
let {
|
|
@@ -882,7 +885,8 @@ function EditThumbnailDialog(_ref6) {
|
|
|
882
885
|
const client = VideoSource_styled.useClient();
|
|
883
886
|
const dialogId = "EditThumbnailDialog".concat(React.useId());
|
|
884
887
|
const nextTime = React.useMemo(() => getCurrentTime(), [getCurrentTime]);
|
|
885
|
-
const assetWithNewThumbnail = React.useMemo(() =>
|
|
888
|
+
const assetWithNewThumbnail = React.useMemo(() => ({
|
|
889
|
+
...asset,
|
|
886
890
|
thumbTime: nextTime
|
|
887
891
|
}), [asset, nextTime]);
|
|
888
892
|
const [saving, setSaving] = React.useState(false);
|
|
@@ -1244,20 +1248,20 @@ const FileButton = styled__default.default(ui.MenuItem)(_ref12 => {
|
|
|
1244
1248
|
});
|
|
1245
1249
|
const FileInputMenuItem = React__default.default.forwardRef(function FileInputMenuItem2(props, forwardedRef) {
|
|
1246
1250
|
const {
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1251
|
+
icon,
|
|
1252
|
+
id: idProp,
|
|
1253
|
+
accept,
|
|
1254
|
+
capture,
|
|
1255
|
+
fontSize,
|
|
1256
|
+
multiple,
|
|
1257
|
+
onSelect,
|
|
1258
|
+
padding = 3,
|
|
1259
|
+
space = 3,
|
|
1260
|
+
textAlign,
|
|
1261
|
+
text,
|
|
1262
|
+
disabled,
|
|
1263
|
+
...rest
|
|
1264
|
+
} = props;
|
|
1261
1265
|
const idHook = React.useId();
|
|
1262
1266
|
const id = idProp || idHook;
|
|
1263
1267
|
const handleChange = React__default.default.useCallback(event => {
|
|
@@ -1282,7 +1286,8 @@ const FileInputMenuItem = React__default.default.forwardRef(function FileInputMe
|
|
|
1282
1286
|
children: text
|
|
1283
1287
|
})]
|
|
1284
1288
|
});
|
|
1285
|
-
return /* @__PURE__ */jsxRuntime.jsxs(FileButton,
|
|
1289
|
+
return /* @__PURE__ */jsxRuntime.jsxs(FileButton, {
|
|
1290
|
+
...rest,
|
|
1286
1291
|
htmlFor: id,
|
|
1287
1292
|
padding: 0,
|
|
1288
1293
|
fontSize: 2,
|
|
@@ -1299,7 +1304,7 @@ const FileInputMenuItem = React__default.default.forwardRef(function FileInputMe
|
|
|
1299
1304
|
value: "",
|
|
1300
1305
|
disabled
|
|
1301
1306
|
})]
|
|
1302
|
-
})
|
|
1307
|
+
});
|
|
1303
1308
|
});
|
|
1304
1309
|
const LockCard = styled__default.default(ui.Card)(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0.6;\n mix-blend-mode: screen;\n background: transparent;\n"])));
|
|
1305
1310
|
const LockButton = styled__default.default(ui.Button)(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n background: transparent;\n color: white;\n"])));
|
|
@@ -1469,9 +1474,9 @@ const HiddenInput = styled__default.default.input(_templateObject15 || (_templat
|
|
|
1469
1474
|
const Label = styled__default.default.label(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n position: relative;\n"])));
|
|
1470
1475
|
const FileInputButton = _ref14 => {
|
|
1471
1476
|
let {
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1477
|
+
onSelect,
|
|
1478
|
+
...props
|
|
1479
|
+
} = _ref14;
|
|
1475
1480
|
const inputId = "FileSelect".concat(React.useId());
|
|
1476
1481
|
const inputRef = React.useRef(null);
|
|
1477
1482
|
const handleSelect = React.useCallback(event => {
|
|
@@ -1493,14 +1498,15 @@ const FileInputButton = _ref14 => {
|
|
|
1493
1498
|
id: inputId,
|
|
1494
1499
|
onChange: handleSelect,
|
|
1495
1500
|
value: ""
|
|
1496
|
-
}), /* @__PURE__ */jsxRuntime.jsx(ui.Button,
|
|
1501
|
+
}), /* @__PURE__ */jsxRuntime.jsx(ui.Button, {
|
|
1497
1502
|
onClick: handleButtonClick,
|
|
1498
1503
|
mode: "default",
|
|
1499
1504
|
tone: "primary",
|
|
1500
1505
|
style: {
|
|
1501
1506
|
width: "100%"
|
|
1502
|
-
}
|
|
1503
|
-
|
|
1507
|
+
},
|
|
1508
|
+
...props
|
|
1509
|
+
})]
|
|
1504
1510
|
});
|
|
1505
1511
|
};
|
|
1506
1512
|
const UploadCard = styled__default.default(ui.Card)(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n && {\n border-style: dashed;\n }\n"])));
|
|
@@ -1601,6 +1607,8 @@ class MuxVideoInputUploader extends React.Component {
|
|
|
1601
1607
|
};
|
|
1602
1608
|
this.dragEnteredEls = [];
|
|
1603
1609
|
this.ctrlDown = false;
|
|
1610
|
+
// eslint-disable-next-line no-warning-comments
|
|
1611
|
+
// @TODO add proper typings for the return values of uploadFile and uploadUrl
|
|
1604
1612
|
this.upload = null;
|
|
1605
1613
|
this.container = React__default.default.createRef();
|
|
1606
1614
|
this.handleProgress = evt => {
|
|
@@ -1640,6 +1648,8 @@ class MuxVideoInputUploader extends React.Component {
|
|
|
1640
1648
|
}
|
|
1641
1649
|
});
|
|
1642
1650
|
};
|
|
1651
|
+
// eslint-disable-next-line no-warning-comments
|
|
1652
|
+
// @TODO add proper typings for the Observable events
|
|
1643
1653
|
this.handleUploadEvent = event => {
|
|
1644
1654
|
switch (event.type) {
|
|
1645
1655
|
case "success":
|
|
@@ -1870,6 +1880,8 @@ function init(_ref16) {
|
|
|
1870
1880
|
return {
|
|
1871
1881
|
submitting: false,
|
|
1872
1882
|
error: null,
|
|
1883
|
+
// Form inputs don't set the state back to null when clearing a field, but uses empty strings
|
|
1884
|
+
// This ensures the `dirty` check works correctly
|
|
1873
1885
|
token: token != null ? token : "",
|
|
1874
1886
|
secretKey: secretKey != null ? secretKey : "",
|
|
1875
1887
|
enableSignedUrls: enableSignedUrls != null ? enableSignedUrls : false
|
|
@@ -1878,21 +1890,24 @@ function init(_ref16) {
|
|
|
1878
1890
|
function reducer(state, action) {
|
|
1879
1891
|
switch (action == null ? void 0 : action.type) {
|
|
1880
1892
|
case "submit":
|
|
1881
|
-
return
|
|
1893
|
+
return {
|
|
1894
|
+
...state,
|
|
1882
1895
|
submitting: true,
|
|
1883
1896
|
error: null
|
|
1884
|
-
}
|
|
1897
|
+
};
|
|
1885
1898
|
case "error":
|
|
1886
|
-
return
|
|
1899
|
+
return {
|
|
1900
|
+
...state,
|
|
1887
1901
|
submitting: false,
|
|
1888
1902
|
error: action.payload
|
|
1889
|
-
}
|
|
1903
|
+
};
|
|
1890
1904
|
case "reset":
|
|
1891
1905
|
return init(action.payload);
|
|
1892
1906
|
case "change":
|
|
1893
|
-
return
|
|
1907
|
+
return {
|
|
1908
|
+
...state,
|
|
1894
1909
|
[action.payload.name]: action.payload.value
|
|
1895
|
-
}
|
|
1910
|
+
};
|
|
1896
1911
|
default:
|
|
1897
1912
|
throw new Error("Unknown action type: ".concat(action == null ? void 0 : action.type));
|
|
1898
1913
|
}
|
|
@@ -2645,7 +2660,8 @@ const Input = props => {
|
|
|
2645
2660
|
children: isLoading ? /* @__PURE__ */jsxRuntime.jsx(index.InputFallback, {}) : /* @__PURE__ */jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2646
2661
|
children: [secretDocumentValues.value.needsSetup && !assetDocumentValues.value ? /* @__PURE__ */jsxRuntime.jsx(Onboard, {
|
|
2647
2662
|
setDialogState
|
|
2648
|
-
}) : /* @__PURE__ */jsxRuntime.jsx(MuxVideoInputUploader,
|
|
2663
|
+
}) : /* @__PURE__ */jsxRuntime.jsx(MuxVideoInputUploader, {
|
|
2664
|
+
...props,
|
|
2649
2665
|
config: props.config,
|
|
2650
2666
|
onChange: props.onChange,
|
|
2651
2667
|
client,
|
|
@@ -2654,7 +2670,7 @@ const Input = props => {
|
|
|
2654
2670
|
dialogState,
|
|
2655
2671
|
setDialogState,
|
|
2656
2672
|
needsSetup: secretDocumentValues.value.needsSetup
|
|
2657
|
-
})
|
|
2673
|
+
}), dialogState === "secrets" && /* @__PURE__ */jsxRuntime.jsx(ConfigureApi$1, {
|
|
2658
2674
|
setDialogState,
|
|
2659
2675
|
secrets: secretDocumentValues.value.secrets
|
|
2660
2676
|
})]
|
|
@@ -2663,4 +2679,4 @@ const Input = props => {
|
|
|
2663
2679
|
};
|
|
2664
2680
|
var Input$1 = React.memo(Input);
|
|
2665
2681
|
exports.default = Input$1;
|
|
2666
|
-
//# sourceMappingURL=Input-
|
|
2682
|
+
//# sourceMappingURL=Input-7fb0dcd2.js.map
|