Skip to content

Commit

Permalink
Adapt DomainOnlyThankYou to the Gravatar domain flow
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardost committed May 23, 2024
1 parent 702ad51 commit 81ecd54
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
8 changes: 5 additions & 3 deletions client/components/thank-you-v2/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ interface ThankYouV2Props {
products?: React.ReactElement | React.ReactElement[];
footerDetails?: ThankYouFooterDetailProps[];
upsellProps?: ThankYouUpsellProps;
isGravatarDomain?: boolean;
}

export default function ThankYouV2( props: ThankYouV2Props ) {
const { title, subtitle, headerButtons, products, footerDetails, upsellProps } = props;
const { title, subtitle, headerButtons, products, footerDetails, upsellProps, isGravatarDomain } =
props;

return (
<div className="thank-you">
Expand All @@ -26,9 +28,9 @@ export default function ThankYouV2( props: ThankYouV2Props ) {

{ products && <div className="thank-you__products">{ products }</div> }

{ footerDetails && <ThankYouFooter details={ footerDetails } /> }
{ footerDetails && ! isGravatarDomain && <ThankYouFooter details={ footerDetails } /> }

{ upsellProps && <ThankYouUpsell { ...upsellProps } /> }
{ upsellProps && ! isGravatarDomain && <ThankYouUpsell { ...upsellProps } /> }
</div>
);
}
8 changes: 7 additions & 1 deletion client/my-sites/checkout/checkout-thank-you/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,13 @@ export class CheckoutThankYou extends Component<
/>
);
} else if ( isOnlyDomainPurchases( purchases ) ) {
pageContent = <DomainOnlyThankYou purchases={ purchases } receiptId={ receiptId } />;
pageContent = (
<DomainOnlyThankYou
purchases={ purchases }
receiptId={ receiptId }
isGravatarDomain={ false }
/>
);
} else if ( purchases.length === 1 && isPlan( purchases[ 0 ] ) ) {
pageContent = (
<PlanOnlyThankYou
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,14 @@ function UpsellActions( {
interface DomainOnlyThankYouProps {
purchases: ReceiptPurchase[];
receiptId: number;
isGravatarDomain: boolean;
}

export default function DomainOnlyThankYou( { purchases, receiptId }: DomainOnlyThankYouProps ) {
export default function DomainOnlyThankYou( {
purchases,
receiptId,
isGravatarDomain,
}: DomainOnlyThankYouProps ) {
const translate = useTranslate();
const [ , predicate ] = getDomainPurchaseTypeAndPredicate( purchases );
const domainPurchases = purchases.filter( predicate );
Expand Down Expand Up @@ -101,6 +106,7 @@ export default function DomainOnlyThankYou( { purchases, receiptId }: DomainOnly
key={ `domain-${ purchase.meta }` }
siteSlug={ domainOnlySite?.slug }
isDomainOnly
isGravatarDomain={ isGravatarDomain }
/>
);
} );
Expand All @@ -121,6 +127,7 @@ export default function DomainOnlyThankYou( { purchases, receiptId }: DomainOnly
products={ products }
footerDetails={ getDomainFooterDetails( 'domain-only' ) }
upsellProps={ upsellProps }
isGravatarDomain={ isGravatarDomain }
/>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type ThankYouDomainProductProps = {
isDomainOnly?: boolean;
siteSlug?: string | null;
currency?: string;
isGravatarDomain?: boolean;
};

export default function ThankYouDomainProduct( {
Expand All @@ -48,6 +49,7 @@ export default function ThankYouDomainProduct( {
isDomainOnly,
siteSlug,
currency,
isGravatarDomain,
}: ThankYouDomainProductProps ) {
const translate = useTranslate();

Expand All @@ -62,6 +64,12 @@ export default function ThankYouDomainProduct( {

if ( purchase && isDomainTransfer( purchase ) ) {
actions = <DomainTransferSection purchase={ purchase } currency={ currency ?? 'USD' } />;
} else if ( isGravatarDomain ) {
actions = (
<Button variant="primary" href="https://gravatar.com/profile">
{ translate( 'Manage domain at Gravatar' ) }
</Button>
);
} else if ( purchase?.blogId && siteSlug ) {
const createSiteHref = siteSlug && createSiteFromDomainOnly( siteSlug, purchase.blogId );
const createSiteProps = createSiteHref ? { href: createSiteHref } : { disabled: true };
Expand Down

0 comments on commit 81ecd54

Please sign in to comment.