@superinterface/react 2.16.4 → 2.16.5

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
@@ -863,34 +863,36 @@ var ToolCallIcon = function(param) {
863
863
  return /* @__PURE__ */ jsx12(CircleIcon, {});
864
864
  }
865
865
  };
866
- // src/components/functions/FunctionBase/Content.tsx
866
+ // src/components/functions/FunctionBase/Content/index.tsx
867
867
  import { useMemo as useMemo3 } from "react";
868
868
  import { Code, Box as Box2 } from "@radix-ui/themes";
869
+ // src/components/functions/FunctionBase/Content/lib/formattedJsonOrRaw.ts
870
+ var formattedJsonOrRaw = function(param) {
871
+ var value = param.value;
872
+ if (!value) {
873
+ return null;
874
+ }
875
+ try {
876
+ return JSON.stringify(JSON.parse(value), null, 2);
877
+ } catch (error) {
878
+ return value;
879
+ }
880
+ };
881
+ // src/components/functions/FunctionBase/Content/index.tsx
869
882
  import { jsx as jsx13, jsxs as jsxs2 } from "react/jsx-runtime";
870
883
  var Content = function(param) {
871
884
  var fn = param.fn;
872
885
  var args = useMemo3(function() {
873
- var result = null;
874
- try {
875
- result = JSON.parse(fn.arguments);
876
- } catch (error) {
877
- console.error(error);
878
- }
879
- return result;
886
+ return formattedJsonOrRaw({
887
+ value: fn.arguments
888
+ });
880
889
  }, [
881
890
  fn
882
891
  ]);
883
892
  var output = useMemo3(function() {
884
- if (!fn.output) {
885
- return null;
886
- }
887
- var result = null;
888
- try {
889
- result = JSON.parse(fn.output);
890
- } catch (error) {
891
- console.error(error);
892
- }
893
- return result;
893
+ return formattedJsonOrRaw({
894
+ value: fn.output
895
+ });
894
896
  }, [
895
897
  fn
896
898
  ]);
@@ -906,10 +908,10 @@ var Content = function(param) {
906
908
  },
907
909
  children: [
908
910
  /* @__PURE__ */ jsx13(Box2, {
909
- children: args && JSON.stringify(args, null, 2)
911
+ children: args
910
912
  }),
911
913
  /* @__PURE__ */ jsx13(Box2, {
912
- children: output && JSON.stringify(output, null, 2)
914
+ children: output
913
915
  })
914
916
  ]
915
917
  });