@sanity/embeddings-index-ui 1.1.6 → 1.1.7

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.esm.js CHANGED
@@ -36,7 +36,7 @@ function useIsFeatureEnabled() {
36
36
  setStatus(response.enabled ? "enabled" : "disabled");
37
37
  }).catch(err => {
38
38
  console.error(err);
39
- setStatus("disabled");
39
+ setStatus("error");
40
40
  });
41
41
  }, [client]);
42
42
  return status;
@@ -67,6 +67,14 @@ function FeatureDisabledNotice(props) {
67
67
  })
68
68
  });
69
69
  }
70
+ function FeatureError() {
71
+ return /* @__PURE__ */jsx(Card, {
72
+ padding: 4,
73
+ border: true,
74
+ tone: "critical",
75
+ children: "An error occurred. See console for details."
76
+ });
77
+ }
70
78
 
71
79
  /******************************************************************************
72
80
  Copyright (c) Microsoft Corporation.
@@ -2130,6 +2138,9 @@ function SemanticSearchReferenceInput(props) {
2130
2138
  children: /* @__PURE__ */jsx(Spinner, {})
2131
2139
  }) : null, semantic && featureState == "disabled" ? /* @__PURE__ */jsx(FeatureDisabledNotice, {
2132
2140
  urlSuffix: "?ref=embeddings-ref"
2141
+ }) : null, semantic && featureState === "error" ? /* @__PURE__ */jsx(Box, {
2142
+ padding: 4,
2143
+ children: /* @__PURE__ */jsx(FeatureError, {})
2133
2144
  }) : null, /* @__PURE__ */jsx(Box, {
2134
2145
  flex: 1,
2135
2146
  style: {
@@ -2738,25 +2749,31 @@ function IndexStatus(_ref4) {
2738
2749
  function EmbeddingsIndexTool() {
2739
2750
  const featureState = useIsFeatureEnabled();
2740
2751
  return /* @__PURE__ */jsx(Card, {
2752
+ flex: 1,
2741
2753
  children: /* @__PURE__ */jsxs(Flex, {
2742
2754
  justify: "center",
2743
2755
  flex: 1,
2744
- children: [featureState == "disabled" ? /* @__PURE__ */jsx(Box, {
2756
+ children: [featureState === "error" ? /* @__PURE__ */jsx(Box, {
2757
+ padding: 4,
2758
+ children: /* @__PURE__ */jsx(FeatureError, {})
2759
+ }) : null, featureState === "disabled" ? /* @__PURE__ */jsx(Box, {
2745
2760
  padding: 4,
2746
2761
  children: /* @__PURE__ */jsx(FeatureDisabledNotice, {
2747
2762
  urlSuffix: "?ref=embeddings-tab"
2748
2763
  })
2749
- }) : null, /* @__PURE__ */jsxs(Card, {
2764
+ }) : null, featureState === "loading" ? /* @__PURE__ */jsx(Box, {
2765
+ padding: 6,
2766
+ children: /* @__PURE__ */jsx(Spinner, {
2767
+ size: 4
2768
+ })
2769
+ }) : null, featureState === "enabled" ? /* @__PURE__ */jsx(Card, {
2750
2770
  flex: 1,
2751
2771
  style: {
2752
2772
  maxWidth: 1200
2753
2773
  },
2754
2774
  padding: 5,
2755
- children: [featureState == "loading" ? /* @__PURE__ */jsx(Box, {
2756
- padding: 2,
2757
- children: /* @__PURE__ */jsx(Spinner, {})
2758
- }) : null, featureState == "enabled" ? /* @__PURE__ */jsx(Indexes, {}) : null]
2759
- })]
2775
+ children: /* @__PURE__ */jsx(Indexes, {})
2776
+ }) : null]
2760
2777
  })
2761
2778
  });
2762
2779
  }