Skip to content
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

Display notice when user has unactivated product license keys #21474

Merged
merged 41 commits into from
Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
e8697bd
Display notice when user has any detached licenses.
elliottprogrammer Oct 20, 2021
1e5b1ac
Add changlog files.
elliottprogrammer Oct 20, 2021
8c6abe3
Update packages to use jetpack-api 0.4.1-alpha.
elliottprogrammer Oct 20, 2021
fd0dafa
Merge branch 'master' into add/user-license-activate-notice-2
elliottprogrammer Oct 20, 2021
2797957
Implement custom dismiss/show behavior on the notice.
elliottprogrammer Oct 27, 2021
82aac36
Merge remote-tracking branch 'origin/master' into add/user-license-ac…
elliottprogrammer Oct 27, 2021
3e51a93
Fix project versions.
elliottprogrammer Oct 27, 2021
bfbef9f
Add `plugins/boost` changelog ?
elliottprogrammer Oct 27, 2021
4a8c361
Remove moment.js because build errors, use javascript Date instead.
elliottprogrammer Oct 28, 2021
772f680
Merge remote-tracking branch 'origin/master' into add/user-license-ac…
elliottprogrammer Oct 28, 2021
9daed08
fix project versions.
elliottprogrammer Oct 28, 2021
30f126d
Merge remote-tracking branch 'origin/master' into add/user-license-ac…
elliottprogrammer Oct 28, 2021
440b442
update packages versions.
elliottprogrammer Oct 28, 2021
dd24b0a
Remove extra changelogs.
elliottprogrammer Oct 28, 2021
4f98862
Convert to function component - UserLicenseActivationNotice.
elliottprogrammer Nov 2, 2021
55b38ee
Replace static admin link with `siteAdminUrl` prop.
elliottprogrammer Nov 2, 2021
89f0e9d
Use 'Jetpack_Options' wrapper, as opposed to the standard WordPress O…
elliottprogrammer Nov 2, 2021
e5fec30
Increase restrictions in user-licensing REST API permission callbacks.
elliottprogrammer Nov 2, 2021
e2c2f6b
Remove un-necessary 'plugins/boost' changelog entry.
elliottprogrammer Nov 2, 2021
9f5bda8
Add changelog entry for 'packages/options'.
elliottprogrammer Nov 2, 2021
683b02e
Merge remote-tracking branch 'origin/master' into add/user-license-ac…
elliottprogrammer Nov 2, 2021
4b49fd0
Update package dependencies.
elliottprogrammer Nov 2, 2021
dba965a
Add rest api user_licensing_permission_check()
elliottprogrammer Nov 3, 2021
28a2ae3
Move 'get_license_activation_notice_dismiss()' to Licensing package.
elliottprogrammer Nov 3, 2021
fc4d2be
Just some straightening up, in class.core-rest-api-endpoints.php.
elliottprogrammer Nov 3, 2021
e2c854c
Add changelog entry to packages/licensing.
elliottprogrammer Nov 3, 2021
8fa8335
Update project versions.
elliottprogrammer Nov 3, 2021
9a91281
Merge remote-tracking branch 'origin/master' into add/user-license-ac…
elliottprogrammer Nov 3, 2021
37a006b
composer update plugins/jetpack
elliottprogrammer Nov 3, 2021
8cd0bd2
pnpm update
elliottprogrammer Nov 3, 2021
3ad69b6
Return $notice_data instead of fetching option.
elliottprogrammer Nov 4, 2021
f6da031
[not verified] Update licensing activation-notice tracks events.
elliottprogrammer Nov 4, 2021
0a8fa53
Merge remote-tracking branch 'origin/master' into add/user-license-ac…
elliottprogrammer Nov 4, 2021
5f0e80b
Fix eslint react-hooks/exhaustive-deps.
elliottprogrammer Nov 4, 2021
cae743c
Merge remote-tracking branch 'origin/master' into add/user-license-ac…
elliottprogrammer Nov 10, 2021
c366564
update project/package versions.
elliottprogrammer Nov 10, 2021
26d64db
update project/package versions.
elliottprogrammer Nov 10, 2021
ee99032
Merge remote-tracking branch 'origin/master' into add/user-license-ac…
elliottprogrammer Nov 10, 2021
9952f86
Fix changelogs "type" property to "changed" for validity pass.
elliottprogrammer Nov 10, 2021
898a885
Remove accidental root dev dependency jetpack-e2e-commons.
elliottprogrammer Nov 11, 2021
0ae4232
Merge remote-tracking branch 'origin/master' into add/user-license-ac…
elliottprogrammer Nov 11, 2021
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
34 changes: 24 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions projects/js-packages/api/changelog/update-user-license-counts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: added

Add updateUserLicensesCounts API method
12 changes: 12 additions & 0 deletions projects/js-packages/api/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,18 @@ function JetpackRestApiClient( root, nonce ) {
.then( checkStatus )
.then( parseJsonResponse ),

getUserLicensesCounts: () =>
getRequest( `${ apiRoot }jetpack/v4/licensing/user/counts`, getParams )
.then( checkStatus )
.then( parseJsonResponse ),

updateLicensingActivationNoticeDismiss: lastDetachedCount =>
postRequest( `${ apiRoot }jetpack/v4/licensing/user/activation-notice-dismiss`, postParams, {
body: JSON.stringify( { last_detached_count: lastDetachedCount } ),
} )
.then( checkStatus )
.then( parseJsonResponse ),

updateRecommendationsStep: step =>
postRequest( `${ apiRoot }jetpack/v4/recommendations/step`, postParams, {
body: JSON.stringify( { step } ),
Expand Down
2 changes: 1 addition & 1 deletion projects/js-packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@automattic/jetpack-api",
"version": "0.5.0",
"version": "0.5.1-alpha",
"description": "Jetpack Api Package",
"author": "Automattic",
"license": "GPL-2.0-or-later",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Updated package dependencies.
4 changes: 2 additions & 2 deletions projects/js-packages/connection/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@automattic/jetpack-connection",
"version": "0.9.0",
"version": "0.9.1-alpha",
"description": "Jetpack Connection Component",
"author": "Automattic",
"license": "GPL-2.0-or-later",
"dependencies": {
"@automattic/jetpack-api": "workspace:^0.5.0",
"@automattic/jetpack-api": "workspace:^0.5.1-alpha",
"@automattic/jetpack-components": "workspace:^0.5.0",
"@wordpress/base-styles": "4.0.2",
"@wordpress/browserslist-config": "4.1.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Updated package dependencies.
2 changes: 1 addition & 1 deletion projects/js-packages/idc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Automattic",
"license": "GPL-2.0-or-later",
"dependencies": {
"@automattic/jetpack-api": "workspace:^0.5.0",
"@automattic/jetpack-api": "workspace:^0.5.1-alpha",
"@automattic/jetpack-components": "workspace:^0.5.0",
"@wordpress/base-styles": "4.0.2",
"@wordpress/components": "19.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Updated package dependencies.
2 changes: 1 addition & 1 deletion projects/js-packages/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"devDependencies": {
"@automattic/jetpack-base-styles": "workspace:^0.1.0-alpha",
"@automattic/jetpack-components": "workspace:^0.5.0",
"@automattic/jetpack-connection": "workspace:^0.9.0",
"@automattic/jetpack-connection": "workspace:^0.9.1-alpha",
"@babel/core": "7.15.0",
"@babel/plugin-syntax-jsx": "7.14.5",
"@babel/runtime-corejs3": "7.15.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Updated package dependencies.
4 changes: 2 additions & 2 deletions projects/packages/connection-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
},
"dependencies": {
"@automattic/calypso-build": "9.0.0",
"@automattic/jetpack-api": "workspace:^0.5.0",
"@automattic/jetpack-connection": "workspace:^0.9.0",
"@automattic/jetpack-api": "workspace:^0.5.1-alpha",
"@automattic/jetpack-connection": "workspace:^0.9.1-alpha",
"@automattic/jetpack-idc": "workspace:^0.4.2-alpha",
"@babel/core": "7.15.0",
"@babel/helper-module-imports": "7.14.5",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: added

Added get_license_activation_notice_dismiss() function.
2 changes: 1 addition & 1 deletion projects/packages/licensing/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"link-template": "https://github.com/Automattic/jetpack-licensing/compare/v${old}...v${new}"
},
"branch-alias": {
"dev-master": "1.4.x-dev"
"dev-master": "1.5.x-dev"
}
}
}
20 changes: 20 additions & 0 deletions projects/packages/licensing/src/class-licensing.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,4 +249,24 @@ public static function is_licensing_input_enabled() {
*/
return apply_filters( 'jetpack_licensing_ui_enabled', false ) && current_user_can( 'jetpack_connect_user' );
}

/**
* Gets the user-licensing activation notice dismissal info.
*
* @since 10.4.0
* @return array
*/
public function get_license_activation_notice_dismiss() {

$default = array(
'last_detached_count' => null,
'last_dismissed_time' => null,
);

if ( $this->connection()->is_user_connected() && $this->connection()->is_connection_owner() ) {
return Jetpack_Options::get_option( 'licensing_activation_notice_dismiss', $default );
}

return $default;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: added

Added Jetpack Option 'licensing_activation_notice_dismiss'.
57 changes: 29 additions & 28 deletions projects/packages/options/legacy/class-jetpack-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,34 +92,35 @@ public static function get_option_names( $type = 'compact' ) {
}

return array(
'id', // (int) The Client ID/WP.com Blog ID of this site.
'publicize_connections', // (array) An array of Publicize connections from WordPress.com.
'master_user', // (int) The local User ID of the user who connected this site to jetpack.wordpress.com.
'version', // (string) Used during upgrade procedure to auto-activate new modules. version:time.
'old_version', // (string) Used to determine which modules are the most recently added. previous_version:time.
'fallback_no_verify_ssl_certs', // (int) Flag for determining if this host must skip SSL Certificate verification due to misconfigured SSL.
'time_diff', // (int) Offset between Jetpack server's clocks and this server's clocks. Jetpack Server Time = time() + (int) Jetpack_Options::get_option( 'time_diff' )
'public', // (int|bool) If we think this site is public or not (1, 0), false if we haven't yet tried to figure it out.
'videopress', // (array) VideoPress options array.
'is_network_site', // (int|bool) If we think this site is a network or a single blog (1, 0), false if we haven't yet tried to figue it out.
'social_links', // (array) The specified links for each social networking site.
'identity_crisis_whitelist', // (array) An array of options, each having an array of the values whitelisted for it.
'gplus_authors', // (array) The Google+ authorship information for connected users.
'last_heartbeat', // (int) The timestamp of the last heartbeat that fired.
'hide_jitm', // (array) A list of just in time messages that we should not show because they have been dismissed by the user.
'custom_css_4.7_migration', // (bool) Whether Custom CSS has scanned for and migrated any legacy CSS CPT entries to the new Core format.
'image_widget_migration', // (bool) Whether any legacy Image Widgets have been converted to the new Core widget.
'gallery_widget_migration', // (bool) Whether any legacy Gallery Widgets have been converted to the new Core widget.
'sso_first_login', // (bool) Is this the first time the user logins via SSO.
'dismissed_hints', // (array) Part of Plugin Search Hints. List of cards that have been dismissed.
'first_admin_view', // (bool) Set to true the first time the user views the admin. Usually after the initial connection.
'setup_wizard_questionnaire', // (array) (DEPRECATED) List of user choices from the setup wizard.
'setup_wizard_status', // (string) (DEPRECATED) Status of the setup wizard.
'licensing_error', // (string) Last error message occurred while attaching licenses that is yet to be surfaced to the user.
'recommendations_banner_dismissed', // (bool) Determines if the recommendations dashboard banner is dismissed or not.
'recommendations_banner_enabled', // (bool) Whether the recommendations are enabled or not.
'recommendations_data', // (array) The user choice and other data for the recommendations.
'recommendations_step', // (string) The current step of the recommendations.
'id', // (int) The Client ID/WP.com Blog ID of this site.
'publicize_connections', // (array) An array of Publicize connections from WordPress.com.
'master_user', // (int) The local User ID of the user who connected this site to jetpack.wordpress.com.
'version', // (string) Used during upgrade procedure to auto-activate new modules. version:time.
'old_version', // (string) Used to determine which modules are the most recently added. previous_version:time.
'fallback_no_verify_ssl_certs', // (int) Flag for determining if this host must skip SSL Certificate verification due to misconfigured SSL.
'time_diff', // (int) Offset between Jetpack server's clocks and this server's clocks. Jetpack Server Time = time() + (int) Jetpack_Options::get_option( 'time_diff' )
'public', // (int|bool) If we think this site is public or not (1, 0), false if we haven't yet tried to figure it out.
'videopress', // (array) VideoPress options array.
'is_network_site', // (int|bool) If we think this site is a network or a single blog (1, 0), false if we haven't yet tried to figue it out.
'social_links', // (array) The specified links for each social networking site.
'identity_crisis_whitelist', // (array) An array of options, each having an array of the values whitelisted for it.
'gplus_authors', // (array) The Google+ authorship information for connected users.
'last_heartbeat', // (int) The timestamp of the last heartbeat that fired.
'hide_jitm', // (array) A list of just in time messages that we should not show because they have been dismissed by the user.
'custom_css_4.7_migration', // (bool) Whether Custom CSS has scanned for and migrated any legacy CSS CPT entries to the new Core format.
'image_widget_migration', // (bool) Whether any legacy Image Widgets have been converted to the new Core widget.
'gallery_widget_migration', // (bool) Whether any legacy Gallery Widgets have been converted to the new Core widget.
'sso_first_login', // (bool) Is this the first time the user logins via SSO.
'dismissed_hints', // (array) Part of Plugin Search Hints. List of cards that have been dismissed.
'first_admin_view', // (bool) Set to true the first time the user views the admin. Usually after the initial connection.
'setup_wizard_questionnaire', // (array) (DEPRECATED) List of user choices from the setup wizard.
'setup_wizard_status', // (string) (DEPRECATED) Status of the setup wizard.
'licensing_error', // (string) Last error message occurred while attaching licenses that is yet to be surfaced to the user.
'recommendations_banner_dismissed', // (bool) Determines if the recommendations dashboard banner is dismissed or not.
'recommendations_banner_enabled', // (bool) Whether the recommendations are enabled or not.
'recommendations_data', // (array) The user choice and other data for the recommendations.
'recommendations_step', // (string) The current step of the recommendations.
'licensing_activation_notice_dismiss', // (array) The `last_detached_count` and the `last_dismissed_time` for the user-license activation notice.
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Updated package dependencies.
4 changes: 2 additions & 2 deletions projects/plugins/backup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
"extends @wordpress/browserslist-config"
],
"dependencies": {
"@automattic/jetpack-api": "workspace:^0.5.0",
"@automattic/jetpack-api": "workspace:^0.5.1-alpha",
"@automattic/jetpack-components": "workspace:^0.5.0",
"@automattic/jetpack-connection": "workspace:^0.9.0",
"@automattic/jetpack-connection": "workspace:^0.9.1-alpha",
"@wordpress/api-fetch": "5.2.4",
"@wordpress/data": "6.1.2",
"@wordpress/date": "4.2.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { getRedirectUrl } from '@automattic/jetpack-components';
*/
import ConnectionBanner from 'components/connection-banner';
import DismissableNotices from './dismissable';
import UserLicenseActivationNotice from './user-license-activation';
import {
getSiteConnectionStatus,
getSiteOfflineMode,
Expand Down Expand Up @@ -276,6 +277,7 @@ class JetpackNotices extends React.Component {
onDismissClick={ this.props.clearLicensingError }
/>
) }
<UserLicenseActivationNotice />
jeherve marked this conversation as resolved.
Show resolved Hide resolved
</div>
);
}
Expand Down
Loading