@chargebee/code-sample-generator 1.0.0 → 1.0.1
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/{LanguageSwitcher-KvyNre2o.js → LanguageSwitcher-CmrCgNzs.js} +9 -8
- package/dist/browser.js +3 -3
- package/dist/code-sample-generator.css +489 -885
- package/dist/components/CodeSamples.d.ts +1 -1
- package/dist/{generate-code-sample-ioM_ISFV.js → generate-code-sample-DwenHif9.js} +1 -1
- package/dist/{generate-from-sample-D6gdkUpR.js → generate-from-sample-B1Rj07T6.js} +2621 -1816
- package/dist/generated/ops/operation-ids.d.ts +2 -2
- package/dist/generated/ops/operation-params.d.ts +166 -89
- package/dist/generated/ops/v2-pcv1/list_disputes.d.ts +3 -0
- package/dist/generated/ops/v2-pcv1/retrieve_a_dispute.d.ts +3 -0
- package/dist/generated/ops/v2-pcv2/delete_a_business_ruleset.d.ts +3 -0
- package/dist/generated/ops/v2-pcv2/list_disputes.d.ts +3 -0
- package/dist/generated/ops/v2-pcv2/retrieve_a_dispute.d.ts +3 -0
- package/dist/{highlight-code-IZ3Hy145.js → highlight-code-DEB0Ig2J.js} +1 -1
- package/dist/index.js +12 -9
- package/dist/node.js +3 -3
- package/dist/samples/repo.d.ts +3 -1
- package/dist/types.d.ts +2 -0
- package/package.json +3 -7
|
@@ -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-
|
|
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-
|
|
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
|
-
|
|
637
|
-
|
|
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-
|
|
2
|
-
import { e as getOperationIdsForVersion, c as getOperationIds, r as resolveDescriptor, l as generateFromSample } from "./generate-from-sample-
|
|
3
|
-
import { a as a2, A, C as C2, D, b as b2, L as L2, w, O } from "./generate-from-sample-
|
|
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);
|