Skip to content
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

Add correct inquiry docs link to active dispute/inquiry notice in transactions screen #7277

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import { useDisputeAccept } from 'wcpay/data';
import {
getDisputeFeeFormatted,
isAwaitingResponse,

Check warning on line 31 in client/payment-details/dispute-details/dispute-awaiting-response-details.tsx

View workflow job for this annotation

GitHub Actions / JS linting

'isAwaitingResponse' is defined but never used
isInquiry,
} from 'wcpay/disputes/utils';
import { getAdminUrl } from 'wcpay/utils';
Expand Down Expand Up @@ -70,7 +70,7 @@
<CardBody className="transaction-details-dispute-details-body">
<DisputeNotice
dispute={ dispute }
urgent={ countdownDays <= 2 }
isUrgent={ countdownDays <= 2 }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've renamed this to isUrgent so it's super obvious it's a boolean. I'm not sure if we have a relevant guideline but this is common in WP code (is my understanding).

I saw isDismissible in block editor JS guidelines so this seems aligned with convention.

/>
{ hasStagedEvidence && (
<InlineNotice icon={ edit } isDismissible={ false }>
Expand Down
42 changes: 23 additions & 19 deletions client/payment-details/dispute-details/dispute-notice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,48 +18,52 @@

interface DisputeNoticeProps {
dispute: Dispute;
urgent: boolean;
isUrgent: boolean;
}

const DisputeNotice: React.FC< DisputeNoticeProps > = ( {
dispute,
urgent,
isUrgent,
} ) => {
const clientClaim =
const shopperDisputeReason =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed this, claim is less clear than dispute reason IMO. The claim is part of the reason, and we're displaying it in the UI as a reason as much as a "claim". We use reason more often so hopefully this is clearer.

reasons[ dispute.reason ]?.claim ??
__(
'The cardholder claims this is an unrecognized charge.',
'woocommerce-payments'
);

const noticeText = isInquiry( dispute )
? /* translators: <a> link to dispute documentation. %s is the clients claim for the dispute, eg "The cardholder claims this is an unrecognized charge." */
__(
// eslint-disable-next-line max-len
'<strong>%s</strong> You can challenge their claim if you believe it’s invalid. Not responding will result in an automatic loss. <a>Learn more</a>',
'woocommerce-payments'
)
: /* translators: <a> link to dispute documentation. %s is the clients claim for the dispute, eg "The cardholder claims this is an unrecognized charge." */
__(
// eslint-disable-next-line max-len
'<strong>%s</strong> Challenge the dispute if you believe the claim is invalid, or accept to forfeit the funds and pay the dispute fee. Non-response will result in an automatic loss. <a>Learn more about responding to disputes</a>',
'woocommerce-payments'
);
/* translators: <a> link to dispute documentation. %s is the clients claim for the dispute, eg "The cardholder claims this is an unrecognized charge." */
let noticeText = __(
'<strong>%s</strong> Challenge the dispute if you believe the claim is invalid, ' +
'or accept to forfeit the funds and pay the dispute fee. ' +

Check failure on line 38 in client/payment-details/dispute-details/dispute-notice.tsx

View workflow job for this annotation

GitHub Actions / JS linting

Insert `↹`
'Non-response will result in an automatic loss. <a>Learn more about responding to disputes</a>',

Check failure on line 39 in client/payment-details/dispute-details/dispute-notice.tsx

View workflow job for this annotation

GitHub Actions / JS linting

Insert `↹`
'woocommerce-payments'
);
let learnMoreDocsUrl = 'https://woocommerce.com/document/woopayments/fraud-and-disputes/managing-disputes/#section-3';

Check failure on line 42 in client/payment-details/dispute-details/dispute-notice.tsx

View workflow job for this annotation

GitHub Actions / JS linting

'learnMoreDocsUrl' is never reassigned. Use 'const' instead

Check failure on line 42 in client/payment-details/dispute-details/dispute-notice.tsx

View workflow job for this annotation

GitHub Actions / JS linting

Replace `·` with `⏎↹↹`

if ( isInquiry( dispute ) ) {
/* translators: <a> link to dispute inquiry documentation. %s is the clients claim for the dispute, eg "The cardholder claims this is an unrecognized charge." */
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block overrides the string + url for inquiries. Hopefully makes this easier to read/understand – default is dispute, details are overridden for inquiries.

noticeText = __(
'<strong>%s</strong> You can challenge their claim if you believe it’s invalid. ' +
'Not responding will result in an automatic loss. <a>Learn more</a>',

Check failure on line 48 in client/payment-details/dispute-details/dispute-notice.tsx

View workflow job for this annotation

GitHub Actions / JS linting

Insert `↹`
'woocommerce-payments'
)

Check failure on line 50 in client/payment-details/dispute-details/dispute-notice.tsx

View workflow job for this annotation

GitHub Actions / JS linting

Insert `;`
}

return (
<InlineNotice
icon
status={ urgent ? 'error' : 'warning' }
status={ isUrgent ? 'error' : 'warning' }
className="dispute-notice"
isDismissible={ false }
>
{ createInterpolateElement( sprintf( noticeText, clientClaim ), {
{ createInterpolateElement( sprintf( noticeText, shopperDisputeReason ), {

Check failure on line 60 in client/payment-details/dispute-details/dispute-notice.tsx

View workflow job for this annotation

GitHub Actions / JS linting

Replace `·sprintf(·noticeText,·shopperDisputeReason·),·` with `⏎↹↹↹↹sprintf(·noticeText,·shopperDisputeReason·),⏎↹↹↹↹`
a: (

Check failure on line 61 in client/payment-details/dispute-details/dispute-notice.tsx

View workflow job for this annotation

GitHub Actions / JS linting

Insert `↹`
// eslint-disable-next-line jsx-a11y/anchor-has-content

Check failure on line 62 in client/payment-details/dispute-details/dispute-notice.tsx

View workflow job for this annotation

GitHub Actions / JS linting

Insert `↹`
<a

Check failure on line 63 in client/payment-details/dispute-details/dispute-notice.tsx

View workflow job for this annotation

GitHub Actions / JS linting

Insert `↹`
target="_blank"
rel="noopener noreferrer"
href="https://woocommerce.com/document/woopayments/fraud-and-disputes/managing-disputes/#section-3"
href={ learnMoreDocsUrl }
/>
),
strong: <strong />,
Expand Down
Loading