@chargebee/code-sample-generator 1.0.0 → 1.0.2

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.
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { ChevronLeft, ChevronRight, Check, Copy, Code, SquareArrowOutUpRight, ArrowRight } from "lucide-react";
3
3
  import { useState, useEffect, useRef, useId } from "react";
4
- import { A as AVAILABLE_LANGUAGE_IDS, k as fallbackPlainHtml, a as AVAILABLE_LANGUAGES } from "./generate-from-sample-D6gdkUpR.js";
4
+ import { A as AVAILABLE_LANGUAGE_IDS, k as fallbackPlainHtml, a as AVAILABLE_LANGUAGES } from "./generate-from-sample-B1Rj07T6.js";
5
5
  import { snakeCase } from "change-case";
6
6
  function useLanguageSelection(initialLanguage, onChange) {
7
7
  const [selectedLanguage, setSelectedLanguage] = useState(initialLanguage);
@@ -389,7 +389,7 @@ function CodeBlock({
389
389
  const highlight = async () => {
390
390
  setIsLoading(true);
391
391
  try {
392
- const { highlightCode } = await import("./highlight-code-IZ3Hy145.js").then((n) => n.a);
392
+ const { highlightCode } = await import("./highlight-code-DEB0Ig2J.js").then((n) => n.a);
393
393
  const result = await highlightCode({
394
394
  code,
395
395
  language,
@@ -632,15 +632,14 @@ function LanguageTabList({
632
632
  }
633
633
  );
634
634
  }
635
- function formatResponseJson(responseData) {
636
- return JSON.stringify(responseData, null, 2).replace(
637
- /\{\s*"d":\s*"d"\s*\}/g,
638
- "{..}"
639
- );
635
+ function formatResponseJson(responseData, showFullSampleResponse = false) {
636
+ const json = JSON.stringify(responseData, null, 2);
637
+ return showFullSampleResponse ? json : json.replace(/\{\s*"d":\s*"d"\s*\}/g, "{..}");
640
638
  }
641
639
  function ResponseDisplay({
642
640
  responseData,
643
641
  responseTheme,
642
+ showFullSampleResponse,
644
643
  showCopyButton = true,
645
644
  onCopy
646
645
  }) {
@@ -651,7 +650,7 @@ function ResponseDisplay({
651
650
  useEffect(() => {
652
651
  setIsReady(true);
653
652
  }, []);
654
- const responseJson = formatResponseJson(responseData);
653
+ const responseJson = formatResponseJson(responseData, showFullSampleResponse);
655
654
  const isDarkResponseTheme = responseTheme === "github-dark";
656
655
  const handleCopyResponse = async () => {
657
656
  if (!responseJson || copying) return;
@@ -843,6 +842,7 @@ function CodeSamples({
843
842
  samples,
844
843
  responseData,
845
844
  initialLanguage = "curl",
845
+ showFullSampleResponse = false,
846
846
  theme: themeProp,
847
847
  responseTheme: responseThemeProp,
848
848
  highlighter,
@@ -1143,6 +1143,7 @@ function CodeSamples({
1143
1143
  {
1144
1144
  responseData,
1145
1145
  responseTheme: sampleResultTheme,
1146
+ showFullSampleResponse,
1146
1147
  showCopyButton,
1147
1148
  onCopy: _onCopy
1148
1149
  }
package/dist/browser.js CHANGED
@@ -1,6 +1,6 @@
1
- import { C, a, b, c, G, L, T, u, d } from "./LanguageSwitcher-KvyNre2o.js";
2
- import { e as getOperationIdsForVersion, c as getOperationIds, r as resolveDescriptor, l as generateFromSample } from "./generate-from-sample-D6gdkUpR.js";
3
- import { a as a2, A, C as C2, D, b as b2, L as L2, w, O } from "./generate-from-sample-D6gdkUpR.js";
1
+ import { C, a, b, c, G, L, T, u, d } from "./LanguageSwitcher-CmrCgNzs.js";
2
+ import { e as getOperationIdsForVersion, c as getOperationIds, r as resolveDescriptor, l as generateFromSample } from "./generate-from-sample-B1Rj07T6.js";
3
+ import { a as a2, A, C as C2, D, b as b2, L as L2, w, O } from "./generate-from-sample-B1Rj07T6.js";
4
4
  function validateOperationId(id, version) {
5
5
  if (version) {
6
6
  const ops = getOperationIdsForVersion(version);