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

Jetpack Connect: add a separate notice for WP.com sites purchasing Search #41257

Merged
merged 2 commits into from
Apr 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions client/jetpack-connect/connection-notice-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const ALREADY_OWNED = 'alreadyOwned';
export const DEFAULT_AUTHORIZE_ERROR = 'defaultAuthorizeError';
export const INSTALL_RESPONSE_ERROR = 'unableToInstall';
export const IS_DOT_COM = 'isDotCom';
export const IS_DOT_COM_GET_SEARCH = 'isDotComGetSearch';
export const JETPACK_IS_DISCONNECTED = 'jetpackIsDisconnected';
export const JETPACK_IS_VALID = 'jetpackIsValid';
export const LOGIN_FAILURE = 'loginFailure';
Expand Down
10 changes: 10 additions & 0 deletions client/jetpack-connect/jetpack-connect-notices.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
INSTALL_RESPONSE_ERROR,
INVALID_CREDENTIALS,
IS_DOT_COM,
IS_DOT_COM_GET_SEARCH,
JETPACK_IS_DISCONNECTED,
JETPACK_IS_VALID,
NOT_ACTIVE_JETPACK,
Expand Down Expand Up @@ -49,6 +50,7 @@ export class JetpackConnectNotices extends Component {
INSTALL_RESPONSE_ERROR,
INVALID_CREDENTIALS,
IS_DOT_COM,
IS_DOT_COM_GET_SEARCH,
JETPACK_IS_DISCONNECTED,
JETPACK_IS_VALID,
NOT_ACTIVE_JETPACK,
Expand Down Expand Up @@ -105,6 +107,14 @@ export class JetpackConnectNotices extends Component {
noticeValues.text = translate( 'Good news! WordPress.com sites already have Jetpack.' );
return noticeValues;

case IS_DOT_COM_GET_SEARCH:
noticeValues.status = 'is-success';
noticeValues.icon = 'status';
noticeValues.text = translate(
'Good news! Jetpack Search is coming soon to WordPress.com sites.'
);
return noticeValues;

case NOT_WORDPRESS:
noticeValues.icon = 'block';
noticeValues.text = translate( "That's not a WordPress site." );
Expand Down
10 changes: 9 additions & 1 deletion client/jetpack-connect/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import config from 'config';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { concat, flowRight, get, includes } from 'lodash';
import { concat, flowRight, get, includes, startsWith } from 'lodash';
import { localize } from 'i18n-calypso';

/**
Expand All @@ -33,6 +33,7 @@ import { isRequestingSites } from 'state/sites/selectors';
import { persistSession, retrieveMobileRedirect } from './persistence-utils';
import { recordTracksEvent } from 'state/analytics/actions';
import { urlToSlug } from 'lib/url';

import {
JPC_PATH_PLANS,
JPC_PATH_REMOTE_INSTALL,
Expand All @@ -43,6 +44,7 @@ import {
ALREADY_CONNECTED,
ALREADY_OWNED,
IS_DOT_COM,
IS_DOT_COM_GET_SEARCH,
NOT_ACTIVE_JETPACK,
NOT_CONNECTED_JETPACK,
NOT_EXISTS,
Expand Down Expand Up @@ -284,7 +286,13 @@ export class JetpackConnectMain extends Component {
) {
return WORDPRESS_DOT_COM;
}

if ( this.checkProperty( 'isWordPressDotCom' ) ) {
const product = window.location.href.split( '/' )[ 5 ];

if ( startsWith( product, 'jetpack_search' ) ) {
return IS_DOT_COM_GET_SEARCH;
}
return IS_DOT_COM;
}
if ( ! this.checkProperty( 'exists' ) ) {
Expand Down