Skip to content

Commit 4dbe299

Browse files
budzanowskiclaude
andcommitted
Remove opt-in/opt-out UI controls for product data sync
Removes user-facing controls for enabling/disabling the new product sync feature since it's now enabled by default with client credentials. ## Changes Made ### Removed UI Components: - "Disable product data fetch" button from Merchant Center account card - EnableNewProductSyncNotice banner from settings page - API_DATA_FETCH_FEATURE option from disconnect modal ### Preserved Functionality: - EnableNewProductSyncButton for "Grant access" during auth errors - Backend API endpoints for sync control - Both push and pull sync mechanisms - API-based configuration control ## Impact - Clean UI without confusing opt-in/opt-out controls - Sync functionality remains fully operational - Feature enabled by default with client credentials - API control still available for developers Addresses: INTEGRA-47 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 8355a47 commit 4dbe299

File tree

4 files changed

+1
-127
lines changed

4 files changed

+1
-127
lines changed

js/src/components/google-mc-account-card/merchant-center-account-info-card.js

Lines changed: 0 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
* External dependencies
33
*/
44
import { sprintf, __ } from '@wordpress/i18n';
5-
import { useState } from '@wordpress/element';
65
import { getSetting } from '@woocommerce/settings'; // eslint-disable-line import/no-unresolved
76
// The above is an unpublished package, delivered with WC, we use Dependency Extraction Webpack Plugin to import it.
87
// See https://github.com/woocommerce/woocommerce-admin/issues/7781
@@ -11,94 +10,24 @@ import { getSetting } from '@woocommerce/settings'; // eslint-disable-line impor
1110
* Internal dependencies
1211
*/
1312
import AccountCard, { APPEARANCE } from '~/components/account-card';
14-
import AppButton from '~/components/app-button';
1513
import ConnectedIconLabel from '~/components/connected-icon-label';
16-
import Section from '~/components/section';
1714
import { GOOGLE_WPCOM_APP_CONNECTED_STATUS } from '~/constants';
18-
import { API_NAMESPACE } from '~/data/constants';
19-
import useDispatchCoreNotices from '~/hooks/useDispatchCoreNotices';
20-
import useApiFetchCallback from '~/hooks/useApiFetchCallback';
21-
import { useAppDispatch } from '~/data';
2215
import EnableNewProductSyncButton from '~/components/enable-new-product-sync-button';
2316
import AppNotice from '~/components/app-notice';
24-
import DisconnectModal, {
25-
API_DATA_FETCH_FEATURE,
26-
} from '~/pages/settings/disconnect-modal';
27-
import { getSettingsUrl } from '~/utils/urls';
28-
import { recordGlaEvent } from '~/utils/tracks';
2917

3018
/**
3119
* @typedef {import('~/data/types.js').GoogleMCAccount} GoogleMCAccount
3220
*/
3321

34-
/**
35-
* Clicking on the button to disable the new product sync (API Pull).
36-
*
37-
* @event gla_disable_product_sync_click
38-
*/
39-
4022
/**
4123
* Renders a Google Merchant Center account card UI with connected account information.
4224
*
4325
* @param {Object} props React props.
4426
* @param {GoogleMCAccount} props.googleMCAccount A data payload object of Google Merchant Center account.
45-
*
46-
* @fires gla_disable_product_sync_click
4727
*/
4828
const MerchantCenterAccountInfoCard = ( { googleMCAccount } ) => {
49-
const { createNotice, removeNotice } = useDispatchCoreNotices();
50-
const { invalidateResolution } = useAppDispatch();
51-
52-
const [
53-
fetchDisableNotifications,
54-
{ loading: loadingDisableNotifications },
55-
] = useApiFetchCallback( {
56-
path: `${ API_NAMESPACE }/rest-api/authorize`,
57-
method: 'DELETE',
58-
} );
59-
60-
/**
61-
* Temporary code for disabling the API PULL Beta Feature from the GMC Card
62-
*/
63-
const [ openedModal, setOpenedModal ] = useState( null );
64-
const dismissModal = () => setOpenedModal( null );
65-
const openDisableDataFetchModal = () =>
66-
setOpenedModal( API_DATA_FETCH_FEATURE );
67-
6829
const domain = new URL( getSetting( 'homeUrl' ) ).host;
6930

70-
const disableNotifications = async () => {
71-
recordGlaEvent( 'gla_disable_product_sync_click' );
72-
73-
const { notice } = await createNotice(
74-
'info',
75-
__(
76-
'Disabling the new Product Sync feature, please wait…',
77-
'google-listings-and-ads'
78-
)
79-
);
80-
81-
try {
82-
await fetchDisableNotifications();
83-
invalidateResolution( 'getGoogleMCAccount', [] );
84-
} catch ( error ) {
85-
createNotice(
86-
'error',
87-
__(
88-
'Unable to disable new product sync. Please try again later.',
89-
'google-listings-and-ads'
90-
)
91-
);
92-
}
93-
94-
removeNotice( notice.id );
95-
};
96-
97-
// Show the button if the status is "approved".
98-
const showDisconnectNotificationsButton =
99-
googleMCAccount.wpcom_rest_api_status ===
100-
GOOGLE_WPCOM_APP_CONNECTED_STATUS.APPROVED;
101-
10231
// Show the error if the status is set but is not "approved".
10332
const showErrorNotificationsNotice =
10433
googleMCAccount.wpcom_rest_api_status &&
@@ -126,14 +55,6 @@ const MerchantCenterAccountInfoCard = ( { googleMCAccount } ) => {
12655
)
12756
}
12857
>
129-
{ showDisconnectNotificationsButton && (
130-
<AppNotice status="success" isDismissible={ false }>
131-
{ __(
132-
'Google has been granted access to fetch your product data.',
133-
'google-listings-and-ads'
134-
) }
135-
</AppNotice>
136-
) }
13758

13859
{ showErrorNotificationsNotice && (
13960
<AppNotice status="warning" isDismissible={ false }>
@@ -143,32 +64,6 @@ const MerchantCenterAccountInfoCard = ( { googleMCAccount } ) => {
14364
) }
14465
</AppNotice>
14566
) }
146-
147-
{ openedModal && (
148-
<DisconnectModal
149-
onRequestClose={ dismissModal }
150-
onDisconnected={ () => {
151-
window.location.href = getSettingsUrl();
152-
} }
153-
disconnectTarget={ openedModal }
154-
disconnectAction={ disableNotifications }
155-
/>
156-
) }
157-
158-
{ showDisconnectNotificationsButton && (
159-
<Section.Card.Footer>
160-
<AppButton
161-
isDestructive
162-
isLink
163-
disabled={ loadingDisableNotifications }
164-
text={ __(
165-
'Disable product data fetch',
166-
'google-listings-and-ads'
167-
) }
168-
onClick={ openDisableDataFetchModal }
169-
/>
170-
</Section.Card.Footer>
171-
) }
17267
</AccountCard>
17368
);
17469
};

js/src/pages/settings/disconnect-modal/confirm-modal.js

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import AppModal from '~/components/app-modal';
1212
import AppButton from '~/components/app-button';
1313
import WarningIcon from '~/components/warning-icon';
1414
import { useAppDispatch } from '~/data';
15-
import { ALL_ACCOUNTS, ADS_ACCOUNT, API_DATA_FETCH_FEATURE } from './constants';
15+
import { ALL_ACCOUNTS, ADS_ACCOUNT } from './constants';
1616

1717
const textDict = {
1818
[ ALL_ACCOUNTS ]: {
@@ -66,24 +66,6 @@ const textDict = {
6666
),
6767
],
6868
},
69-
[ API_DATA_FETCH_FEATURE ]: {
70-
title: __( 'Disable data fetching', 'google-listings-and-ads' ),
71-
confirmButton: __( 'Disable data fetching', 'google-listings-and-ads' ),
72-
confirmation: __(
73-
'Yes, I want to disable the data fetching feature.',
74-
'google-listings-and-ads'
75-
),
76-
contents: [
77-
__(
78-
'I understand that I am disabling the data fetching feature from this WooCommerce extension.',
79-
'google-listings-and-ads'
80-
),
81-
__(
82-
'Any ongoing campaigns and configuration will continue to run. They will be pushed to Google as in the previous versions of this extension.',
83-
'google-listings-and-ads'
84-
),
85-
],
86-
},
8769
};
8870

8971
export default function ConfirmModal( {
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
export const ALL_ACCOUNTS = 'all-accounts';
22
export const ADS_ACCOUNT = 'ads-account';
3-
export const API_DATA_FETCH_FEATURE = 'api-data-fetch-feature';

js/src/pages/settings/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import LinkedAccounts from './linked-accounts';
1818
import ReconnectWPComAccount from './reconnect-wpcom-account';
1919
import ReconnectGoogleAccount from './reconnect-google-account';
2020
import EditStoreAddress from './edit-store-address';
21-
import EnableNewProductSyncNotice from '~/components/enable-new-product-sync-notice';
2221
import MainTabNav from '~/components/main-tab-nav';
2322
import RebrandingTour from '~/components/tours/rebranding-tour';
2423
import './index.scss';
@@ -62,7 +61,6 @@ const Settings = () => {
6261

6362
return (
6463
<div className={ pageClassName }>
65-
<EnableNewProductSyncNotice />
6664
<MainTabNav />
6765
<RebrandingTour />
6866
<ContactInformationPreview />

0 commit comments

Comments
 (0)