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