File tree Expand file tree Collapse file tree 2 files changed +12
-22
lines changed
src/shared/modules/preview Expand file tree Collapse file tree 2 files changed +12
-22
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,6 @@ describe('previewDuck tests', () => {
4848 const [ action ] = store . getActions ( )
4949 expect ( action ) . toEqual ( {
5050 type : PREVIEW_EVENT ,
51- category : 'preview' ,
5251 label : 'ui-switch' ,
5352 data : {
5453 switchedTo : 'preview' ,
@@ -114,7 +113,6 @@ describe('previewDuck tests', () => {
114113 const [ action ] = store . getActions ( )
115114 expect ( action ) . toEqual ( {
116115 type : PREVIEW_EVENT ,
117- category : 'preview' ,
118116 label : 'page-load' ,
119117 data : { previewUI : false , hasTriedPreviewUI : false }
120118 } )
Original file line number Diff line number Diff line change 1919 */
2020export const PREVIEW_EVENT = 'preview/PREVIEW_EVENT'
2121
22- interface PreviewUiSwitchAction {
22+ interface PreviewEventAction {
2323 type : typeof PREVIEW_EVENT
24- category : 'preview'
2524 label : string
26- data : {
27- switchedTo : 'preview' | 'classic'
28- timeSinceLastSwitch : number | null
29- }
30- }
31-
32- interface PreviewPageLoadAction {
33- type : typeof PREVIEW_EVENT
34- category : 'preview'
35- label : string
36- data : {
37- previewUI : boolean
38- hasTriedPreviewUI : boolean
39- }
25+ data :
26+ | {
27+ switchedTo : 'preview' | 'classic'
28+ timeSinceLastSwitch : number | null
29+ }
30+ | {
31+ previewUI : boolean
32+ hasTriedPreviewUI : boolean
33+ }
4034}
4135
42- export const trackNavigateToPreview = ( ) : PreviewUiSwitchAction => {
36+ export const trackNavigateToPreview = ( ) : PreviewEventAction => {
4337 const now = Date . now ( )
4438 localStorage . setItem ( 'hasTriedPreviewUI' , 'true' )
4539
@@ -53,7 +47,6 @@ export const trackNavigateToPreview = (): PreviewUiSwitchAction => {
5347
5448 return {
5549 type : PREVIEW_EVENT ,
56- category : 'preview' ,
5750 label : 'ui-switch' ,
5851 data : {
5952 switchedTo : 'preview' ,
@@ -62,12 +55,11 @@ export const trackNavigateToPreview = (): PreviewUiSwitchAction => {
6255 }
6356}
6457
65- export const trackPageLoad = ( ) : PreviewPageLoadAction => {
58+ export const trackPageLoad = ( ) : PreviewEventAction => {
6659 const hasTriedPreviewUI = localStorage . getItem ( 'hasTriedPreviewUI' ) === 'true'
6760
6861 return {
6962 type : PREVIEW_EVENT ,
70- category : 'preview' ,
7163 label : 'page-load' ,
7264 data : { previewUI : false , hasTriedPreviewUI }
7365 }
You can’t perform that action at this time.
0 commit comments