All files / src/components/Merchants/MerchantPreview/modals/shared JSONViewer.tsx

100% Statements 4/4
100% Branches 0/0
100% Functions 1/1
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26                5x 41x   41x                 5x          
import { TextareaAutosize } from "@mui/material";
import { checkoutScrollbarStyles } from "@sections/PayBuilder/Checkout/helpers";
import { styled } from "@theme/v2/Provider";
 
type JSONViewerProps = {
  response: Record<string, any>;
};
 
const JSONViewer = ({ response }: JSONViewerProps) => {
  const computedResponse = JSON.stringify(response, undefined, 2);
 
  return (
    <StyledTextareaAutosize
      readOnly
      value={computedResponse}
      data-testid="OFAC-JSON-Response"
    />
  );
};
 
const StyledTextareaAutosize = styled(TextareaAutosize)`
  ${checkoutScrollbarStyles}
`;
 
export default JSONViewer;