From bfcce07cccc58e6c00b7d6f12574818bad571668 Mon Sep 17 00:00:00 2001 From: Enej Bajgoric Date: Tue, 25 Jun 2024 13:16:45 -0700 Subject: [PATCH] Add: Newsletter paid importer --- client/components/step-progress/style.scss | 1 + client/my-sites/importer/controller.js | 3 +- client/my-sites/importer/index.js | 2 +- .../my-sites/importer/newsletter/content.tsx | 20 ++++++ .../importer/newsletter/importer.scss | 54 ++++++++++++++++ .../my-sites/importer/newsletter/importer.tsx | 64 +++++++++++++++++++ .../importer/newsletter/paid-subscribers.tsx | 15 +++++ .../importer/newsletter/subscribers.tsx | 20 ++++++ .../my-sites/importer/newsletter/summary.tsx | 26 ++++++++ 9 files changed, 203 insertions(+), 2 deletions(-) create mode 100644 client/my-sites/importer/newsletter/content.tsx create mode 100644 client/my-sites/importer/newsletter/importer.scss create mode 100644 client/my-sites/importer/newsletter/importer.tsx create mode 100644 client/my-sites/importer/newsletter/paid-subscribers.tsx create mode 100644 client/my-sites/importer/newsletter/subscribers.tsx create mode 100644 client/my-sites/importer/newsletter/summary.tsx diff --git a/client/components/step-progress/style.scss b/client/components/step-progress/style.scss index e3a9697cbb2d3..dd8b4b87e0daa 100644 --- a/client/components/step-progress/style.scss +++ b/client/components/step-progress/style.scss @@ -41,6 +41,7 @@ font-style: normal; font-weight: normal; margin-top: 9px; + text-align: center; } .step-progress__element-button { diff --git a/client/my-sites/importer/controller.js b/client/my-sites/importer/controller.js index 725371861dde1..2e7d7c89ee124 100644 --- a/client/my-sites/importer/controller.js +++ b/client/my-sites/importer/controller.js @@ -6,6 +6,7 @@ import CaptureScreen from 'calypso/blocks/import/capture'; import ImporterList from 'calypso/blocks/import/list'; import { getFinalImporterUrl } from 'calypso/landing/stepper/declarative-flow/internals/steps-repository/import/helper'; import { decodeURIComponentIfValid } from 'calypso/lib/url'; +import NewsletterImporter from 'calypso/my-sites/importer/newsletter/importer'; import SectionImport from 'calypso/my-sites/importer/section-import'; import { getSelectedSiteSlug } from 'calypso/state/ui/selectors'; import 'calypso/blocks/import/style/base.scss'; @@ -107,7 +108,7 @@ export function importNewsletterSite( context, next ) { context.primary = ( -
Howdy substacker! { siteSlug }
+
); next(); diff --git a/client/my-sites/importer/index.js b/client/my-sites/importer/index.js index ef5fdc24b86d5..c12bf19553570 100644 --- a/client/my-sites/importer/index.js +++ b/client/my-sites/importer/index.js @@ -22,7 +22,7 @@ export default function () { ); page( - '/import/newsletter/substack/:site_id', + '/import/newsletter/substack/:site_id/:step?', siteSelection, navigation, redirectWithoutSite( '/import' ), diff --git a/client/my-sites/importer/newsletter/content.tsx b/client/my-sites/importer/newsletter/content.tsx new file mode 100644 index 0000000000000..38ab730a77d27 --- /dev/null +++ b/client/my-sites/importer/newsletter/content.tsx @@ -0,0 +1,20 @@ +import { Card, Button } from '@automattic/components'; + +export default function Content( { nextStepUrl } ) { + return ( + +

Step 1: Export your content from Substack

+

+ To generate a ZIP file of all your Substack posts, go to Settings { '>' } Exports and click + 'Create a new export.' Once the ZIP file is downloaded, upload it in the next step. +

+ +
+

Step 2: Import your content to WordPress.com (2/2)

+ { ' ' } + +
+ ); +} diff --git a/client/my-sites/importer/newsletter/importer.scss b/client/my-sites/importer/newsletter/importer.scss new file mode 100644 index 0000000000000..e9fc886be56c2 --- /dev/null +++ b/client/my-sites/importer/newsletter/importer.scss @@ -0,0 +1,54 @@ +.newsletter-importer { + margin: 0 auto; + max-width: 720px; + + .step-progress { + margin-bottom: 20px; + } + + .card { + h2 { + font-size: rem(16px); + font-weight: 500; + line-height: 19px; + letter-spacing: 0.15px; + padding-bottom: 20px; + } + + p { + font-size: rem(14px); + line-height: 20px; + color: var(--studio-gray-50); + } + + hr { + margin: 32px 0; + color: var(--studio-gray-5); + background-color: var(--studio-gray-5); + } + } +} + +.logo-chain { + display: flex; + justify-content: center; + margin-bottom: 20px; +} + +.logo-chain__logo { + width: 56px; + height: 56px; + margin: 0 -16px 0 0; + border-radius: 50%; + overflow: hidden; +} + +.logo-chain__logo .importer__service-icon.wordpress { + background-color: #3858e9; +} + +.logo-chain__logo .importer__service-icon.substack-logo { + width: 46px; + height: 46px; + margin-top: 5px; +} diff --git a/client/my-sites/importer/newsletter/importer.tsx b/client/my-sites/importer/newsletter/importer.tsx new file mode 100644 index 0000000000000..e513f735bc69c --- /dev/null +++ b/client/my-sites/importer/newsletter/importer.tsx @@ -0,0 +1,64 @@ +import { useTranslate } from 'i18n-calypso'; +import FormattedHeader from 'calypso/components/formatted-header'; +import StepProgress from 'calypso/components/step-progress'; +import ImporterLogo from '../importer-logo'; +import Content from './content'; +import PaidSubscribers from './paid-subscribers'; +import Subscribers from './subscribers'; +import Summary from './summary'; + +import './importer.scss'; + +function LogoChain( { logos } ) { + return ( +
+ { logos.map( ( logo ) => ( +
+ +
+ ) ) } +
+ ); +} + +const steps = [ Content, Subscribers, PaidSubscribers, Summary ]; + +const stepSlugs = [ 'content', 'subscribers', 'paid-subscribers', 'summary' ]; + +export default function NewsletterImporter( { siteSlug, engine, step } ) { + const translate = useTranslate(); + + const stepsProgress = [ + translate( 'Content' ), + translate( 'Subscribers' ), + translate( 'Paid Subscribers' ), + translate( 'Summary' ), + ]; + + let stepIndex = 0; + let nextStep = stepSlugs[ 1 ]; + stepSlugs.forEach( ( stepName, index ) => { + if ( stepName === step ) { + stepIndex = index; + nextStep = stepSlugs[ index + 1 ] ? stepSlugs[ index + 1 ] : stepSlugs[ index ]; + } + } ); + + const nextStepUrl = `/import/newsletter/${ engine }/${ siteSlug }/${ nextStep }`; + + const Step = steps[ stepIndex ] || steps[ 0 ]; + return ( +
+ + + + + +
+ ); +} diff --git a/client/my-sites/importer/newsletter/paid-subscribers.tsx b/client/my-sites/importer/newsletter/paid-subscribers.tsx new file mode 100644 index 0000000000000..d49246e47b4d7 --- /dev/null +++ b/client/my-sites/importer/newsletter/paid-subscribers.tsx @@ -0,0 +1,15 @@ +import { Card, Button } from '@automattic/components'; + +export default function PaidSubscribers( { nextStepUrl } ) { + return ( + +

Connect your Stripe account

+

+ To migrate your paid subscribers, ensure you're connecting the same Stripe account used with + your current provider. +

+ { ' ' } + +
+ ); +} diff --git a/client/my-sites/importer/newsletter/subscribers.tsx b/client/my-sites/importer/newsletter/subscribers.tsx new file mode 100644 index 0000000000000..a2bf7e9ddc676 --- /dev/null +++ b/client/my-sites/importer/newsletter/subscribers.tsx @@ -0,0 +1,20 @@ +import { Card, Button } from '@automattic/components'; + +export default function Subscribers( { nextStepUrl } ) { + return ( + +

Step 1: Export your subscribers from Substack

+

+ To generate a CSV file of all your Substack subscribers, go to the Subscribers tab and click + 'Export.' Once the CSV file is downloaded, upload it in the next step. +

+ +
+

Step 2: Import your subscribers to WordPress.com

+ { ' ' } + +
+ ); +} diff --git a/client/my-sites/importer/newsletter/summary.tsx b/client/my-sites/importer/newsletter/summary.tsx new file mode 100644 index 0000000000000..ee4ae8e875059 --- /dev/null +++ b/client/my-sites/importer/newsletter/summary.tsx @@ -0,0 +1,26 @@ +import { Card, ConfettiAnimation } from '@automattic/components'; +import { Icon } from '@wordpress/components'; + +export default function Summary() { + const prefersReducedMotion = window.matchMedia( '(prefers-reduced-motion: reduce)' ).matches; + + return ( + + +

Success!

+

Here's an overview of what you'll migrate:

+

+ + 47 posts +

+

+ + 99 subscribers +

+

+ + 17 17 paid subscribers +

+
+ ); +}