@@ -28,7 +28,11 @@ import { CORE_SITE } from '@/js/googlesitekit/datastore/site/constants';
2828import { Cell , Grid , Row } from '@/js/material-components' ;
2929import { MODULE_SLUG_ANALYTICS_4 } from '@/js/modules/analytics-4/constants' ;
3030import * as fixtures from '@/js/modules/analytics-4/datastore/__fixtures__' ;
31- import { MODULES_ANALYTICS_4 } from '@/js/modules/analytics-4/datastore/constants' ;
31+ import {
32+ MODULES_ANALYTICS_4 ,
33+ PROPERTY_CREATE ,
34+ WEBDATASTREAM_CREATE ,
35+ } from '@/js/modules/analytics-4/datastore/constants' ;
3236import { provideModules } from '@tests/js/utils' ;
3337import WithRegistrySetup from '@tests/js/WithRegistrySetup' ;
3438import SettingsForm from './SettingsForm' ;
@@ -321,8 +325,11 @@ WithSiteGoalsBreakdownsRow.decorators = [
321325 registry
322326 . dispatch ( MODULES_ANALYTICS_4 )
323327 . receiveGetAdvancedDataBreakdownsSettings ( {
324- enabled : false ,
328+ [ propertyID ] : false ,
325329 } ) ;
330+ registry
331+ . dispatch ( MODULES_ANALYTICS_4 )
332+ . receiveGetCustomDimensions ( [ ] , { propertyID } ) ;
326333 }
327334
328335 return (
@@ -346,25 +353,21 @@ WithSiteGoalsBreakdownsRowEnabled.decorators = [
346353 registry
347354 . dispatch ( MODULES_ANALYTICS_4 )
348355 . receiveGetAdvancedDataBreakdownsSettings ( {
349- enabled : true ,
356+ [ propertyID ] : true ,
350357 } ) ;
351- registry . dispatch ( MODULES_ANALYTICS_4 ) . setSettings ( {
352- accountID,
353- propertyID,
354- webDataStreamID,
355- measurementID,
356- useSnippet : true ,
357- anonymizeIP : true ,
358- trackingDisabled : [ 'loggedinUsers' ] ,
359- availableCustomDimensions : [
360- 'googlesitekit_post_date' ,
361- 'googlesitekit_post_author' ,
362- 'googlesitekit_post_categories' ,
363- 'googlesitekit_post_type' ,
364- 'googlesitekit_event_provider' ,
365- 'googlesitekit_form_id' ,
366- ] ,
367- } ) ;
358+ registry
359+ . dispatch ( MODULES_ANALYTICS_4 )
360+ . receiveGetCustomDimensions (
361+ [
362+ 'googlesitekit_post_date' ,
363+ 'googlesitekit_post_author' ,
364+ 'googlesitekit_post_categories' ,
365+ 'googlesitekit_post_type' ,
366+ 'googlesitekit_event_provider' ,
367+ 'googlesitekit_form_id' ,
368+ ] ,
369+ { propertyID }
370+ ) ;
368371 }
369372
370373 return (
@@ -376,6 +379,39 @@ WithSiteGoalsBreakdownsRowEnabled.decorators = [
376379] ;
377380WithSiteGoalsBreakdownsRowEnabled . scenario = { } ;
378381
382+ export const WithSiteGoalsBreakdownsRowNewProperty = Template . bind ( null ) ;
383+ WithSiteGoalsBreakdownsRowNewProperty . storyName =
384+ 'With Site Goals custom dimensions row and a new property' ;
385+ WithSiteGoalsBreakdownsRowNewProperty . parameters = {
386+ features : [ 'siteGoals' ] ,
387+ } ;
388+ WithSiteGoalsBreakdownsRowNewProperty . decorators = [
389+ ( Story ) => {
390+ function setupRegistry ( registry ) {
391+ registry
392+ . dispatch ( MODULES_ANALYTICS_4 )
393+ . receiveGetAdvancedDataBreakdownsSettings ( {
394+ [ propertyID ] : true ,
395+ } ) ;
396+ // Select "Set up a new property", which disables the Enable
397+ // button in the Advanced data breakdowns row.
398+ registry
399+ . dispatch ( MODULES_ANALYTICS_4 )
400+ . setPropertyID ( PROPERTY_CREATE ) ;
401+ registry
402+ . dispatch ( MODULES_ANALYTICS_4 )
403+ . setWebDataStreamID ( WEBDATASTREAM_CREATE ) ;
404+ }
405+
406+ return (
407+ < WithRegistrySetup func = { setupRegistry } >
408+ < Story />
409+ </ WithRegistrySetup >
410+ ) ;
411+ } ,
412+ ] ;
413+ WithSiteGoalsBreakdownsRowNewProperty . scenario = { } ;
414+
379415export default {
380416 title : 'Modules/Analytics4/Settings/SettingsEdit' ,
381417 decorators : [
0 commit comments