Skip to content

Commit 533abd1

Browse files
authored
Merge pull request #198 from moderntribe/feature/update-payment-wizards-ui
Payment wizards content and navigation tweaks
2 parents b986569 + eb5c821 commit 533abd1

File tree

6 files changed

+18
-41
lines changed

6 files changed

+18
-41
lines changed

packages/storebuilder/src/wizards/payments/paypal/PaymentsPaypalWizard.tsx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ interface OauthInterface {
1919
}
2020

2121
const PaymentsPaypalWizard = () => {
22-
const { currentStep, goToNextStep, closeAll } = useWizard();
22+
const { currentStep, goToNextStep, goToPreviousStep, closeAll } = useWizard();
2323
const { paymentsPaypalState: {
2424
steps,
2525
plan,
@@ -179,15 +179,6 @@ const PaymentsPaypalWizard = () => {
179179

180180
const stepsMax = steps.length;
181181

182-
let nextText = '';
183-
if (activeStep === 1) {
184-
nextText = __('Activate PayPal', 'moderntribe-storebuilder');
185-
} else if (activeStep === 2) {
186-
nextText = __('Next', 'moderntribe-storebuilder');
187-
} else {
188-
nextText = __('Complete', 'moderntribe-storebuilder');
189-
}
190-
191182
let errorComponent;
192183
if (activeStep === 1) {
193184
errorComponent = <ErrorPluginInstall supportLink={ supportLink } />;
@@ -244,7 +235,9 @@ const PaymentsPaypalWizard = () => {
244235
steps={ steps }
245236
save={ handleSave }
246237
onNext={ handleNext }
247-
nextText={ nextText }
238+
onBack={ goToPreviousStep }
239+
nextText={ steps[ stepIndex ].nextText }
240+
backText={ __('Back', 'moderntribe-storebuilder') }
248241
isLoading={ isLoading }
249242
loadingText={ __('Loading…', 'moderntribe-storebuilder') }
250243
disableNext={ error }

packages/storebuilder/src/wizards/payments/paypal/data/paypal-screen-data.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,13 @@ const PaymentsPaypalScreenData = (): PaymentsPaypalInterface => ({
6161
description: __('Nice! Now that you\'ve activated, we\'ve imported your keys here for you. These keys are specific to your account and will ensure you\'re all set to accept payments on your store.', 'moderntribe-storebuilder'),
6262
subtext: <img src={ ` ${ IMAGE_DIR }paypal-logo-alternative.png ` } width={ 90 } alt={ 'Paypal logo' } />,
6363
subtextIcon: null,
64-
nextText: __('Next', 'moderntribe-storebuilder'),
64+
nextText: __('Activate PayPal', 'moderntribe-storebuilder'),
65+
hideBack: true,
6566
screen: <AccountKeys />,
6667
},
6768
{
6869
id: 2,
69-
nextText: __('Complete', 'moderntribe-storebuilder'),
70+
nextText: __('Save & Complete', 'moderntribe-storebuilder'),
7071
title: __('You\'re ready to accept PayPal Payments on your Store!', 'moderntribe-storebuilder'),
7172
description: __('That was easy. Your PayPal account is connected. If you\'d like you can customize your PayPal settings further in the WordPress Admin.', 'moderntribe-storebuilder'),
7273
subtext: <img src={ ` ${ IMAGE_DIR }paypal-logo-alternative.png ` } width={ 90 } alt={ 'Paypal logo' } />,

packages/storebuilder/src/wizards/payments/stripe/PaymentsStripeWizard.tsx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { ErrorKeys } from '@payments/shared-screens';
1111
import { ErrorPluginInstall } from '@payments/stripe/screens';
1212

1313
const PaymentsStripeWizard = () => {
14-
const { goToNextStep, closeAll } = useWizard();
14+
const { goToNextStep, goToPreviousStep, closeAll } = useWizard();
1515
const { paymentsStripeState: {
1616
steps,
1717
pluginActive,
@@ -98,15 +98,6 @@ const PaymentsStripeWizard = () => {
9898

9999
const stepsMax = steps.length;
100100

101-
let nextText = '';
102-
if (activeStep === 1) {
103-
nextText = __('Connect Stripe', 'moderntribe-storebuilder');
104-
} else if (activeStep === 2) {
105-
nextText = __('Next', 'moderntribe-storebuilder');
106-
} else {
107-
nextText = __('Save & Complete', 'moderntribe-storebuilder');
108-
}
109-
110101
let errorComponent;
111102
if (activeStep === 1) {
112103
errorComponent = <ErrorPluginInstall supportLink={ supportLink } />;
@@ -163,8 +154,10 @@ const PaymentsStripeWizard = () => {
163154
activeStep={ stepIndex }
164155
steps={ steps }
165156
save={ handleSave }
157+
onBack={ goToPreviousStep }
166158
onNext={ handleNext }
167-
nextText={ nextText }
159+
nextText={ steps[ stepIndex ].nextText }
160+
backText={ __('Back', 'moderntribe-storebuilder') }
168161
isLoading={ isLoading }
169162
loadingText={ __('Loading…', 'moderntribe-storebuilder') }
170163
disableNext={ error }

packages/storebuilder/src/wizards/payments/stripe/data/constants.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import { __ } from '@wordpress/i18n';
22

33
export const paymentsStripeConsts = {
44
getStarted: {
5-
heading: __('Get started with Stripe', 'moderntribe-storebuilder'),
6-
copy: __('Connect or create a Stripe account to accept payments directly onsite, including Payment Request buttons (such as Apple Pay and Google Pay), iDEAL, SEPA, Sofort, and more international payment methods.', 'moderntribe-storebuilder'),
75
terms: __('By clicking "Connect Stripe", you agree to the Terms of Service.', 'moderntribe-storebuilder'),
86
label: __('Connect Your Account', 'moderntribe-storebuilder'),
97
stripeAlt: __('stripe logo', 'moderntribe-storebuilder')

packages/storebuilder/src/wizards/payments/stripe/data/stripe-screen-data.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const PaymentsStripeScreenData = (): PaymentsStripeInterface => ({
3333
id: 0,
3434
label: paymentsStripeConsts.getStarted.label,
3535
hideSkip: true,
36-
nextText: __('Next', 'moderntribe-storebuilder'),
36+
nextText: __('Connect Stripe', 'moderntribe-storebuilder'),
3737
hideBack: true,
3838
screen: <GetStarted />,
3939
},
@@ -45,6 +45,7 @@ const PaymentsStripeScreenData = (): PaymentsStripeInterface => ({
4545
subtext: <img src={ ` ${ IMAGE_DIR }stripe-logo-white.png ` } alt={ 'Stripe logo' } />,
4646
subtextIcon: null,
4747
nextText: __('Next', 'moderntribe-storebuilder'),
48+
hideBack: true,
4849
screen: <AccountKeys />,
4950
},
5051
{
@@ -53,7 +54,7 @@ const PaymentsStripeScreenData = (): PaymentsStripeInterface => ({
5354
description: __('That was easy. Your Stripe account is connected. You can manage your Stripe payment settings to configure checkout experience, transaction preferences and more.', 'moderntribe-storebuilder'),
5455
subtext: <img src={ ` ${ IMAGE_DIR }stripe-logo-white.png ` } alt={ 'Stripe logo' } />,
5556
subtextIcon: null,
56-
nextText: __('Complete', 'moderntribe-storebuilder'),
57+
nextText: __('Save & Complete', 'moderntribe-storebuilder'),
5758
hidePagination: true,
5859
screen: <Success />
5960
}

packages/storebuilder/src/wizards/payments/stripe/screens/AccountKeys.tsx

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useEffect, useState } from 'react';
2-
import { Box, useTheme, CircularProgress, Stack } from '@mui/material';
3-
import { WizardSectionTitle, Form, FormField, TextInput } from '@moderntribe/wme-ui';
2+
import { Box, CircularProgress, Stack } from '@mui/material';
3+
import { Form, FormField, TextInput } from '@moderntribe/wme-ui';
44
import { usePaymentsStripe } from '@store/hooks';
55
import { paymentsStripeConsts } from '../data/constants';
66
import { PAYMENTS_STRIPE_PROPS } from '@store/constants';
@@ -18,14 +18,11 @@ const AccountKeys = () => {
1818
const stripeNonce = PAYMENTS_STRIPE_PROPS.ajax.nonce || '';
1919
const stripeAction = PAYMENTS_STRIPE_PROPS.ajax.action || '';
2020
const { accountKeys: {
21-
heading,
22-
copy,
2321
livePublishableKey,
2422
liveSecretKey,
2523
livePublishableHelper,
2624
liveSecretHelper
2725
} } = paymentsStripeConsts;
28-
const theme = useTheme();
2926

3027
useEffect(() => {
3128
const fetchKeys = async () => {
@@ -55,16 +52,10 @@ const AccountKeys = () => {
5552
}, []);
5653

5754
return (
58-
<Box sx={ { maxWidth: 500 } }>
59-
<WizardSectionTitle
60-
heading={ heading }
61-
headingVariant={ 'h2' }
62-
copy={ copy }
63-
sx={ { mb: theme.spacing(5) } }
64-
/>
55+
<Box sx={ { maxWidth: 415, width: '100%' } }>
6556
{
6657
! isLoading
67-
? <Form>
58+
? <Form>
6859
<Stack spacing={ 2 }>
6960
<FormField
7061
field={ <TextInput

0 commit comments

Comments
 (0)