|
@@ -10,7 +10,6 @@ import {CompactSelect} from 'sentry/components/compactSelect';
|
|
|
import RadioGroup from 'sentry/components/forms/controls/radioGroup';
|
|
|
import IdBadge from 'sentry/components/idBadge';
|
|
|
import LoadingIndicator from 'sentry/components/loadingIndicator';
|
|
|
-import {MobileBetaBanner} from 'sentry/components/onboarding/gettingStartedDoc/utils';
|
|
|
import useCurrentProjectState from 'sentry/components/onboarding/gettingStartedDoc/utils/useCurrentProjectState';
|
|
|
import {useLoadGettingStarted} from 'sentry/components/onboarding/gettingStartedDoc/utils/useLoadGettingStarted';
|
|
|
import {PlatformOptionDropdown} from 'sentry/components/replaysOnboarding/platformOptionDropdown';
|
|
@@ -21,10 +20,10 @@ import type {CommonSidebarProps} from 'sentry/components/sidebar/types';
|
|
|
import {SidebarPanelKey} from 'sentry/components/sidebar/types';
|
|
|
import TextOverflow from 'sentry/components/textOverflow';
|
|
|
import {
|
|
|
- backend,
|
|
|
replayBackendPlatforms,
|
|
|
replayFrontendPlatforms,
|
|
|
replayJsLoaderInstructionsPlatformList,
|
|
|
+ replayMobilePlatforms,
|
|
|
replayOnboardingPlatforms,
|
|
|
replayPlatforms,
|
|
|
} from 'sentry/data/platformCategories';
|
|
@@ -162,6 +161,8 @@ function OnboardingContent({
|
|
|
currentProject: Project;
|
|
|
hasDocs: boolean;
|
|
|
}) {
|
|
|
+ const organization = useOrganization();
|
|
|
+
|
|
|
const jsFrameworkSelectOptions = replayJsFrameworkOptions().map(platform => {
|
|
|
return {
|
|
|
value: platform.id,
|
|
@@ -175,40 +176,29 @@ function OnboardingContent({
|
|
|
};
|
|
|
});
|
|
|
|
|
|
- const organization = useOrganization();
|
|
|
const [jsFramework, setJsFramework] = useState<{
|
|
|
value: PlatformKey;
|
|
|
label?: ReactNode;
|
|
|
textValue?: string;
|
|
|
}>(jsFrameworkSelectOptions[0]);
|
|
|
|
|
|
- const defaultTab =
|
|
|
- currentProject.platform && backend.includes(currentProject.platform)
|
|
|
- ? 'jsLoader'
|
|
|
- : 'npm';
|
|
|
-
|
|
|
- const {getParamValue: setupMode, setParamValue: setSetupMode} = useUrlParams(
|
|
|
- 'mode',
|
|
|
- defaultTab
|
|
|
- );
|
|
|
-
|
|
|
- const showJsFrameworkInstructions =
|
|
|
- currentProject.platform &&
|
|
|
- replayBackendPlatforms.includes(currentProject.platform) &&
|
|
|
- setupMode() === 'npm';
|
|
|
-
|
|
|
+ const backendPlatform =
|
|
|
+ currentProject.platform && replayBackendPlatforms.includes(currentProject.platform);
|
|
|
+ const mobilePlatform =
|
|
|
+ currentProject.platform && replayMobilePlatforms.includes(currentProject.platform);
|
|
|
const npmOnlyFramework =
|
|
|
currentProject.platform &&
|
|
|
replayFrontendPlatforms
|
|
|
.filter((p): p is PlatformKey => p !== 'javascript')
|
|
|
.includes(currentProject.platform);
|
|
|
|
|
|
- const showRadioButtons =
|
|
|
- currentProject.platform &&
|
|
|
- replayJsLoaderInstructionsPlatformList.includes(currentProject.platform);
|
|
|
+ const defaultTab = backendPlatform ? 'jsLoader' : 'npm';
|
|
|
+ const {getParamValue: setupMode, setParamValue: setSetupMode} = useUrlParams(
|
|
|
+ 'mode',
|
|
|
+ defaultTab
|
|
|
+ );
|
|
|
|
|
|
- const backendPlatforms =
|
|
|
- currentProject.platform && replayBackendPlatforms.includes(currentProject.platform);
|
|
|
+ const showJsFrameworkInstructions = backendPlatform && setupMode() === 'npm';
|
|
|
|
|
|
const currentPlatform = currentProject.platform
|
|
|
? platforms.find(p => p.id === currentProject.platform) ?? otherPlatform
|
|
@@ -240,6 +230,10 @@ function OnboardingContent({
|
|
|
productType: 'replay',
|
|
|
});
|
|
|
|
|
|
+ const showRadioButtons =
|
|
|
+ currentProject.platform &&
|
|
|
+ replayJsLoaderInstructionsPlatformList.includes(currentProject.platform);
|
|
|
+
|
|
|
const radioButtons = (
|
|
|
<Header>
|
|
|
{showRadioButtons ? (
|
|
@@ -248,7 +242,7 @@ function OnboardingContent({
|
|
|
choices={[
|
|
|
[
|
|
|
'npm',
|
|
|
- backendPlatforms ? (
|
|
|
+ backendPlatform ? (
|
|
|
<PlatformSelect key="platform-select">
|
|
|
{tct('I use [platformSelect]', {
|
|
|
platformSelect: (
|
|
@@ -283,6 +277,7 @@ function OnboardingContent({
|
|
|
onChange={setSetupMode}
|
|
|
/>
|
|
|
) : (
|
|
|
+ !mobilePlatform &&
|
|
|
docs?.platformOptions &&
|
|
|
!isProjKeysLoading && (
|
|
|
<PlatformSelect>
|
|
@@ -306,22 +301,6 @@ function OnboardingContent({
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- // TODO: remove once we have mobile replay onboarding
|
|
|
- if (['android', 'react-native'].includes(currentPlatform.language)) {
|
|
|
- return (
|
|
|
- <MobileBetaBanner
|
|
|
- link={`https://docs.sentry.io/platforms/${currentPlatform.language}/session-replay/`}
|
|
|
- />
|
|
|
- );
|
|
|
- }
|
|
|
- if (currentPlatform.language === 'apple') {
|
|
|
- return (
|
|
|
- <MobileBetaBanner
|
|
|
- link={`https://docs.sentry.io/platforms/apple/guides/ios/session-replay/`}
|
|
|
- />
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
const doesNotSupportReplay = currentProject.platform
|
|
|
? !replayPlatforms.includes(currentProject.platform)
|
|
|
: true;
|
|
@@ -375,6 +354,7 @@ function OnboardingContent({
|
|
|
<Fragment>
|
|
|
{radioButtons}
|
|
|
<ReplayOnboardingLayout
|
|
|
+ hideMaskBlockToggles={mobilePlatform}
|
|
|
docsConfig={docs}
|
|
|
dsn={dsn}
|
|
|
activeProductSelection={[]}
|
|
@@ -384,8 +364,9 @@ function OnboardingContent({
|
|
|
configType={
|
|
|
setupMode() === 'npm' || // switched to NPM option
|
|
|
(!setupMode() && defaultTab === 'npm') || // default value for FE frameworks when ?mode={...} in URL is not set yet
|
|
|
- npmOnlyFramework // even if '?mode=jsLoader', only show npm instructions for FE frameworks
|
|
|
- ? 'replayOnboardingNpm'
|
|
|
+ npmOnlyFramework ||
|
|
|
+ mobilePlatform // even if '?mode=jsLoader', only show npm/default instructions for FE frameworks & mobile platforms
|
|
|
+ ? 'replayOnboarding'
|
|
|
: 'replayOnboardingJsLoader'
|
|
|
}
|
|
|
/>
|