-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add post-level RRM settings #9962
Comments
@aaemnnosttv Going back to our discussion regarding the settings in the block editor, we have two options:
In my PoC, I have added both options. IIRC, you were inclined towards option 1 as it has wider support. Just to confirm, should we go with option 1 and abandon option 2? Once I have some feedback on this, I'll draft the ACs accordingly and seek advice from Sigal and Mariya on the copy. Thank you! |
Update: Upon discussion on the above with @aaemnnosttv internally, we found ourselves inclined towards option 1 as it has wider support, and it also adds a dedicated place for Site Kit in the block editor for potential future field additions. I'll draft the ACs and seek assistance from Sigal regarding UX if required. |
@marrrmarrr I've co-assigned this to you in hopes of receiving feedback on the copy of the setting field in the ACs. These were drafted before your brilliant suggestions in #9961. I hope that is okay, thank you! 🙏 |
I'd suggest keeping consistent with the copy in the Categories page and adjusting it so it applies to posts, that way hopefully users understand the parallels between the two and that they're part of the same feature: Top heading: Decide how site visitors should access this post (if they will see CTAs by Reader Revenue Manager, which you activated via Site Kit):
Below the dropdown field: If you select a different option than the default, it will override any other settings you might have applied in Site Kit or in the Categories section. @nfmohit do you think these options would fit in the current design, or the copy is too long for the sidebar? |
Thank you for the excellent suggestions, @marrrmarrr! I've quickly used your suggested copy in my PoC and would like to demonstrate how it looks: They do fit, but I'm not sure they look great as the sidebar real-estate is quite shrinked. Let me know what you think, thank you! |
Hi @marrrmarrr , kind reminder for Nahid's question above. We are looking to get this ticket in the sprint as soon as possible. |
In the essence of timings, we're moving this forward as we should be able to update the copy at a later time, thank you Ivona and Mariya! |
Thanks @nfmohit for mocking this up and apologies for missing this earlier in the week. A couple of suggestions:
|
Thanks so much for the suggestions, @marrrmarrr! I have updated the ACs accordingly. CC: @techanvil |
@aaemnnosttv FYI, the minimum WP version for this feature had to be raised to 5.4, as not all minor versions of 5.3 supports the addition of the panel. Thanks! |
IB ✅Excellent IB and PoC, thank you @techanvil ! |
@ankitrox It might be worth waiting for #10046 to be merged as that already encapsulates a lot of the foundational pieces of work required for this issue. Besides, that also changes a bunch of files that we're planning to use here. @techanvil What do you think? CC: @ivonac4 |
Hey @ankitrox, I've merged this issue's PR, however please can you update the screenshot under point 3 of the QAB to reflect the updated styling to save any confusion. |
Thanks @techanvil . I've updated the screenshot and unassigned myself. |
That's great, thanks @ankitrox. |
Feature Description
As part of RRM Phase 2, the WordPress post editor will allow users to override the snippet configuration at the post level. This issue should implement the fields to allow the said configuration.
Example mock:

The select field having a label of “Product ID Override”* will reflect and change the value of the
googlesitekit_rrm_{Publication ID}:productID
post meta setting with the following options:productIDs
module setting.* The final version of the labels should be checked and confirmed with Sigal and Mariya.
As this will be rendered within the WordPress post editor, the new
googlesitekit-reader-revenue-manager-post-editor.js
JavaScript entry point should be used here.The
PluginDocumentSettingPanel
component from@wordpress/editor
should be used to compose a setting panel for Site Kit. It should use relevant components from@wordpress/components
to implement the necessary setting field.A PoC has already implemented this largely which can be used as a starting point.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
rrmModuleV2
feature flag is enabled, the Reader Revenue Manager module is connected, and the current user has access to the Reader Revenue Manager module:logo-g.svg
).Implementation Brief
Please refer to the updated PoC.
Webpack configuration
webpack/common.js
:@wordpress/components
,@wordpress/edit-post
and@wordpress/plugins
. These should be added tocorePackages
.googlesitekit-api
,googlesitekit-data
andgooglesitekit-modules
should be added togutenbergExternals
.webpack/adminCss.config.js
:./assets/sass/block-editor.scss
SASS file for block editor styling. This should be added as a new entry with the namegooglesitekit-block-editor-css
.Block editor SCSS file
assets/sass/block-editor.scss
, and another atassets/sass/components/reader-revenue-manager/_googlesitekit-rrm-block-editor.scss
whichblock-editor.scss
can include.Add/update Assets
includes/Modules/Reader_Revenue_Manager.php
:Stylesheet
asset for thegooglesitekit-block-editor-css.css
CSS file. Ensureload_contexts
isAsset::CONTEXT_ADMIN_POST_EDITOR
for the asset.googlesitekit-reader-revenue-manager-block-editor
asset:googlesitekit-data
,googlesitekit-i18n
andgooglesitekit-modules
dependencies.execution
is specified asdefer
- this is necessary to ensure that the store setup won't clash with the Admin Bar when that's loaded.Panel implementation
assets/js/googlesitekit-reader-revenue-manager-block-editor.js
:@wordpress-core/components
we are specifying the modules to be externals. We don't have these installed locally via NPM so it's necessary to disable theimport/no-unresolved
ESLint rule to avoid linting errors.googlesitekit-data
using the local version of@wordpress/element
(via the local@wordpress/data
), we can't useuseSelect()
, as this would try to use a different version of React compared to the external version that Gutenberg is using. We may introduce a version ofgooglesitekit-data
which uses the external@wordpress-core/data
but, if we do, this will be introduced at a later date as we need to spend some time figuring out the technical approach and implications. For the time being we simply avoid usinguseSelect()
in the RRM panel, fortunately it's quite a simple piece of UI code and this isn't a significant hindrance.Test Coverage
QA Brief
Install and activate Site Kit. Connect to RRM module and ensure that
rrmModule
andrrmModuleV2
flags are enabled.Go to Posts > Add new and ensure that Selection panel is visible in the block editor as shown in screenshot below.
Change the value in dropdown and it should show the helper text as mentioned in AC.
Save the value and it should save the value which should persist after the post is saved and refreshed.
Changelog entry
The text was updated successfully, but these errors were encountered: