@sanity/embeddings-index-ui 1.1.6 → 1.1.8

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
@@ -47,7 +47,7 @@ function useIsFeatureEnabled() {
47
47
  setStatus(response.enabled ? "enabled" : "disabled");
48
48
  }).catch(err => {
49
49
  console.error(err);
50
- setStatus("disabled");
50
+ setStatus("error");
51
51
  });
52
52
  }, [client]);
53
53
  return status;
@@ -78,6 +78,14 @@ function FeatureDisabledNotice(props) {
78
78
  })
79
79
  });
80
80
  }
81
+ function FeatureError() {
82
+ return /* @__PURE__ */jsxRuntime.jsx(ui.Card, {
83
+ padding: 4,
84
+ border: true,
85
+ tone: "critical",
86
+ children: "An error occurred. See console for details."
87
+ });
88
+ }
81
89
 
82
90
  /******************************************************************************
83
91
  Copyright (c) Microsoft Corporation.
@@ -2141,6 +2149,9 @@ function SemanticSearchReferenceInput(props) {
2141
2149
  children: /* @__PURE__ */jsxRuntime.jsx(ui.Spinner, {})
2142
2150
  }) : null, semantic && featureState == "disabled" ? /* @__PURE__ */jsxRuntime.jsx(FeatureDisabledNotice, {
2143
2151
  urlSuffix: "?ref=embeddings-ref"
2152
+ }) : null, semantic && featureState === "error" ? /* @__PURE__ */jsxRuntime.jsx(ui.Box, {
2153
+ padding: 4,
2154
+ children: /* @__PURE__ */jsxRuntime.jsx(FeatureError, {})
2144
2155
  }) : null, /* @__PURE__ */jsxRuntime.jsx(ui.Box, {
2145
2156
  flex: 1,
2146
2157
  style: {
@@ -2749,25 +2760,31 @@ function IndexStatus(_ref4) {
2749
2760
  function EmbeddingsIndexTool() {
2750
2761
  const featureState = useIsFeatureEnabled();
2751
2762
  return /* @__PURE__ */jsxRuntime.jsx(ui.Card, {
2763
+ flex: 1,
2752
2764
  children: /* @__PURE__ */jsxRuntime.jsxs(ui.Flex, {
2753
2765
  justify: "center",
2754
2766
  flex: 1,
2755
- children: [featureState == "disabled" ? /* @__PURE__ */jsxRuntime.jsx(ui.Box, {
2767
+ children: [featureState === "error" ? /* @__PURE__ */jsxRuntime.jsx(ui.Box, {
2768
+ padding: 4,
2769
+ children: /* @__PURE__ */jsxRuntime.jsx(FeatureError, {})
2770
+ }) : null, featureState === "disabled" ? /* @__PURE__ */jsxRuntime.jsx(ui.Box, {
2756
2771
  padding: 4,
2757
2772
  children: /* @__PURE__ */jsxRuntime.jsx(FeatureDisabledNotice, {
2758
2773
  urlSuffix: "?ref=embeddings-tab"
2759
2774
  })
2760
- }) : null, /* @__PURE__ */jsxRuntime.jsxs(ui.Card, {
2775
+ }) : null, featureState === "loading" ? /* @__PURE__ */jsxRuntime.jsx(ui.Box, {
2776
+ padding: 6,
2777
+ children: /* @__PURE__ */jsxRuntime.jsx(ui.Spinner, {
2778
+ size: 4
2779
+ })
2780
+ }) : null, featureState === "enabled" ? /* @__PURE__ */jsxRuntime.jsx(ui.Card, {
2761
2781
  flex: 1,
2762
2782
  style: {
2763
2783
  maxWidth: 1200
2764
2784
  },
2765
2785
  padding: 5,
2766
- children: [featureState == "loading" ? /* @__PURE__ */jsxRuntime.jsx(ui.Box, {
2767
- padding: 2,
2768
- children: /* @__PURE__ */jsxRuntime.jsx(ui.Spinner, {})
2769
- }) : null, featureState == "enabled" ? /* @__PURE__ */jsxRuntime.jsx(Indexes, {}) : null]
2770
- })]
2786
+ children: /* @__PURE__ */jsxRuntime.jsx(Indexes, {})
2787
+ }) : null]
2771
2788
  })
2772
2789
  });
2773
2790
  }