@@ -9,6 +9,23 @@ import styles from './styles.module.scss';
99
1010import { CodeContext } from '../codeContext' ;
1111
12+ const OPTION_IDS = [
13+ 'error-monitoring' ,
14+ 'logs' ,
15+ 'session-replay' ,
16+ 'performance' ,
17+ 'profiling' ,
18+ 'source-maps' ,
19+ 'user-feedback' ,
20+ 'source-context' ,
21+ 'dsym' ,
22+ 'opentelemetry' ,
23+ ] as const ;
24+
25+ const OPTION_IDS_SET = new Set ( OPTION_IDS ) ;
26+
27+ type OptionId = ( typeof OPTION_IDS ) [ number ] ;
28+
1229const optionDetails : Record <
1330 OptionId ,
1431 {
@@ -21,6 +38,24 @@ const optionDetails: Record<
2138 name : 'Error Monitoring' ,
2239 description : "Let's admit it, we all have errors." ,
2340 } ,
41+ logs : {
42+ name : 'Logs' ,
43+ description : (
44+ < span >
45+ Send text-based log information from your applications to Sentry for viewing
46+ alongside relevant errors and searching by text-string or individual attributes.
47+ </ span >
48+ ) ,
49+ } ,
50+ 'session-replay' : {
51+ name : 'Session Replay' ,
52+ description : (
53+ < span >
54+ Video-like reproductions of user sessions with debugging context to help you
55+ confirm issue impact and troubleshoot faster.
56+ </ span >
57+ ) ,
58+ } ,
2459 performance : {
2560 name : 'Tracing' ,
2661 description : (
@@ -41,12 +76,12 @@ const optionDetails: Record<
4176 ) ,
4277 deps : [ 'performance' ] ,
4378 } ,
44- 'session-replay ' : {
45- name : 'Session Replay ' ,
79+ 'source-maps ' : {
80+ name : 'Source Maps ' ,
4681 description : (
4782 < span >
48- Video-like reproductions of user sessions with debugging context to help you
49- confirm issue impact and troubleshoot faster .
83+ Source maps for web applications that help translate minified code back to the
84+ original source for better error reporting .
5085 </ span >
5186 ) ,
5287 } ,
@@ -59,15 +94,6 @@ const optionDetails: Record<
5994 </ span >
6095 ) ,
6196 } ,
62- logs : {
63- name : 'Logs (Beta)' ,
64- description : (
65- < span >
66- Send text-based log information from your applications to Sentry for viewing
67- alongside relevant errors and searching by text-string or individual attributes.
68- </ span >
69- ) ,
70- } ,
7197 'source-context' : {
7298 name : 'Source Context' ,
7399 description : (
@@ -86,36 +112,12 @@ const optionDetails: Record<
86112 </ span >
87113 ) ,
88114 } ,
89- 'source-maps' : {
90- name : 'Source Maps' ,
91- description : (
92- < span >
93- Source maps for web applications that help translate minified code back to the
94- original source for better error reporting.
95- </ span >
96- ) ,
97- } ,
98115 opentelemetry : {
99116 name : 'OpenTelemetry' ,
100117 description : < span > Combine Sentry with OpenTelemetry.</ span > ,
101118 } ,
102119} ;
103120
104- const OPTION_IDS = [
105- 'error-monitoring' ,
106- 'performance' ,
107- 'profiling' ,
108- 'session-replay' ,
109- 'user-feedback' ,
110- 'logs' ,
111- 'source-context' ,
112- 'dsym' ,
113- 'source-maps' ,
114- 'opentelemetry' ,
115- ] as const ;
116-
117- type OptionId = ( typeof OPTION_IDS ) [ number ] ;
118-
119121export type OnboardingOptionType = {
120122 /**
121123 * Unique identifier for the option, will control the visibility
@@ -132,7 +134,7 @@ export type OnboardingOptionType = {
132134
133135const validateOptionIds = ( options : Pick < OnboardingOptionType , 'id' > [ ] ) => {
134136 options . forEach ( option => {
135- if ( ! OPTION_IDS . includes ( option . id ) ) {
137+ if ( ! OPTION_IDS_SET . has ( option . id ) ) {
136138 throw new Error (
137139 `Invalid option id: ${ option . id } .\nValid options are: ${ OPTION_IDS . map ( opt => `"${ opt } "` ) . join ( ', ' ) } `
138140 ) ;
@@ -237,17 +239,26 @@ export function OnboardingOptionButtons({
237239} ) {
238240 const codeContext = useContext ( CodeContext ) ;
239241
240- const normalizedOptions = initialOptions . map ( option => {
241- if ( typeof option === 'string' ) {
242- return {
243- id : option ,
244- // error monitoring is always needs to be checked and disabled
245- disabled : option === 'error-monitoring' ,
246- checked : option === 'error-monitoring' ,
247- } ;
248- }
249- return option ;
250- } ) ;
242+ const normalizedOptions = initialOptions
243+ . map ( option => {
244+ if ( typeof option === 'string' ) {
245+ return {
246+ id : option ,
247+ // error monitoring is always needs to be checked and disabled
248+ disabled : option === 'error-monitoring' ,
249+ checked : option === 'error-monitoring' ,
250+ } ;
251+ }
252+ return option ;
253+ } )
254+ // sort options by their index in OPTION_IDS
255+ // so that the order of the options is consistent
256+ // regardless of how the user passes them in
257+ . sort ( ( a , b ) => {
258+ const indexA = OPTION_IDS . indexOf ( a . id ) ;
259+ const indexB = OPTION_IDS . indexOf ( b . id ) ;
260+ return indexA - indexB ;
261+ } ) ;
251262
252263 validateOptionIds ( normalizedOptions ) ;
253264
0 commit comments