Track site visibility setting actions (#46078)
* Track site visibility actions * Move private link text box to prevent accidental toggle * Add changefile(s) from automation for the following project(s): woocommerce * Restirct site visibility settings to general tab * Remove unnecessary site visibility render logic * Lint fix --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
parent
def3ac920d
commit
1907016893
|
@ -12,6 +12,7 @@ import { registerPlugin } from '@wordpress/plugins';
|
|||
import { __ } from '@wordpress/i18n';
|
||||
import classNames from 'classnames';
|
||||
import { useCopyToClipboard } from '@wordpress/compose';
|
||||
import { recordEvent } from '@woocommerce/tracks';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
@ -91,6 +92,9 @@ const SiteVisibility = () => {
|
|||
<RadioControl
|
||||
onChange={ () => {
|
||||
setComingSoon( 'yes' );
|
||||
recordEvent( 'site_visibility_toggle', {
|
||||
status: 'coming_soon',
|
||||
} );
|
||||
} }
|
||||
options={ [
|
||||
{
|
||||
|
@ -130,10 +134,16 @@ const SiteVisibility = () => {
|
|||
</>
|
||||
}
|
||||
checked={ storePagesOnly === 'yes' }
|
||||
onChange={ () => {
|
||||
onChange={ ( enabled ) => {
|
||||
setStorePagesOnly(
|
||||
storePagesOnly === 'yes' ? 'no' : 'yes'
|
||||
);
|
||||
recordEvent(
|
||||
'site_visibility_restrict_store_pages_only_toggle',
|
||||
{
|
||||
enabled,
|
||||
}
|
||||
);
|
||||
} }
|
||||
/>
|
||||
<ToggleControl
|
||||
|
@ -149,32 +159,46 @@ const SiteVisibility = () => {
|
|||
'woocommerce'
|
||||
) }
|
||||
</p>
|
||||
{ privateLink === 'yes' && (
|
||||
<div className="site-visibility-settings-slotfill-private-link">
|
||||
{ getPrivateLink() }
|
||||
<Button
|
||||
ref={ copyClipboardRef }
|
||||
variant="link"
|
||||
>
|
||||
{ copyLinkText }
|
||||
</Button>
|
||||
</div>
|
||||
) }
|
||||
</>
|
||||
}
|
||||
checked={ privateLink === 'yes' }
|
||||
onChange={ () => {
|
||||
onChange={ ( enabled ) => {
|
||||
setPrivateLink(
|
||||
privateLink === 'yes' ? 'no' : 'yes'
|
||||
);
|
||||
recordEvent(
|
||||
'site_visibility_share_private_link_toggle',
|
||||
{
|
||||
enabled,
|
||||
}
|
||||
);
|
||||
} }
|
||||
/>
|
||||
</div>
|
||||
{ privateLink === 'yes' && (
|
||||
<div className="site-visibility-settings-slotfill-private-link">
|
||||
{ getPrivateLink() }
|
||||
<Button
|
||||
ref={ copyClipboardRef }
|
||||
variant="link"
|
||||
onClick={ () => {
|
||||
recordEvent(
|
||||
'site_visibility_private_link_copy'
|
||||
);
|
||||
} }
|
||||
>
|
||||
{ copyLinkText }
|
||||
</Button>
|
||||
</div>
|
||||
) }
|
||||
</div>
|
||||
<div className="site-visibility-settings-slotfill-section">
|
||||
<RadioControl
|
||||
onChange={ () => {
|
||||
setComingSoon( 'no' );
|
||||
recordEvent( 'site_visibility_toggle', {
|
||||
status: 'live',
|
||||
} );
|
||||
} }
|
||||
options={ [
|
||||
{
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
}
|
||||
|
||||
.site-visibility-settings-slotfill-private-link {
|
||||
margin-left: 73px;
|
||||
padding: 8px 16px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #dcdcde;
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: update
|
||||
|
||||
Add tracks for site visibility settings
|
|
@ -37,13 +37,20 @@ class LaunchYourStore {
|
|||
'woocommerce_private_link' => array( 'yes', 'no' ),
|
||||
);
|
||||
|
||||
$at_least_one_saved = false;
|
||||
|
||||
foreach ( $options as $name => $option ) {
|
||||
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
||||
if ( isset( $_POST[ $name ] ) && in_array( $_POST[ $name ], $option, true ) ) {
|
||||
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
||||
update_option( $name, wp_unslash( $_POST[ $name ] ) );
|
||||
$at_least_one_saved = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $at_least_one_saved ) {
|
||||
wc_admin_record_tracks_event( 'site_visibility_saved' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue