sanity-plugin-mux-input 2.11.1 → 2.11.2

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/dist/index.js CHANGED
@@ -1527,7 +1527,7 @@ function VideoPlayer({
1527
1527
  crossOrigin: "anonymous",
1528
1528
  metadata: {
1529
1529
  player_name: "Sanity Admin Dashboard",
1530
- player_version: "2.11.1",
1530
+ player_version: "2.11.2",
1531
1531
  page_type: "Preview Player"
1532
1532
  },
1533
1533
  audio: isAudio,
@@ -1618,21 +1618,21 @@ function PublishedStatus(props) {
1618
1618
  }
1619
1619
  function PaneItemPreview(props) {
1620
1620
  const { icon, layout, presence, schemaType, value } = props, title = sanity.isRecord(value.title) && React.isValidElement(value.title) || isString__default.default(value.title) || isNumber__default.default(value.title) ? value.title : null, observable = React.useMemo(
1621
- () => sanity.getPreviewStateObservable(props.documentPreviewStore, schemaType, value._id, title),
1622
- [props.documentPreviewStore, schemaType, title, value._id]
1623
- ), { draft, published, isLoading } = reactRx.useObservable(observable, {
1624
- draft: null,
1625
- published: null,
1626
- isLoading: !0
1621
+ () => sanity.getPreviewStateObservable(props.documentPreviewStore, schemaType, value._id),
1622
+ [props.documentPreviewStore, schemaType, value._id]
1623
+ ), { snapshot, original, isLoading } = reactRx.useObservable(observable, {
1624
+ isLoading: !0,
1625
+ snapshot: null,
1626
+ original: null
1627
1627
  }), status = isLoading ? null : /* @__PURE__ */ jsxRuntime.jsxs(ui.Inline, { space: 4, children: [
1628
1628
  presence && presence.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(sanity.DocumentPreviewPresence, { presence }),
1629
- /* @__PURE__ */ jsxRuntime.jsx(PublishedStatus, { document: published }),
1630
- /* @__PURE__ */ jsxRuntime.jsx(DraftStatus, { document: draft })
1629
+ /* @__PURE__ */ jsxRuntime.jsx(PublishedStatus, { document: original }),
1630
+ /* @__PURE__ */ jsxRuntime.jsx(DraftStatus, { document: snapshot })
1631
1631
  ] });
1632
1632
  return /* @__PURE__ */ jsxRuntime.jsx(
1633
1633
  sanity.SanityDefaultPreview,
1634
1634
  {
1635
- ...sanity.getPreviewValueWithFallback({ value, draft, published }),
1635
+ ...sanity.getPreviewValueWithFallback({ snapshot, original, fallback: { title } }),
1636
1636
  isPlaceholder: isLoading,
1637
1637
  icon,
1638
1638
  layout,
@@ -2454,7 +2454,7 @@ const useAccessControl = (config) => {
2454
2454
  { refreshInterval: 2e3, refreshWhenHidden: !0, dedupingInterval: 1e3 }
2455
2455
  );
2456
2456
  };
2457
- var c = function(r) {
2457
+ var c = (function(r) {
2458
2458
  var t, e;
2459
2459
  function n(t2) {
2460
2460
  var e2;
@@ -2470,7 +2470,7 @@ var c = function(r) {
2470
2470
  var r2 = this.state, t2 = this.props, e2 = t2.render, n2 = t2.children, o2 = t2.renderError;
2471
2471
  return r2.hasError ? o2 ? o2({ error: r2.error }) : null : e2 ? e2() : n2 || null;
2472
2472
  }, n;
2473
- }(React.PureComponent), u = function(r, t) {
2473
+ })(React.PureComponent), u = function(r, t) {
2474
2474
  switch (t.type) {
2475
2475
  case "catch":
2476
2476
  return { didCatch: !0, error: t.error };
@@ -2746,13 +2746,14 @@ function testUrl(url) {
2746
2746
  const error = new Error("Invalid URL");
2747
2747
  if (typeof url != "string")
2748
2748
  return rxjs.throwError(error);
2749
+ const trimmedUrl = url.trim();
2749
2750
  let parsed;
2750
2751
  try {
2751
- parsed = new URL(url);
2752
+ parsed = new URL(trimmedUrl);
2752
2753
  } catch {
2753
2754
  return rxjs.throwError(error);
2754
2755
  }
2755
- return parsed && !parsed.protocol.match(/http:|https:/) ? rxjs.throwError(error) : rxjs.of(url);
2756
+ return parsed && !parsed.protocol.match(/http:|https:/) ? rxjs.throwError(error) : rxjs.of(trimmedUrl);
2756
2757
  }
2757
2758
  function optionsFromFile(opts, file) {
2758
2759
  if (!(typeof window > "u" || !(file instanceof window.File)))
@@ -3790,7 +3791,7 @@ function Uploader(props) {
3790
3791
  const events$ = new rxjs.Subject();
3791
3792
  return {
3792
3793
  observable: events$.asObservable(),
3793
- handleClick: (event) => events$.next(event)
3794
+ handleClick: ((event) => events$.next(event))
3794
3795
  };
3795
3796
  })()
3796
3797
  ).current, uploadRef = React.useRef(null), uploadingDocumentId = React.useRef(null), [state, dispatch] = React.useReducer(
@@ -3801,7 +3802,7 @@ function Uploader(props) {
3801
3802
  case "commitUpload":
3802
3803
  return Object.assign({}, prev, { uploadStatus: { progress: 0 } });
3803
3804
  case "progressInfo": {
3804
- const { ...payload } = action;
3805
+ const { type, action: _, ...payload } = action;
3805
3806
  return Object.assign({}, prev, {
3806
3807
  uploadStatus: {
3807
3808
  ...prev.uploadStatus,
@@ -3909,7 +3910,7 @@ function Uploader(props) {
3909
3910
  });
3910
3911
  }, handlePaste = (event) => {
3911
3912
  event.preventDefault(), event.stopPropagation();
3912
- const url = (event.clipboardData || window.clipboardData).getData("text");
3913
+ const url = (event.clipboardData || window.clipboardData).getData("text")?.trim();
3913
3914
  if (!isValidUrl(url)) {
3914
3915
  toast.push({ status: "error", title: "Invalid URL for Mux video input." });
3915
3916
  return;