Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
cf6e831
Implement the RRM express setup dashboard entry point.
JakePT Jul 13, 2026
271c3a7
Fix failing Banner tests.
JakePT Jul 14, 2026
51a0db5
Improve CTA button loading behaviour.
JakePT Jul 14, 2026
ebbfd2b
Merge branch 'develop' into enhancement/12947-rrm-express-setup-entry.
nfmohit Jul 19, 2026
a8dde5a
Enhance module activation by adding support for `redirectQueryArgs`.
nfmohit Jul 19, 2026
81f1ff3
Apply suggestion from @nfmohit
JakePT Jul 20, 2026
3cde5cd
Merge branch 'develop' into enhancement/12947-rrm-express-setup-entry.
JakePT Jul 20, 2026
00ace2a
Address code review feedback.
JakePT Jul 20, 2026
d933ca9
Convert stories to TypeScript.
JakePT Jul 20, 2026
6773ada
Update assets/js/components/PoweredBy.tsx
JakePT Jul 22, 2026
1acab6f
Update assets/js/components/PoweredBy.stories.js
JakePT Jul 22, 2026
8d507c1
Update assets/js/components/PoweredBy.tsx
JakePT Jul 22, 2026
ab3d122
Update assets/js/googlesitekit/widgets/register-defaults.js
JakePT Jul 22, 2026
1735f51
Add PoweredByModule component, move setup CTA styles.
JakePT Jul 22, 2026
a3c980d
Improve typing of stories.
JakePT Jul 22, 2026
e61bc71
Correct component name.
JakePT Jul 22, 2026
af5343b
Type fixes.
JakePT Jul 22, 2026
8a6a78e
Merge branch 'develop' into enhancement/12947-rrm-express-setup-entry.
nfmohit Jul 23, 2026
f87e5fb
Address CR feedback.
nfmohit Jul 24, 2026
34dd345
Update assets/js/modules/reader-revenue-manager/widgets/index.ts
JakePT Jul 24, 2026
265b099
Update assets/js/modules/reader-revenue-manager/components/dashboard/…
JakePT Jul 24, 2026
8efcb4d
Consistent dismissing vars.
JakePT Jul 24, 2026
99120e7
Update component names and structure.
JakePT Jul 24, 2026
56ff75f
Move component to directory.
JakePT Jul 24, 2026
a67fc15
Update VRT references.
JakePT Jul 24, 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
Comment thread
nfmohit marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,40 @@
/**
* External dependencies
*/
import PropTypes from 'prop-types';
import { MouseEvent } from 'react';

/**
* Internal dependencies
*/
import { SpinnerButton } from 'googlesitekit-components';
import ExternalIcon from '@/svg/icons/external.svg';

export default function CTAButton( {
label,
ariaLabel,
disabled,
inProgress,
onClick,
href,
external = false,
hideExternalIndicator = false,
} ) {
// eslint-disable-next-line sitekit/acronym-case
export interface CTAButtonProps {
ariaLabel?: string;
disabled?: boolean;
external?: boolean;
hideExternalIndicator?: boolean;
href?: string;
inProgress?: boolean;
label?: string;
onClick?: (
event: MouseEvent< HTMLAnchorElement | HTMLButtonElement >
) => void;
}

export default function CTAButton(
{
ariaLabel,
disabled = false,
external = false,
hideExternalIndicator = false,
href,
inProgress = false,
label,
onClick = () => {},
}: CTAButtonProps /* eslint-disable-line sitekit/acronym-case */
) {
if ( ! label || ( ! onClick && ! href ) ) {
return null;
}
Expand All @@ -45,6 +61,7 @@ export default function CTAButton( {
}

return (
// @ts-expect-error `SpinnerButton` component is not yet typed.
<SpinnerButton
className="googlesitekit-banner__cta"
aria-label={ ariaLabel }
Expand All @@ -59,17 +76,3 @@ export default function CTAButton( {
</SpinnerButton>
);
}

CTAButton.propTypes = {
label: PropTypes.string,
ariaLabel: PropTypes.string,
disabled: PropTypes.bool,
inProgress: PropTypes.bool,
onClick: PropTypes.func,
href: PropTypes.string,
dismissOnClick: PropTypes.bool,
dismissOptions: PropTypes.shape( {
expiresInSeconds: PropTypes.number,
skipHidingFromQueue: PropTypes.bool,
} ),
};
Comment thread
nfmohit marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* External dependencies
*/
import PropTypes from 'prop-types';
import { MouseEvent, ReactNode } from 'react';

/**
* WordPress dependencies
Expand All @@ -29,18 +29,29 @@ import { __ } from '@wordpress/i18n';
*/
import { Button } from 'googlesitekit-components';

export interface DismissButtonProps {
Comment thread
nfmohit marked this conversation as resolved.
className?: string;
disabled?: boolean;
label?: ReactNode;
onClick?: (
event: MouseEvent< HTMLAnchorElement | HTMLButtonElement >
) => void;
tertiary?: boolean;
}

export default function DismissButton( {
className,
label = __( 'Maybe later', 'google-site-kit' ),
onClick,
disabled,
tertiary = true,
} ) {
}: DismissButtonProps ) {
if ( ! onClick ) {
return null;
}

return (
// @ts-expect-error `Button` component is not yet typed.
<Button
className={ className }
onClick={ onClick }
Expand All @@ -51,15 +62,3 @@ export default function DismissButton( {
</Button>
);
}

DismissButton.propTypes = {
className: PropTypes.string,
label: PropTypes.string,
onClick: PropTypes.func,
disabled: PropTypes.bool,
tertiary: PropTypes.bool,
dismissOptions: PropTypes.shape( {
expiresInSeconds: PropTypes.number,
skipHidingFromQueue: PropTypes.bool,
} ),
};
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* External dependencies
*/
import classnames from 'classnames';
import PropTypes from 'prop-types';
import { FC, ReactChild } from 'react';

/**
* WordPress dependencies
Expand All @@ -29,21 +29,41 @@ import { forwardRef } from '@wordpress/element';
* Internal dependencies
*/
import Notice from '@/js/components/Notice';
import { NOTICE_TYPES } from '@/js/components/Notice/constants';
import {
BREAKPOINT_SMALL,
BREAKPOINT_TABLET,
useBreakpoint,
} from '@/js/hooks/useBreakpoint';
import CTAButton from './CTAButton';
import CTAButton, { CTAButtonProps } from './CTAButton';
import Description from './Description';
import DismissButton from './DismissButton';
import DismissButton, { DismissButtonProps } from './DismissButton';
import Footer from './Footer';
import HelpText from './HelpText';
import LearnMoreLink from './LearnMoreLink';
import { LearnMoreLinkProps } from './LearnMoreLink';
import Title from './Title';
import TitleIcon from './TitleIcon';

const Banner = forwardRef(
export interface BannerProps {
className?: string;
titleIcon?: ReactChild;
title?: string;
description?: ReactChild;
additionalDescription?: ReactChild;
errorText?: string;
helpText?: string;
learnMoreLink?: LearnMoreLinkProps;
dismissButton?: DismissButtonProps;
ctaButton?: CTAButtonProps;
svg?: {
desktop?: string;
mobile?: string;
verticalPosition?: 'top' | 'center' | 'bottom';
};
footer?: ReactChild;
}

const Banner: FC< BannerProps > = forwardRef< HTMLDivElement, BannerProps >(
(
{
className,
Expand All @@ -65,7 +85,7 @@ const Banner = forwardRef(
const isMobileOrTablet =
breakpoint === BREAKPOINT_SMALL || breakpoint === BREAKPOINT_TABLET;

let SVGData = null;
let SVGData: string | null = null;
if ( isMobileOrTablet && svg?.mobile ) {
SVGData = svg.mobile;
} else if ( ! isMobileOrTablet && svg?.desktop ) {
Expand Down Expand Up @@ -93,7 +113,10 @@ const Banner = forwardRef(
{ helpText && <HelpText>{ helpText }</HelpText> }

{ errorText && (
<Notice type="error" description={ errorText } />
<Notice
type={ NOTICE_TYPES.ERROR }
description={ errorText }
/>
) }

<div className="googlesitekit-notice__action">
Expand Down Expand Up @@ -123,25 +146,4 @@ const Banner = forwardRef(
}
);

Banner.propTypes = {
titleIcon: PropTypes.node,
title: PropTypes.string,
description: PropTypes.oneOfType( [ PropTypes.string, PropTypes.node ] ),
additionalDescription: PropTypes.oneOfType( [
PropTypes.string,
PropTypes.node,
] ),
errorText: PropTypes.string,
helpText: PropTypes.string,
learnMoreLink: PropTypes.shape( LearnMoreLink.propTypes ),
dismissButton: PropTypes.shape( DismissButton.propTypes ),
ctaButton: PropTypes.shape( CTAButton.propTypes ),
svg: PropTypes.shape( {
desktop: PropTypes.elementType,
mobile: PropTypes.elementType,
verticalPosition: PropTypes.oneOf( [ 'top', 'center', 'bottom' ] ),
} ),
footer: PropTypes.node,
};

export default Banner;
69 changes: 69 additions & 0 deletions assets/js/components/PoweredByModule/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/**
* "Powered By Module" Component Stories.
*
* 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.
*/

/**
* External dependencies
*/
import { ReactElement } from 'react';

/**
* WordPress dependencies
*/
import { WPDataRegistry } from '@wordpress/data/build-types/registry';

/**
* Internal dependencies
*/
import PoweredByModule, {
PoweredByModuleProps,
} from '@/js/components/PoweredByModule';
import { MODULE_SLUG_READER_REVENUE_MANAGER } from '@/js/modules/reader-revenue-manager/constants';
import { Story } from '@/js/types/Story';
import { provideModuleRegistrations, provideModules } from '@tests/js/utils';
import WithRegistrySetup from '@tests/js/WithRegistrySetup';

function Template( args: PoweredByModuleProps ) {
return <PoweredByModule { ...args } />;
}

export const ReaderRevenueManager = Template.bind(
{}
) as Story< PoweredByModuleProps >;
ReaderRevenueManager.storyName = 'Reader Revenue Manager';
ReaderRevenueManager.args = {
slug: MODULE_SLUG_READER_REVENUE_MANAGER,
};

export default {
title: 'Components/PoweredByModule',
component: PoweredByModule,
decorators: [
( StoryComponent: () => ReactElement ) => {
function setupRegistry( registry: WPDataRegistry ) {
provideModules( registry );
provideModuleRegistrations( registry );
}

return (
<WithRegistrySetup func={ setupRegistry }>
<StoryComponent />
</WithRegistrySetup>
);
},
],
};
74 changes: 74 additions & 0 deletions assets/js/components/PoweredByModule/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/**
* PoweredByModule component.
*
* 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.
*/

/**
* External dependencies
*/
import classnames from 'classnames';

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

/**
* Internal dependencies
*/
import { Select, useSelect } from 'googlesitekit-data';
import Typography from '@/js/components/Typography';
import { SIZE_SMALL, TYPE_BODY } from '@/js/components/Typography/constants';
import { CORE_MODULES } from '@/js/googlesitekit/modules/datastore/constants';

export interface PoweredByModuleProps {
slug: string;
}

export default function PoweredByModule( { slug }: PoweredByModuleProps ) {
const { Icon, name } = useSelect(
( select: Select ) => select( CORE_MODULES ).getModule( slug ),
[ slug ]
);

const text = sprintf(
// translators: %s: Module name.
__( 'Powered by %s', 'google-site-kit' ),
name
);

const className = classnames(
'googlesitekit-powered-by-module',
`googlesitekit-powered-by-module--${ slug }`
);

return (
<div className={ className }>
<Icon
aria-hidden="true"
className="googlesitekit-powered-by-module__icon"
/>
<Typography
as="div"
className="googlesitekit-powered-by-module__text"
size={ SIZE_SMALL }
type={ TYPE_BODY }
>
{ text }
</Typography>
</div>
);
}
3 changes: 3 additions & 0 deletions assets/js/googlesitekit-modules-reader-revenue-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@
import Data from 'googlesitekit-data';
import Modules from 'googlesitekit-modules';
import Notifications from 'googlesitekit-notifications';
import Widgets from 'googlesitekit-widgets';
import {
registerModule,
registerNotifications,
registerStore,
registerWidgets,
} from './modules/reader-revenue-manager';

registerStore( Data );
registerModule( Modules );
registerWidgets( Widgets );
registerNotifications( Notifications );
Loading
Loading