Skip to content

Commit

Permalink
Merge branch 'trunk' of github.com:woocommerce/woocommerce into 45711…
Browse files Browse the repository at this point in the history
…-cys-header-and-footer-disappear
  • Loading branch information
gigitux committed Mar 20, 2024
2 parents 8f1ee0d + fa49848 commit aaee897
Show file tree
Hide file tree
Showing 40 changed files with 314 additions and 263 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { Button } from '@wordpress/components';
import classnames from 'classnames';
import { addQueryArgs } from '@wordpress/url';
import { useSelect } from '@wordpress/data';
import { ONBOARDING_STORE_NAME } from '@woocommerce/data';

/**
* Internal dependencies
Expand Down Expand Up @@ -68,6 +69,14 @@ export default function Products( props: ProductsProps ) {
page: 'wc-admin',
path: '/customize-store/design',
} );
const assemblerHubUrl = addQueryArgs( `${ ADMIN_URL }admin.php`, {
page: 'wc-admin',
path: '/customize-store/assembler-hub',
} );

const customizeStoreTask = useSelect( ( select ) => {
return select( ONBOARDING_STORE_NAME ).getTask( 'customize-store' );
}, [] );

// Only show the "View all" button when on search but not showing a specific section of results.
const showAllButton = props.showAllButton ?? false;
Expand Down Expand Up @@ -155,6 +164,8 @@ export default function Products( props: ProductsProps ) {
onClick={ () => {
if ( ! isDefaultTheme ) {
setIsModalOpen( true );
} else if ( customizeStoreTask?.isComplete ) {
window.location.href = assemblerHubUrl;
} else {
window.location.href = customizeStoreDesignUrl;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/woocommerce-blocks/assets/css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ body.wc-block-product-gallery-modal-open {
line-height: 1.618;
font-size: 1em;
/* stylelint-disable-next-line font-family-no-missing-generic-family-keyword */
font-family: star;
font-family: WooCommerce;
font-weight: 400;
margin: 0 auto;
text-align: left;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
line-height: 1.618;
font-size: 1em;
/* stylelint-disable-next-line font-family-no-missing-generic-family-keyword */
font-family: star;
font-family: WooCommerce;
font-weight: 400;

&::before {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
line-height: 1.618;
font-size: 1em;
/* stylelint-disable-next-line font-family-no-missing-generic-family-keyword */
font-family: star;
font-family: WooCommerce;
font-weight: 400;
text-align: left;

Expand Down Expand Up @@ -74,7 +74,7 @@
line-height: 1.618;
font-size: 1em;
/* stylelint-disable-next-line font-family-no-missing-generic-family-keyword */
font-family: star;
font-family: WooCommerce;
font-weight: 400;
-webkit-text-stroke: 2px var(--wp--preset--color--black, #000);
&::before {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const TotalsFooterItem = ( {

const priceComponent = (
<FormattedMonetaryAmount
className="wc-block-components-totals-item__value"
className="wc-block-components-totals-footer-item-tax-value"
currency={ currency }
value={ parseInt( totalPrice, 10 ) }
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ exports[`TotalsFooterItem Does not show the "including %s of tax" line if tax is
>
Total
</span>
<span
class="wc-block-formatted-money-amount wc-block-components-formatted-money-amount wc-block-components-totals-item__value"
<div
class="wc-block-components-totals-item__value"
>
£85.00
</span>
<span
class="wc-block-formatted-money-amount wc-block-components-formatted-money-amount wc-block-components-totals-footer-item-tax-value"
>
£85.00
</span>
</div>
<div
class="wc-block-components-totals-item__description"
/>
Expand All @@ -32,11 +36,15 @@ exports[`TotalsFooterItem Does not show the "including %s of tax" line if tax is
>
Total
</span>
<span
class="wc-block-formatted-money-amount wc-block-components-formatted-money-amount wc-block-components-totals-item__value"
<div
class="wc-block-components-totals-item__value"
>
£85.00
</span>
<span
class="wc-block-formatted-money-amount wc-block-components-formatted-money-amount wc-block-components-totals-footer-item-tax-value"
>
£85.00
</span>
</div>
<div
class="wc-block-components-totals-item__description"
/>
Expand All @@ -54,11 +62,15 @@ exports[`TotalsFooterItem Shows the "including %s TAX LABEL" line with single ta
>
Total
</span>
<span
class="wc-block-formatted-money-amount wc-block-components-formatted-money-amount wc-block-components-totals-item__value"
<div
class="wc-block-components-totals-item__value"
>
£85.00
</span>
<span
class="wc-block-formatted-money-amount wc-block-components-formatted-money-amount wc-block-components-totals-footer-item-tax-value"
>
£85.00
</span>
</div>
<div
class="wc-block-components-totals-item__description"
>
Expand All @@ -82,11 +94,15 @@ exports[`TotalsFooterItem Shows the "including %s TAX LABELS" line with multiple
>
Total
</span>
<span
class="wc-block-formatted-money-amount wc-block-components-formatted-money-amount wc-block-components-totals-item__value"
<div
class="wc-block-components-totals-item__value"
>
£85.00
</span>
<span
class="wc-block-formatted-money-amount wc-block-components-formatted-money-amount wc-block-components-totals-footer-item-tax-value"
>
£85.00
</span>
</div>
<div
class="wc-block-components-totals-item__description"
>
Expand All @@ -110,11 +126,15 @@ exports[`TotalsFooterItem Shows the "including %s of tax" line if tax is greater
>
Total
</span>
<span
class="wc-block-formatted-money-amount wc-block-components-formatted-money-amount wc-block-components-totals-item__value"
<div
class="wc-block-components-totals-item__value"
>
£85.00
</span>
<span
class="wc-block-formatted-money-amount wc-block-components-formatted-money-amount wc-block-components-totals-footer-item-tax-value"
>
£85.00
</span>
</div>
<div
class="wc-block-components-totals-item__description"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $line-height: 1.618;
line-height: $line-height;
font-size: 1em;
/* stylelint-disable-next-line font-family-no-missing-generic-family-keyword */
font-family: star;
font-family: WooCommerce;
font-weight: 400;

&.wc-block-grid__product-rating__stars {
Expand Down Expand Up @@ -86,7 +86,7 @@ $line-height: 1.618;
line-height: $line-height;
font-size: 1em;
/* stylelint-disable-next-line font-family-no-missing-generic-family-keyword */
font-family: star;
font-family: WooCommerce;
font-weight: 400;
-webkit-text-stroke: 2px var(--wp--preset--color--black, #000);
&::before {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
height: 1em;
line-height: 1;
width: 5.3em;
font-family: star; /* stylelint-disable-line */
font-family: WooCommerce; /* stylelint-disable-line */
font-weight: 400;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
*/
import { __, sprintf } from '@wordpress/i18n';
import { useDispatch, useSelect } from '@wordpress/data';
import { CART_STORE_KEY, VALIDATION_STORE_KEY } from '@woocommerce/block-data';
import {
CART_STORE_KEY,
VALIDATION_STORE_KEY,
CHECKOUT_STORE_KEY,
} from '@woocommerce/block-data';
import { decodeEntities } from '@wordpress/html-entities';
import type { StoreCartCoupon } from '@woocommerce/types';
import type { StoreCartCoupon, ApiErrorResponse } from '@woocommerce/types';
import { applyCheckoutFilter } from '@woocommerce/blocks-checkout';

/**
Expand Down Expand Up @@ -41,6 +45,19 @@ export const useStoreCartCoupons = ( context = '' ): StoreCartCoupon => {
);

const { applyCoupon, removeCoupon } = useDispatch( CART_STORE_KEY );
const orderId = useSelect( ( select ) =>
select( CHECKOUT_STORE_KEY ).getOrderId()
);

// Return cart, checkout or generic error message.
const getCouponErrorMessage = ( error: ApiErrorResponse ) => {
if ( orderId && orderId > 0 && error?.data?.details?.checkout ) {
return error.data.details.checkout;
} else if ( error?.data?.details?.cart ) {
return error.data.details.cart;
}
return error.message;
};

const applyCouponWithNotices = ( couponCode: string ) => {
return applyCoupon( couponCode )
Expand Down Expand Up @@ -72,9 +89,10 @@ export const useStoreCartCoupons = ( context = '' ): StoreCartCoupon => {
return Promise.resolve( true );
} )
.catch( ( error ) => {
const errorMessage = getCouponErrorMessage( error );
setValidationErrors( {
coupon: {
message: decodeEntities( error.message ),
message: decodeEntities( errorMessage ), // TODO fix the circular loop with ApiErrorResponseData and ApiErrorResponseDataDetails
hidden: false,
},
} );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ const TotalsItemValue = ( {
currency,
}: Partial< TotalsItemProps > ): ReactElement | null => {
if ( isValidElement( value ) ) {
return <>{ value }</>;
return (
<div className="wc-block-components-totals-item__value">
{ value }
</div>
);
}

return Number.isFinite( value ) ? (
Expand Down
Binary file removed plugins/woocommerce/assets/fonts/WooCommerce.eot
Binary file not shown.
2 changes: 1 addition & 1 deletion plugins/woocommerce/assets/fonts/WooCommerce.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified plugins/woocommerce/assets/fonts/WooCommerce.ttf
Binary file not shown.
Binary file modified plugins/woocommerce/assets/fonts/WooCommerce.woff
Binary file not shown.
Binary file not shown.
Binary file removed plugins/woocommerce/assets/fonts/star.eot
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: enhancement

Validate coupons with email restrictions upfront and change user's feedback when a coupon is not valid for the user.
4 changes: 4 additions & 0 deletions plugins/woocommerce/changelog/31670-remove-star-icon
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: performance

Removes star font
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: dev

Fix `is_read` value in Admin notes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: fix

CYS - Go to the assembler when clicking to the "Design you own" button if the theme was already customized in the assembler.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: fix

Fix broken CSS styles of the `totalValue` filter.
18 changes: 7 additions & 11 deletions plugins/woocommerce/client/legacy/css/_fonts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,18 @@
*/
@font-face {
font-family: 'star';
src: url('../fonts/star.eot');
src: url('../fonts/star.eot?#iefix') format('embedded-opentype'),
url('../fonts/star.woff') format('woff'),
url('../fonts/star.ttf') format('truetype'),
url('../fonts/star.svg#star') format('svg');
src: url('../fonts/WooCommerce.woff2') format('woff2'),
url('../fonts/WooCommerce.woff') format('woff'),
url('../fonts/WooCommerce.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}

@font-face {
font-family: 'WooCommerce';
src: url('../fonts/WooCommerce.eot');
src: url('../fonts/WooCommerce.eot?#iefix') format('embedded-opentype'),
url('../fonts/WooCommerce.woff') format('woff'),
url('../fonts/WooCommerce.ttf') format('truetype'),
url('../fonts/WooCommerce.svg#WooCommerce') format('svg');
src: url('../fonts/WooCommerce.woff2') format('woff2'),
url('../fonts/WooCommerce.woff') format('woff'),
url('../fonts/WooCommerce.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
}
24 changes: 2 additions & 22 deletions plugins/woocommerce/client/legacy/css/twenty-nineteen.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,7 @@ $highlights-color: #0073aa;
/**
* Fonts
*/
@font-face {
font-family: 'star';
src: url('../fonts/star.eot');
src: url('../fonts/star.eot?#iefix') format('embedded-opentype'),
url('../fonts/star.woff') format('woff'),
url('../fonts/star.ttf') format('truetype'),
url('../fonts/star.svg#star') format('svg');
font-weight: normal;
font-style: normal;
}

@font-face {
font-family: 'WooCommerce';
src: url('../fonts/WooCommerce.eot');
src: url('../fonts/WooCommerce.eot?#iefix') format('embedded-opentype'),
url('../fonts/WooCommerce.woff') format('woff'),
url('../fonts/WooCommerce.ttf') format('truetype'),
url('../fonts/WooCommerce.svg#WooCommerce') format('svg');
font-weight: normal;
font-style: normal;
}
@import "fonts";

/**
* Global elements
Expand Down Expand Up @@ -226,7 +206,7 @@ ul.products {
line-height: 1;
font-size: 1em;
width: 5.4em;
font-family: 'star';
font-family: WooCommerce;

&::before {
content: '\73\73\73\73\73';
Expand Down

0 comments on commit aaee897

Please sign in to comment.