import React from 'react'; import { Icon, external } from '@wordpress/icons'; import { Label } from 'types'; import { trackingUrls } from '../../label-purchase/label/constants'; import { __, sprintf } from '@wordpress/i18n'; import './style.scss'; interface ShipmentTrackingLinkProps { label: Label; } export const ShipmentTrackingLink = ( { label, }: ShipmentTrackingLinkProps ) => { if ( ! label.tracking ) { return null; } const trackingUrl = label?.carrierId && label?.tracking ? trackingUrls[ label.carrierId ]?.( label.tracking ) : ''; if ( trackingUrl === '' ) { return { label.tracking }; } return (
{ !! label?.refund && ( { sprintf( // translators: %s: the status of the refund (e.g. "pending"). __( '[ Refund - %s ]', 'woocommerce-shipping' ), label.refund.status ) } ) } { label.tracking }
); };