@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.cjs CHANGED
@@ -1009,34 +1009,36 @@ var ToolCallIcon = function(param) {
1009
1009
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_icons3.CircleIcon, {});
1010
1010
  }
1011
1011
  };
1012
- // src/components/functions/FunctionBase/Content.tsx
1012
+ // src/components/functions/FunctionBase/Content/index.tsx
1013
1013
  var import_react16 = require("react");
1014
1014
  var import_themes11 = require("@radix-ui/themes");
1015
+ // src/components/functions/FunctionBase/Content/lib/formattedJsonOrRaw.ts
1016
+ var formattedJsonOrRaw = function(param) {
1017
+ var value = param.value;
1018
+ if (!value) {
1019
+ return null;
1020
+ }
1021
+ try {
1022
+ return JSON.stringify(JSON.parse(value), null, 2);
1023
+ } catch (error) {
1024
+ return value;
1025
+ }
1026
+ };
1027
+ // src/components/functions/FunctionBase/Content/index.tsx
1015
1028
  var import_jsx_runtime13 = require("react/jsx-runtime");
1016
1029
  var Content = function(param) {
1017
1030
  var fn = param.fn;
1018
1031
  var args = (0, import_react16.useMemo)(function() {
1019
- var result = null;
1020
- try {
1021
- result = JSON.parse(fn.arguments);
1022
- } catch (error) {
1023
- console.error(error);
1024
- }
1025
- return result;
1032
+ return formattedJsonOrRaw({
1033
+ value: fn.arguments
1034
+ });
1026
1035
  }, [
1027
1036
  fn
1028
1037
  ]);
1029
1038
  var output = (0, import_react16.useMemo)(function() {
1030
- if (!fn.output) {
1031
- return null;
1032
- }
1033
- var result = null;
1034
- try {
1035
- result = JSON.parse(fn.output);
1036
- } catch (error) {
1037
- console.error(error);
1038
- }
1039
- return result;
1039
+ return formattedJsonOrRaw({
1040
+ value: fn.output
1041
+ });
1040
1042
  }, [
1041
1043
  fn
1042
1044
  ]);
@@ -1052,10 +1054,10 @@ var Content = function(param) {
1052
1054
  },
1053
1055
  children: [
1054
1056
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_themes11.Box, {
1055
- children: args && JSON.stringify(args, null, 2)
1057
+ children: args
1056
1058
  }),
1057
1059
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_themes11.Box, {
1058
- children: output && JSON.stringify(output, null, 2)
1060
+ children: output
1059
1061
  })
1060
1062
  ]
1061
1063
  });