|
@@ -1,6 +1,8 @@
|
|
import {useEffect, useState} from 'react';
|
|
import {useEffect, useState} from 'react';
|
|
|
|
|
|
import LoadingIndicator from 'sentry/components/loadingIndicator';
|
|
import LoadingIndicator from 'sentry/components/loadingIndicator';
|
|
|
|
+import {OnboardingLayout} from 'sentry/components/onboarding/gettingStartedDoc/onboardingLayout';
|
|
|
|
+import {Docs} from 'sentry/components/onboarding/gettingStartedDoc/types';
|
|
import {useSourcePackageRegistries} from 'sentry/components/onboarding/gettingStartedDoc/useSourcePackageRegistries';
|
|
import {useSourcePackageRegistries} from 'sentry/components/onboarding/gettingStartedDoc/useSourcePackageRegistries';
|
|
import {ProductSolution} from 'sentry/components/onboarding/productSelection';
|
|
import {ProductSolution} from 'sentry/components/onboarding/productSelection';
|
|
import type {
|
|
import type {
|
|
@@ -15,10 +17,10 @@ import {useApiQuery} from 'sentry/utils/queryClient';
|
|
type SdkDocumentationProps = {
|
|
type SdkDocumentationProps = {
|
|
activeProductSelection: ProductSolution[];
|
|
activeProductSelection: ProductSolution[];
|
|
organization: Organization;
|
|
organization: Organization;
|
|
- platform: PlatformIntegration | null;
|
|
|
|
|
|
+ platform: PlatformIntegration;
|
|
|
|
+ projectId: Project['id'];
|
|
projectSlug: Project['slug'];
|
|
projectSlug: Project['slug'];
|
|
newOrg?: boolean;
|
|
newOrg?: boolean;
|
|
- projectId?: Project['id'];
|
|
|
|
};
|
|
};
|
|
|
|
|
|
export type ModuleProps = {
|
|
export type ModuleProps = {
|
|
@@ -32,6 +34,11 @@ export type ModuleProps = {
|
|
sourcePackageRegistries?: ReturnType<typeof useSourcePackageRegistries>;
|
|
sourcePackageRegistries?: ReturnType<typeof useSourcePackageRegistries>;
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+function isFunctionalComponent(obj: any): obj is React.ComponentType<ModuleProps> {
|
|
|
|
+ // As we only use function components in the docs this should suffice
|
|
|
|
+ return typeof obj === 'function';
|
|
|
|
+}
|
|
|
|
+
|
|
// Loads the component containing the documentation for the specified platform
|
|
// Loads the component containing the documentation for the specified platform
|
|
export function SdkDocumentation({
|
|
export function SdkDocumentation({
|
|
platform,
|
|
platform,
|
|
@@ -44,7 +51,7 @@ export function SdkDocumentation({
|
|
const sourcePackageRegistries = useSourcePackageRegistries(organization);
|
|
const sourcePackageRegistries = useSourcePackageRegistries(organization);
|
|
|
|
|
|
const [module, setModule] = useState<null | {
|
|
const [module, setModule] = useState<null | {
|
|
- default: React.ComponentType<ModuleProps>;
|
|
|
|
|
|
+ default: Docs<any> | React.ComponentType<ModuleProps>;
|
|
}>(null);
|
|
}>(null);
|
|
|
|
|
|
// TODO: This will be removed once we no longer rely on sentry-docs to load platform icons
|
|
// TODO: This will be removed once we no longer rely on sentry-docs to load platform icons
|
|
@@ -89,7 +96,7 @@ export function SdkDocumentation({
|
|
if (projectKeysIsError || projectKeysIsLoading) {
|
|
if (projectKeysIsError || projectKeysIsLoading) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ setModule(null);
|
|
async function getGettingStartedDoc() {
|
|
async function getGettingStartedDoc() {
|
|
const mod = await import(
|
|
const mod = await import(
|
|
/* webpackExclude: /.spec/ */
|
|
/* webpackExclude: /.spec/ */
|
|
@@ -104,18 +111,33 @@ export function SdkDocumentation({
|
|
return <LoadingIndicator />;
|
|
return <LoadingIndicator />;
|
|
}
|
|
}
|
|
|
|
|
|
- const {default: GettingStartedDoc} = module;
|
|
|
|
|
|
+ const {default: docs} = module;
|
|
|
|
+
|
|
|
|
+ if (isFunctionalComponent(docs)) {
|
|
|
|
+ const GettingStartedDoc = docs;
|
|
|
|
+ return (
|
|
|
|
+ <GettingStartedDoc
|
|
|
|
+ dsn={projectKeys[0].dsn.public}
|
|
|
|
+ activeProductSelection={activeProductSelection}
|
|
|
|
+ newOrg={newOrg}
|
|
|
|
+ platformKey={platform.id}
|
|
|
|
+ organization={organization}
|
|
|
|
+ projectId={projectId}
|
|
|
|
+ projectSlug={projectSlug}
|
|
|
|
+ sourcePackageRegistries={sourcePackageRegistries}
|
|
|
|
+ />
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
|
|
return (
|
|
return (
|
|
- <GettingStartedDoc
|
|
|
|
|
|
+ <OnboardingLayout
|
|
|
|
+ docsConfig={docs}
|
|
dsn={projectKeys[0].dsn.public}
|
|
dsn={projectKeys[0].dsn.public}
|
|
activeProductSelection={activeProductSelection}
|
|
activeProductSelection={activeProductSelection}
|
|
newOrg={newOrg}
|
|
newOrg={newOrg}
|
|
- platformKey={platform?.id}
|
|
|
|
- organization={organization}
|
|
|
|
|
|
+ platformKey={platform.id}
|
|
projectId={projectId}
|
|
projectId={projectId}
|
|
projectSlug={projectSlug}
|
|
projectSlug={projectSlug}
|
|
- sourcePackageRegistries={sourcePackageRegistries}
|
|
|
|
/>
|
|
/>
|
|
);
|
|
);
|
|
}
|
|
}
|