-
Notifications
You must be signed in to change notification settings - Fork 800
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'trunk' into add/protect-fixer-status-to-initial-state
- Loading branch information
Showing
39 changed files
with
665 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...test-results-to-slack/changelog/update-github-actions-test-results-to-slack-readme-scopes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: patch | ||
Type: added | ||
|
||
Document required Slack scopes. |
4 changes: 4 additions & 0 deletions
4
projects/js-packages/licensing/changelog/update-license-activate-error-messages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: minor | ||
Type: changed | ||
|
||
Add more helpful error messages and help steps on license key activation error. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
projects/js-packages/licensing/components/activation-screen-error/constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export const LICENSE_ERRORS = { | ||
NOT_SAME_OWNER: '[not_same_owner]', | ||
ACTIVE_ON_SAME_SITE: '[active_on_same_site]', | ||
ATTACHED_LICENSE: '[attached_license]', | ||
PRODUCT_INCOMPATIBILITY: '[product_incompatibility]', | ||
REVOKED_LICENSE: '[revoked_license]', | ||
INVALID_INPUT: '[invalid_input]', | ||
MULTISITE_INCOMPATIBILITY: '[multisite_incompatibility]', | ||
} as const; |
52 changes: 52 additions & 0 deletions
52
projects/js-packages/licensing/components/activation-screen-error/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import jetpackAnalytics from '@automattic/jetpack-analytics'; | ||
import { Icon, warning, check } from '@wordpress/icons'; | ||
import React, { useEffect } from 'react'; | ||
import { LICENSE_ERRORS } from './constants'; | ||
import { useGetErrorContent } from './use-get-error-content'; | ||
import type { FC } from 'react'; | ||
|
||
import './style.scss'; | ||
|
||
type LicenseErrorKeysType = keyof typeof LICENSE_ERRORS; | ||
type LicenseErrorValuesType = ( typeof LICENSE_ERRORS )[ LicenseErrorKeysType ]; | ||
|
||
interface Props { | ||
licenseError: string; | ||
errorType: LicenseErrorValuesType; | ||
} | ||
|
||
const ActivationScreenError: FC< Props > = ( { licenseError, errorType } ) => { | ||
useEffect( () => { | ||
if ( licenseError ) { | ||
jetpackAnalytics.tracks.recordEvent( 'jetpack_wpa_license_activation_error_view', { | ||
error: licenseError, | ||
error_type: errorType, | ||
} ); | ||
} | ||
}, [ licenseError, errorType ] ); | ||
|
||
const { errorMessage, errorInfo } = useGetErrorContent( licenseError, errorType ); | ||
|
||
if ( ! licenseError ) { | ||
return null; | ||
} | ||
|
||
const { ACTIVE_ON_SAME_SITE } = LICENSE_ERRORS; | ||
const isLicenseAlreadyAttached = ACTIVE_ON_SAME_SITE === errorType; | ||
|
||
const errorMessageClass = isLicenseAlreadyAttached | ||
? 'activation-screen-error__message--success' | ||
: 'activation-screen-error__message--error'; | ||
|
||
return ( | ||
<> | ||
<div className={ `activation-screen-error__message ${ errorMessageClass }` }> | ||
<Icon icon={ isLicenseAlreadyAttached ? check : warning } size={ 20 } /> | ||
<span>{ errorMessage }</span> | ||
</div> | ||
{ errorInfo && <div className="activation-screen-error__info">{ errorInfo }</div> } | ||
</> | ||
); | ||
}; | ||
|
||
export default ActivationScreenError; |
75 changes: 75 additions & 0 deletions
75
projects/js-packages/licensing/components/activation-screen-error/style.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
.activation-screen-error__message { | ||
display: flex; | ||
flex-direction: row; | ||
align-items: flex-start; | ||
max-width: 500px; | ||
margin-top: calc(var(--spacing-base)*.5); | ||
|
||
svg { | ||
margin-left: -3px; | ||
} | ||
|
||
span { | ||
font-size: 13px; | ||
line-height: 20px; | ||
font-weight: 500; | ||
letter-spacing: -0.044em; | ||
} | ||
} | ||
|
||
.activation-screen-error__message--error { | ||
color: var(--jp-red); | ||
svg { | ||
fill: var(--jp-red); | ||
} | ||
} | ||
|
||
.activation-screen-error__message--success { | ||
color: var(--jp-green); | ||
svg { | ||
fill: var(--jp-green); | ||
} | ||
} | ||
|
||
.activation-screen-error__info { | ||
background-color: var(--jp-gray-0); | ||
color: var(--jp-gray-80); | ||
font-size: var(--font-body-small); | ||
line-height: calc(var(--font-title-small) - 2px); | ||
border: 1px solid var(--jp-green-0); | ||
border-radius: var(--jp-border-radius); | ||
padding: var(--jp-modal-padding-small); | ||
margin: 32px 0 8px; | ||
|
||
> p { | ||
margin: 0 0 1em; | ||
font-size: var(--font-body-small); | ||
} | ||
> p:last-child { | ||
margin-bottom: 0; | ||
} | ||
|
||
ol > li::marker { | ||
font-weight: bold; | ||
} | ||
|
||
a { | ||
color: var(--jp-green-50); | ||
} | ||
a:hover, | ||
a:active { | ||
color: var(--jp-green-70); | ||
} | ||
} | ||
|
||
.jp-license-activation-screen-controls { | ||
.activation-screen-error__info { | ||
> p { | ||
margin: 0 0 1em; | ||
font-size: var(--font-body-small); | ||
} | ||
> p:last-child { | ||
margin-bottom: 0; | ||
} | ||
} | ||
} |
Oops, something went wrong.