Skip to content

Commit

Permalink
Merge pull request #8948 from google/enhance/#8786-add-rrm-js-entry-p…
Browse files Browse the repository at this point in the history
…oint

Enhance/#8786 - Implement JS entry point for RRM
  • Loading branch information
techanvil committed Jul 3, 2024
2 parents 487efc3 + 180e164 commit 08388e7
Show file tree
Hide file tree
Showing 29 changed files with 960 additions and 3 deletions.
5 changes: 4 additions & 1 deletion assets/js/components/settings/SettingsActiveModule/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { useSelect } from 'googlesitekit-data';
import { Button } from 'googlesitekit-components';
import { CORE_MODULES } from '../../../googlesitekit/modules/datastore/constants';
import { EXPERIMENTAL_MODULES } from '../../dashboard-sharing/DashboardSharingSettings/constants';
import { NEW_MODULES } from '../constants';
import { Grid, Row, Cell } from '../../../material-components';
import { useKeyCodesInside } from '../../../hooks/useKeyCodesInside';
import ModuleIcon from '../../ModuleIcon';
Expand Down Expand Up @@ -180,7 +181,9 @@ export default function Header( { slug } ) {
hasLeftSpacing
/>
) }
{ slug === 'ads' && <NewBadge hasLeftSpacing /> }
{ NEW_MODULES.includes( slug ) && (
<NewBadge hasLeftSpacing />
) }
</div>
</Cell>

Expand Down
5 changes: 4 additions & 1 deletion assets/js/components/settings/SetupModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { CORE_SITE } from '../../googlesitekit/datastore/site/constants';
import { CORE_MODULES } from '../../googlesitekit/modules/datastore/constants';
import { CORE_LOCATION } from '../../googlesitekit/datastore/location/constants';
import { EXPERIMENTAL_MODULES } from '../dashboard-sharing/DashboardSharingSettings/constants';
import { NEW_MODULES } from './constants';
import { trackEvent } from '../../util';
import useViewContext from '../../hooks/useViewContext';

Expand Down Expand Up @@ -114,7 +115,9 @@ export default function SetupModule( { slug, name, description } ) {
label={ __( 'Experimental', 'google-site-kit' ) }
/>
) }
{ slug === 'ads' && <NewBadge hasNoSpacing /> }
{ NEW_MODULES.includes( slug ) && (
<NewBadge hasNoSpacing />
) }
</div>
</div>
<p className="googlesitekit-settings-connect-module__text">
Expand Down
19 changes: 19 additions & 0 deletions assets/js/components/settings/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Settings constants.
*
* Site Kit by Google, Copyright 2024 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.
*/

export const NEW_MODULES = [ 'ads', 'reader-revenue-manager' ];
30 changes: 30 additions & 0 deletions assets/js/googlesitekit-modules-reader-revenue-manager.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Reader Revenue Manager module entrypoint.
*
* Site Kit by Google, Copyright 2024 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 Data from 'googlesitekit-data';
import Modules from 'googlesitekit-modules';
import {
registerStore,
registerModule,
} from './modules/reader-revenue-manager';

registerStore( Data );
registerModule( Modules );
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* Reader Revenue Manager SettingsEdit component.
*
* Site Kit by Google, Copyright 2024 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';

export default function SettingsEdit() {
return (
<div className="googlesitekit-setup-module googlesitekit-setup-module--thank-with-google">
<h2 className="googlesitekit-heading-3 googlesitekit-setup-module__title">
{ __(
'Reader Revenue Manager Settings Edit',
'google-site-kit'
) }
</h2>

{ /* TODO: Add the rest of the settings steps */ }
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Reader Revenue Manager SettingsEdit component stories.
*
* Site Kit by Google, Copyright 2024 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 SettingsEdit from './SettingsEdit';

function Template() {
return <SettingsEdit />;
}

export const Default = Template.bind( {} );
Default.storyName = 'Default';

export default {
title: 'Modules/ReaderRevenueManager/Settings/SettingsEdit',
component: SettingsEdit,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Reader Revenue Manager SettingsEdit component tests.
*
* Site Kit by Google, Copyright 2024 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.
*/

import { render } from '../../../../../../tests/js/test-utils';
import SettingsEdit from './SettingsEdit';

describe( 'SettingsEdit', () => {
it( 'should render the component', () => {
const { getByText } = render( <SettingsEdit /> );

expect(
getByText( /Reader Revenue Manager Settings Edit/i )
).toBeInTheDocument();
} );
} );
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* Reader Revenue Manager SettingsView component.
*
* Site Kit by Google, Copyright 2024 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';

export default function SettingsView() {
return (
<div className="googlesitekit-setup-module googlesitekit-setup-module--thank-with-google">
<h2 className="googlesitekit-heading-3 googlesitekit-setup-module__title">
{ __(
'Reader Revenue Manager Settings View',
'google-site-kit'
) }
</h2>

{ /* TODO: Add the rest of the settings steps */ }
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Reader Revenue Manager SettingsView component stories.
*
* Site Kit by Google, Copyright 2024 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 SettingsView from './SettingsView';

function Template() {
return <SettingsView />;
}

export const Default = Template.bind( {} );
Default.storyName = 'Default';

export default {
title: 'Modules/ReaderRevenueManager/Settings/SettingsView',
component: SettingsView,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Reader Revenue Manager SettingsView component tests.
*
* Site Kit by Google, Copyright 2024 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.
*/

import { render } from '../../../../../../tests/js/test-utils';
import SettingsView from './SettingsView';

describe( 'SettingsView', () => {
it( 'should render the component', () => {
const { getByText } = render( <SettingsView /> );

expect(
getByText( /Reader Revenue Manager Settings View/i )
).toBeInTheDocument();
} );
} );
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Reader Revenue Manager Settings components.
*
* Site Kit by Google, Copyright 2024 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.
*/

export { default as SettingsEdit } from './SettingsEdit';
export { default as SettingsView } from './SettingsView';
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* Reader Revenue Manager SetupMain component.
*
* Site Kit by Google, Copyright 2024 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 { _x } from '@wordpress/i18n';

/**
* Internal dependencies
*/
import ReaderRevenueManagerIcon from '../../../../../svg/graphics/reader-revenue-manager.svg';

export default function SetupMain() {
return (
<div className="googlesitekit-setup-module googlesitekit-setup-module--reader-revenue-manager">
<div className="googlesitekit-setup-module__logo">
<ReaderRevenueManagerIcon width="33" height="33" />
</div>

<h2 className="googlesitekit-heading-3 googlesitekit-setup-module__title">
{ _x(
'Reader Revenue Manager',
'Service name',
'google-site-kit'
) }
</h2>

{ /* TODO: Add the rest of the setup steps */ }
</div>
);
}
Loading

0 comments on commit 08388e7

Please sign in to comment.