Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6c49737
Add PolicyViolationNotification component for handling content policy…
hussain-t Jan 28, 2026
86ae0be
Add tests for PolicyViolationNotification component to validate rende…
hussain-t Jan 28, 2026
e90ce38
Add snapshot tests for PolicyViolationNotification component to verif…
hussain-t Jan 28, 2026
c241a48
Add new constants for policy violation notifications in the reader re…
hussain-t Jan 28, 2026
36a050c
Add PolicyViolationNotification export to dashboard module for conten…
hussain-t Jan 28, 2026
5797ff0
Add Storybook stories for PolicyViolationNotification component to sh…
hussain-t Jan 28, 2026
345b9d4
Update PolicyViolationNotification component and tests to use curly a…
hussain-t Jan 28, 2026
7940052
Register policy violation notifications for moderate/high and extreme…
hussain-t Jan 28, 2026
2bb508d
Merge branch 'develop' into enhancement/#12005-rrm-policy-violation-n…
hussain-t Jan 28, 2026
ca04336
Add reference images for PolicyViolationNotification component.
hussain-t Jan 28, 2026
e92aad9
Refactor PolicyViolationNotification component to utilize utility fun…
hussain-t Jan 29, 2026
de25ded
Add utility function to generate notification copy for policy violati…
hussain-t Jan 29, 2026
e4f7788
Add unit tests for getPolicyViolationNotificationCopy utility to vali…
hussain-t Jan 29, 2026
6900bd3
Refactor tests for PolicyViolationNotification to use getByRole for b…
hussain-t Jan 29, 2026
6e3a031
Add isShowingSuccessNotification function to manage setup success not…
hussain-t Jan 29, 2026
783bdcf
Merge branch 'develop' into enhancement/#12005-rrm-policy-violation-n…
hussain-t Jan 29, 2026
c58b0a2
Merge branch 'develop' into enhancement/#12005-rrm-policy-violation-n…
hussain-t Jan 29, 2026
c30b7d5
Remove getPolicyViolationNotificationCopy utility and its associated …
hussain-t Feb 2, 2026
95441e6
Move getPolicyViolationNotificationCopy utility and associated tests …
hussain-t Feb 2, 2026
0c46ccf
Remove individual PolicyViolationNotification component, its associat…
hussain-t Feb 2, 2026
7e66ca5
Movecomponent, tests, stories for PolicyViolationNotification to the …
hussain-t Feb 2, 2026
b150fbb
Rename the component, test and story files.
hussain-t Feb 2, 2026
da4a8b7
Remove PolicyViolationNotification component, its tests, and associat…
hussain-t Feb 2, 2026
693b0bf
Merge branch 'develop' into enhancement/#12005-rrm-policy-violation-n…
hussain-t Feb 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`PolicyViolationNotification should render error notification for immediate organization violation 1`] = `
<div>
<section
id="rrm-policy-violation-extreme-notification"
>
<div
class="mdc-layout-grid"
>
<div
class="mdc-layout-grid__inner"
>
<div
class="mdc-layout-grid__cell mdc-layout-grid__cell--align-middle mdc-layout-grid__cell--span-12"
>
<div
class="googlesitekit-notice-container"
>
<div
class="googlesitekit-notice googlesitekit-notice--error"
>
<div
class="googlesitekit-notice__icon"
>
<svg />
</div>
<div
class="googlesitekit-notice__content"
>
<p
class="googlesitekit-notice__title"
>
Action needed: Your Reader Revenue Manager account is terminated
</p>
<p
class="googlesitekit-notice__description"
>
Your account is terminated because your site content doesn’t follow the rules. Visit Publisher Center for more information.
</p>
</div>
<div
class="googlesitekit-notice__action"
>
<button
class="mdc-button mdc-button--tertiary"
target="_self"
>
<span
class="mdc-button__label"
>
Got it
</span>
</button>
<a
aria-label="Learn more (opens in a new tab)"
class="mdc-button googlesitekit-notice__cta googlesitekit-button-icon--spinner googlesitekit-button-icon--spinner__after mdc-button--raised"
href="https://accounts.google.com/accountchooser?continue=https%3A%2F%2Fexample.com%2Fpolicy-info%3Futm_source%3Dsitekit&Email=wapuu.wordpress%40gmail.com&utm_source=sitekit"
role="button"
target="_blank"
>
<span
class="mdc-button__label"
>
Learn more
</span>
<svg />
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
`;

exports[`PolicyViolationNotification should render warning notification for pending grace period violation 1`] = `
<div>
<section
id="rrm-policy-violation-moderate-high-notification"
>
<div
class="mdc-layout-grid"
>
<div
class="mdc-layout-grid__inner"
>
<div
class="mdc-layout-grid__cell mdc-layout-grid__cell--align-middle mdc-layout-grid__cell--span-12"
>
<div
class="googlesitekit-notice-container"
>
<div
class="googlesitekit-notice googlesitekit-notice--warning"
>
<div
class="googlesitekit-notice__icon"
>
<svg />
</div>
<div
class="googlesitekit-notice__content"
>
<p
class="googlesitekit-notice__title"
>
Action needed: fix a policy issue with Reader Revenue Manager
</p>
<p
class="googlesitekit-notice__description"
>
Your site has content that breaks the rules for Reader Revenue Manager. To keep your account active and CTAs public, you must resolve all policy violations.
</p>
</div>
<div
class="googlesitekit-notice__action"
>
<button
class="mdc-button mdc-button--tertiary"
target="_self"
>
<span
class="mdc-button__label"
>
Got it
</span>
</button>
<a
aria-label="View violations (opens in a new tab)"
class="mdc-button googlesitekit-notice__cta googlesitekit-button-icon--spinner googlesitekit-button-icon--spinner__after mdc-button--raised"
href="https://accounts.google.com/accountchooser?continue=https%3A%2F%2Fexample.com%2Fpolicy-info%3Futm_source%3Dsitekit&Email=wapuu.wordpress%40gmail.com&utm_source=sitekit"
role="button"
target="_blank"
>
<span
class="mdc-button__label"
>
View violations
</span>
<svg />
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/**
* Get notification copy utility tests.
*
* Site Kit by Google, Copyright 2026 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* Internal dependencies
*/
import { TYPES } from '@/js/components/Notice/constants';
import { CONTENT_POLICY_STATES } from '@/js/modules/reader-revenue-manager/datastore/constants';
import { getPolicyViolationNotificationCopy } from './get-policy-violation-notification-copy';

const {
CONTENT_POLICY_VIOLATION_GRACE_PERIOD,
CONTENT_POLICY_ORGANIZATION_VIOLATION_GRACE_PERIOD,
CONTENT_POLICY_VIOLATION_ACTIVE,
CONTENT_POLICY_ORGANIZATION_VIOLATION_ACTIVE,
CONTENT_POLICY_ORGANIZATION_VIOLATION_IMMEDIATE,
} = CONTENT_POLICY_STATES;

describe( 'getPolicyViolationNotificationCopy', () => {
it( 'should return the correct copy for content policy state `CONTENT_POLICY_ORGANIZATION_VIOLATION_IMMEDIATE`', () => {
const result = getPolicyViolationNotificationCopy(
CONTENT_POLICY_ORGANIZATION_VIOLATION_IMMEDIATE
);

expect( result ).toEqual( {
type: TYPES.ERROR,
title: 'Action needed: Your Reader Revenue Manager account is terminated',
description:
'Your account is terminated because your site content doesn’t follow the rules. Visit Publisher Center for more information.',
ctaLabel: 'Learn more',
} );
} );

it.each( [
[ CONTENT_POLICY_VIOLATION_ACTIVE ],
[ CONTENT_POLICY_ORGANIZATION_VIOLATION_ACTIVE ],
] )(
'should return the correct copy for content policy state %s',
( contentPolicyState ) => {
const result =
getPolicyViolationNotificationCopy( contentPolicyState );

expect( result ).toEqual( {
type: TYPES.WARNING,
title: 'Action needed: Your Reader Revenue Manager account is restricted',
description:
'Your site has content that doesn’t follow the rules. To see more details and resolve the violation, please visit Publisher Center.',
ctaLabel: 'View violations',
} );
}
);

it.each( [
[ CONTENT_POLICY_VIOLATION_GRACE_PERIOD ],
[ CONTENT_POLICY_ORGANIZATION_VIOLATION_GRACE_PERIOD ],
] )(
'should return the correct copy for content policy state %s',
( contentPolicyState ) => {
const result =
getPolicyViolationNotificationCopy( contentPolicyState );

expect( result ).toEqual( {
type: TYPES.WARNING,
title: 'Action needed: fix a policy issue with Reader Revenue Manager',
description:
'Your site has content that breaks the rules for Reader Revenue Manager. To keep your account active and CTAs public, you must resolve all policy violations.',
ctaLabel: 'View violations',
} );
}
);
} );
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/**
* Get notification copy utility.
*
* Site Kit by Google, Copyright 2026 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
*/
import { TYPES } from '@/js/components/Notice/constants';
import {
CONTENT_POLICY_STATES,
ACTIVE_POLICY_VIOLATION_STATES,
} from '@/js/modules/reader-revenue-manager/datastore/constants';

const { CONTENT_POLICY_ORGANIZATION_VIOLATION_IMMEDIATE } =
CONTENT_POLICY_STATES;

export interface NotificationCopy {
title: string;
description: string;
ctaLabel: string;
type: string;
}

/**
* Returns the notification copy based on the content policy state.
*
* @since n.e.x.t
*
* @param {string} contentPolicyState The content policy state.
* @return {Object} An object with title, description, ctaLabel, and type.
*/
export function getPolicyViolationNotificationCopy(
contentPolicyState: string
): NotificationCopy {
// Extreme severity - terminated account.
if (
contentPolicyState === CONTENT_POLICY_ORGANIZATION_VIOLATION_IMMEDIATE
) {
return {
title: __(
'Action needed: Your Reader Revenue Manager account is terminated',
'google-site-kit'
),
description: __(
'Your account is terminated because your site content doesn’t follow the rules. Visit Publisher Center for more information.',
'google-site-kit'
),
ctaLabel: __( 'Learn more', 'google-site-kit' ),
type: TYPES.ERROR,
};
}

// Active moderate/high severity - restricted account.
if ( ACTIVE_POLICY_VIOLATION_STATES.includes( contentPolicyState ) ) {
return {
title: __(
'Action needed: Your Reader Revenue Manager account is restricted',
'google-site-kit'
),
description: __(
'Your site has content that doesn’t follow the rules. To see more details and resolve the violation, please visit Publisher Center.',
'google-site-kit'
),
ctaLabel: __( 'View violations', 'google-site-kit' ),
type: TYPES.WARNING,
};
}

// Pending moderate/high severity - grace period (default for valid violation states).
return {
title: __(
'Action needed: fix a policy issue with Reader Revenue Manager',
'google-site-kit'
),
description: __(
'Your site has content that breaks the rules for Reader Revenue Manager. To keep your account active and CTAs public, you must resolve all policy violations.',
'google-site-kit'
),
ctaLabel: __( 'View violations', 'google-site-kit' ),
type: TYPES.WARNING,
};
}
Loading
Loading