Skip to content

update: settings pages to show external link #10779

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

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: update

update: merchant-facing pages to more easily show an external link (instead of a generic link), when it opens in a new tab; ensure that the ExternalLink component from the WP installation is used, instead of the bundled one
21 changes: 5 additions & 16 deletions client/components/account-balances/balance-tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import React from 'react';
import HelpOutlineIcon from 'gridicons/dist/help-outline';
import interpolateComponents from '@automattic/interpolate-components';
import { __ } from '@wordpress/i18n';
import { ExternalLink } from 'wcpay/components/wp-components-wrapped';

/**
* Internal dependencies
Expand Down Expand Up @@ -42,10 +43,7 @@ export const TotalBalanceTooltip: React.FC< TotalBalanceTooltipProps > = ( {
components: {
bold: <b />,
learnMoreLink: (
// eslint-disable-next-line jsx-a11y/anchor-has-content
<a
rel="external noopener noreferrer"
target="_blank"
<ExternalLink
href={
documentationUrls.depositSchedule
}
Expand All @@ -72,10 +70,7 @@ export const TotalBalanceTooltip: React.FC< TotalBalanceTooltipProps > = ( {
),
components: {
discoverWhyLink: (
// eslint-disable-next-line jsx-a11y/anchor-has-content
<a
rel="external noopener noreferrer"
target="_blank"
<ExternalLink
href={
documentationUrls.negativeBalance
}
Expand Down Expand Up @@ -111,10 +106,7 @@ export const AvailableBalanceTooltip: React.FC< AvailableBalanceTooltipProps > =
components: {
bold: <b />,
learnMoreLink: (
// eslint-disable-next-line jsx-a11y/anchor-has-content
<a
rel="external noopener noreferrer"
target="_blank"
<ExternalLink
href={
documentationUrls.depositSchedule
}
Expand All @@ -132,10 +124,7 @@ export const AvailableBalanceTooltip: React.FC< AvailableBalanceTooltipProps > =
),
components: {
discoverWhyLink: (
// eslint-disable-next-line jsx-a11y/anchor-has-content
<a
rel="external noopener noreferrer"
target="_blank"
<ExternalLink
href={
documentationUrls.negativeBalance
}
Expand Down
8 changes: 2 additions & 6 deletions client/components/account-balances/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import { Card, CardBody, CardHeader, Flex } from '@wordpress/components';
import { __, sprintf } from '@wordpress/i18n';
import interpolateComponents from '@automattic/interpolate-components';
import { Link } from '@woocommerce/components';

Check warning on line 8 in client/components/account-balances/index.tsx

View workflow job for this annotation

GitHub Actions / JS linting

'Link' is defined but never used
import { ExternalLink } from 'wcpay/components/wp-components-wrapped';

/**
* Internal dependencies
Expand Down Expand Up @@ -204,12 +205,7 @@
components: {
strong: <strong />,
learnMoreLink: (
<Link
href="https://woocommerce.com/document/woopayments/payouts/instant-payouts/"
target="_blank"
rel="noreferrer"
type="external"
/>
<ExternalLink href="https://woocommerce.com/document/woopayments/payouts/instant-payouts/" />
),
},
} )
Expand Down
34 changes: 5 additions & 29 deletions client/components/deposits-overview/deposit-notices.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React from 'react';
import { __, sprintf } from '@wordpress/i18n';
import interpolateComponents from '@automattic/interpolate-components';
import { Link } from '@woocommerce/components';
import { ExternalLink } from '@wordpress/components';
import { ExternalLink } from 'wcpay/components/wp-components-wrapped';
import { addQueryArgs } from '@wordpress/url';

/**
Expand Down Expand Up @@ -63,13 +63,7 @@ export const NewAccountWaitingPeriodNotice: React.FC = () => (
),
components: {
whyLink: (
// Link content is in the format string above. Consider disabling jsx-a11y/anchor-has-content.
// eslint-disable-next-line jsx-a11y/anchor-has-content
<a
target="_blank"
rel="noopener noreferrer"
href="https://woocommerce.com/document/woopayments/payouts/payout-schedule/#new-accounts"
/>
<ExternalLink href="https://woocommerce.com/document/woopayments/payouts/payout-schedule/#new-accounts" />
),
},
} ) }
Expand Down Expand Up @@ -97,13 +91,7 @@ export const NegativeBalanceDepositsPausedNotice: React.FC = () => (
),
components: {
whyLink: (
// Link content is in the format string above. Consider disabling jsx-a11y/anchor-has-content.
// eslint-disable-next-line jsx-a11y/anchor-has-content
<a
target="_blank"
rel="noopener noreferrer"
href="https://woocommerce.com/document/woopayments/fees-and-debits/account-showing-negative-balance/"
/>
<ExternalLink href="https://woocommerce.com/document/woopayments/fees-and-debits/account-showing-negative-balance/" />
),
},
} ) }
Expand Down Expand Up @@ -132,13 +120,7 @@ export const DepositMinimumBalanceNotice: React.FC< {
),
components: {
learnMoreLink: (
// Link content is in the format string above.
// eslint-disable-next-line jsx-a11y/anchor-has-content
<a
target="_blank"
rel="noopener noreferrer"
href="https://woocommerce.com/document/woopayments/payouts/payout-schedule/#minimum-payout-amounts"
/>
<ExternalLink href="https://woocommerce.com/document/woopayments/payouts/payout-schedule/#minimum-payout-amounts" />
),
},
} ) }
Expand All @@ -158,13 +140,7 @@ export const NoFundsAvailableForDepositNotice: React.FC = () => (
),
components: {
whyLink: (
// Link content is in the format string above. Consider disabling jsx-a11y/anchor-has-content.
// eslint-disable-next-line jsx-a11y/anchor-has-content
<a
target="_blank"
rel="noopener noreferrer"
href="https://woocommerce.com/document/woopayments/payouts/payout-schedule/#pending-funds"
/>
<ExternalLink href="https://woocommerce.com/document/woopayments/payouts/payout-schedule/#pending-funds" />
),
},
} ) }
Expand Down
6 changes: 2 additions & 4 deletions client/components/deposits-overview/deposit-schedule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { __, sprintf } from '@wordpress/i18n';
import interpolateComponents from '@automattic/interpolate-components';
import moment from 'moment';
import HelpOutlineIcon from 'gridicons/dist/help-outline';
import { ExternalLink } from 'wcpay/components/wp-components-wrapped';

/**
* Internal dependencies
Expand Down Expand Up @@ -125,10 +126,7 @@ const DepositSchedule: React.FC< DepositScheduleProps > = ( {
),
components: {
link: (
// eslint-disable-next-line jsx-a11y/anchor-has-content
<a
rel="external noopener noreferrer"
target="_blank"
<ExternalLink
href={
'https://woocommerce.com/document/woopayments/payouts/payout-schedule/'
}
Expand Down
6 changes: 2 additions & 4 deletions client/components/deposits-status/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import GridiconCheckmarkCircle from 'gridicons/dist/checkmark-circle';
import HelpOutlineIcon from 'gridicons/dist/help-outline';
import GridiconNotice from 'gridicons/dist/notice';
import { __, sprintf } from '@wordpress/i18n';
import { ExternalLink } from 'wcpay/components/wp-components-wrapped';
import interpolateComponents from '@automattic/interpolate-components';
import React from 'react';

Expand Down Expand Up @@ -92,14 +93,11 @@ const DepositsStatusSuspended: React.FC< DepositsStatusProps > = ( props ) => {
components: {
learnMoreLink: (
// eslint-disable-next-line jsx-a11y/anchor-has-content
<a
<ExternalLink
href={
// eslint-disable-next-line max-len
'https://woocommerce.com/document/woopayments/payouts/why-payouts-suspended/'
}
target="_blank"
rel="noreferrer"
type="external"
/>
),
},
Expand Down
14 changes: 3 additions & 11 deletions client/components/payment-activity/payment-activity-data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import moment from 'moment';
import { __ } from '@wordpress/i18n';
import HelpOutlineIcon from 'gridicons/dist/help-outline';
import interpolateComponents from '@automattic/interpolate-components';
import { ExternalLink } from 'wcpay/components/wp-components-wrapped';

/**
* Internal dependencies.
Expand Down Expand Up @@ -224,11 +225,7 @@ const PaymentActivityDataComponent: React.FC< Props > = ( {
strong: <strong />,
learnMoreLink: (
// eslint-disable-next-line jsx-a11y/anchor-has-content
<a
target="_blank"
rel="noopener noreferrer"
href="https://woocommerce.com/document/woopayments/fraud-and-disputes/"
/>
<ExternalLink href="https://woocommerce.com/document/woopayments/fraud-and-disputes/" />
),
},
} ) }
Expand Down Expand Up @@ -277,12 +274,7 @@ const PaymentActivityDataComponent: React.FC< Props > = ( {
components: {
strong: <strong />,
learnMoreLink: (
// eslint-disable-next-line jsx-a11y/anchor-has-content
<a
target="_blank"
rel="noopener noreferrer"
href="https://woocommerce.com/document/woopayments/fees-and-debits/fees/"
/>
<ExternalLink href="https://woocommerce.com/document/woopayments/fees-and-debits/fees/" />
),
},
} ) }
Expand Down
8 changes: 2 additions & 6 deletions client/components/payment-activity/survey/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Button, CardFooter, TextareaControl } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { createInterpolateElement, useState } from '@wordpress/element';
import { Icon, closeSmall } from '@wordpress/icons';
import { ExternalLink } from 'wcpay/components/wp-components-wrapped';

/**
* Internal dependencies.
Expand Down Expand Up @@ -157,12 +158,7 @@ const Survey: React.FC = () => {
),
{
a: (
// eslint-disable-next-line jsx-a11y/anchor-has-content
<a
href="https://automattic.com/privacy/"
target="_blank"
rel="noreferrer"
/>
<ExternalLink href="https://automattic.com/privacy/" />
),
}
) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,33 @@ exports[`WcPayOverviewSurveyContextProvider test survey with comments textbox 1`
>
Your feedback will be only be shared with WooCommerce and treated pursuant to our
<a
class="components-external-link"
href="https://automattic.com/privacy/"
rel="noreferrer"
rel="external noreferrer noopener"
target="_blank"
>
privacy policy
<span
class="components-visually-hidden css-1mm2cvy-View em57xhy0"
data-wp-c16t="true"
data-wp-component="VisuallyHidden"
style="border: 0px; clip: rect(1px, 1px, 1px, 1px); clip-path: inset( 50% ); height: 1px; margin: -1px; overflow: hidden; padding: 0px; position: absolute; width: 1px; word-wrap: normal;"
>
(opens in a new tab)
</span>
<svg
aria-hidden="true"
class="components-external-link__icon css-16iaek2-StyledIcon etxm6pv0"
focusable="false"
height="24"
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z"
/>
</svg>
</a>
.
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
*/
import BannerNotice from '../banner-notice';
import interpolateComponents from '@automattic/interpolate-components';
import { Link } from '@woocommerce/components';

Check warning on line 14 in client/components/sandbox-mode-switch-to-live-notice/index.tsx

View workflow job for this annotation

GitHub Actions / JS linting

'Link' is defined but never used
import { recordEvent } from 'wcpay/tracks';
import { ClickTooltip } from 'wcpay/components/tooltip';
import ErrorBoundary from 'wcpay/components/error-boundary';
import SetupLivePaymentsModal from './modal';
import './style.scss';
import { ExternalLink } from 'wcpay/components/wp-components-wrapped';

interface Props {
from: string;
Expand Down Expand Up @@ -82,15 +83,11 @@
),
components: {
learnMoreLink: (
// eslint-disable-next-line jsx-a11y/anchor-has-content
<Link
<ExternalLink
href={
// eslint-disable-next-line max-len
'https://woocommerce.com/document/woopayments/testing-and-troubleshooting/sandbox-mode/'
}
target="_blank"
rel="noreferrer"
type="external"
onClick={ () =>
recordEvent(
'wcpay_overview_sandbox_mode_learn_more_clicked'
Expand Down
9 changes: 2 additions & 7 deletions client/components/test-mode-notice/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { __, _n, sprintf } from '@wordpress/i18n';
import { getPaymentSettingsUrl, isInTestMode } from 'utils';
import BannerNotice from '../banner-notice';
import interpolateComponents from '@automattic/interpolate-components';
import { Link } from '@woocommerce/components';
import { recordEvent } from 'wcpay/tracks';
import { ExternalLink } from 'wcpay/components/wp-components-wrapped';

type CurrentPage =
| 'overview'
Expand Down Expand Up @@ -84,15 +84,10 @@ const getNoticeContent = (
components: {
strong: <strong />,
learnMoreLink: (
// Link content is in the format string above. Consider disabling jsx-a11y/anchor-has-content.
// eslint-disable-next-line jsx-a11y/anchor-has-content
<Link
<ExternalLink
href={
'https://woocommerce.com/document/woopayments/testing-and-troubleshooting/sandbox-mode/'
}
target="_blank"
rel="noreferrer"
type="external"
onClick={ () =>
recordEvent(
'wcpay_overview_test_mode_learn_more_clicked'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,33 @@ exports[`Test mode notification Returns valid component for overview page 1`] =
</strong>
All transactions will be simulated.
<a
data-link-type="external"
class="components-external-link"
href="https://woocommerce.com/document/woopayments/testing-and-troubleshooting/sandbox-mode/"
rel="noreferrer"
rel="external noreferrer noopener"
target="_blank"
>
Learn more
<span
class="components-visually-hidden css-1mm2cvy-View em57xhy0"
data-wp-c16t="true"
data-wp-component="VisuallyHidden"
style="border: 0px; clip: rect(1px, 1px, 1px, 1px); clip-path: inset( 50% ); height: 1px; margin: -1px; overflow: hidden; padding: 0px; position: absolute; width: 1px; word-wrap: normal;"
>
(opens in a new tab)
</span>
<svg
aria-hidden="true"
class="components-external-link__icon css-16iaek2-StyledIcon etxm6pv0"
focusable="false"
height="24"
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z"
/>
</svg>
</a>
</div>
</div>
Expand Down
Loading
Loading