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

Release branch for 8.4.0 #9594

Merged
merged 30 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8bcc6b3
Using Floating Labels with Stripe Appearance API (#9498)
gpressutto5 Oct 1, 2024
7439207
Stop enqueuing woopay-express-button.css to prevent 404 errors (#9509)
asumaran Oct 2, 2024
5faa312
add default (= null) for classNames prop so it's optional for `Wizard…
haszari Oct 2, 2024
b6dd5cc
Rendering Test Model badge only for Credit Card (#9514)
gpressutto5 Oct 3, 2024
c4ad4d7
fix: prevent multiple initializations of `WC_Payments` (#9516)
frosso Oct 3, 2024
1fbf7fb
fix: e2e tests save settings button (#9506)
frosso Oct 3, 2024
d33133e
Merge trunk v8.3.0 into develop
botwoo Oct 3, 2024
82e8dcb
Fixed the utils path for getAppearanceType (#9489)
leonardola Oct 3, 2024
4910323
Converting text color rgba to hex to prevent Stripe warning (#9511)
gpressutto5 Oct 3, 2024
60bc470
Bump WC tested up to version to 9.3.3 (#9536)
cesarcosta99 Oct 8, 2024
965dbfe
Add style support for the WooPay button (#9473)
alexflorisca Oct 9, 2024
2bdb6db
Make experiment Payments task onboarding flow treatment final (#9541)
vladolaru Oct 10, 2024
77fd16b
Fix WooPay auto enable for new accounts (#9549)
vladolaru Oct 11, 2024
350e67f
fix: add GH action SVN dependency (#9555)
frosso Oct 15, 2024
cb04ee2
Ignore Playwright setup errors for newer runner images (#9557)
danielmx-dev Oct 15, 2024
3a0ed10
Add: Test Mode badge to Classic Checkout, Pay for Order, and Add Paym…
danielmx-dev Oct 15, 2024
043655c
Ensure Stripe is loaded correctly when checking payment method availa…
cesarcosta99 Oct 16, 2024
e398dd7
Merge trunk v8.3.1 into develop
botwoo Oct 16, 2024
468bdfc
Use official `phpmyadmin` Docker Hub container image (#9569)
dmvrtx Oct 17, 2024
1a21522
Prevent payment method deletion in local environment when using Strip…
zmaglica Oct 17, 2024
b6fc858
Fix E2E tests by disabling AppArmor restrictions (#9568)
danielmx-dev Oct 17, 2024
b4599f0
Collect border styles from the primary container element (#9508)
malithsen Oct 17, 2024
685471e
Update Playwright README with correct instructions for updating snaps…
Jinksi Oct 17, 2024
3326a6d
Darken the color of links within click tooltips to improve color cont…
Jinksi Oct 17, 2024
a35b00c
chore: remove methods deprecated in 5.6.0 (#9567)
frosso Oct 18, 2024
23ba546
Fix WooPay user registration in classic checkout (#9558)
malithsen Oct 18, 2024
7f8cad7
Use tax inclusive amounts in PMME calculations to match displayed pri…
danielmx-dev Oct 18, 2024
70b696f
Update version and add changelog entries for release 8.4.0
github-actions[bot] Oct 20, 2024
ebca2f4
Omit Test Mode badge in the Change payment method form (#9615)
danielmx-dev Oct 22, 2024
e4b6814
Amend changelog entries for release 8.4.0
botwoo Oct 23, 2024
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
10 changes: 9 additions & 1 deletion .github/actions/e2e/env-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ runs:
shell: bash
run : |
echo "::group::Kill webserver running on port 8084"
sudo fuser -k -n tcp 8084
sudo fuser -k -n tcp 8084 || true
echo "::endgroup::"

# Prepare test environment
Expand All @@ -76,3 +76,11 @@ runs:
echo "::group::Setup E2E test environment"
npm run test:e2e-setup
echo "::endgroup::"

# Disable restrictions that prevent chromium from running properly. See: https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md
- name: Disable AppArmor User Namespace Restrictions
shell: bash
run: |
echo "::group::Disable AppArmor User Namespace Restrictions"
sudo sysctl --ignore --write kernel.apparmor_restrict_unprivileged_userns=0
echo "::endgroup::"
5 changes: 5 additions & 0 deletions bin/run-ci-tests-check-coverage.bash
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ else
fi

composer self-update && composer install --no-progress
# SVN is needed when installing WP.
if ! [ -x "$(command -v svn)" ]; then
echo 'Installing SVN...'
sudo apt-get install -y subversion
fi
sudo systemctl start mysql.service
bash bin/install-wp-tests.sh woocommerce_test root root localhost $WP_VERSION $WC_VERSION false
echo 'Running the tests...'
Expand Down
7 changes: 7 additions & 0 deletions bin/run-ci-tests.bash
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ WCPAY_DIR="$GITHUB_WORKSPACE"
echo 'Updating composer version & Install dependencies...'
composer self-update && composer install --no-progress

# SVN is needed when installing WP.
if ! [ -x "$(command -v svn)" ]; then
echo 'Installing SVN...'
sudo apt-get install -y subversion
fi

# SVN is needed when installing WP.
echo 'Starting MySQL service...'
sudo systemctl start mysql.service

Expand Down
20 changes: 20 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
*** WooPayments Changelog ***

= 8.4.0 - 2024-10-23 =
* Add - Add test mode badge to classic checkout and add payment method.
* Add - Using Floating Labels with Stripe Appearance API for Blocks Checkout
* Fix - Converting text color rgba to hex to prevent Stripe warning
* Fix - Fix the color contrast of links within tooltips to improve readability.
* Fix - Pass container styling data to WooPay
* Fix - Prevented detaching payment methods from live Stripe accounts when working in non-production environments.
* Fix - Rendering Test Model badge only for Credit Card
* Fix - Stop enqueuing woopay-express-button.css to prevent 404 errors
* Fix - The amounts used by the PMMEs will match the displayed price of the product regardless of the tax settings.
* Fix - WooPay user registration via classic checkout
* Update - Add support for the style controls for the WooPay button
* Update - chore: remove deprecated is_in_dev_mode() and is_in_test_mode() methods
* Update - Payments task onboarding flows skip the Connect page.
* Dev - Bump WC tested up to version to 9.3.3.
* Dev - fix: prevent multiple instances of WC_Payments_Apple_Pay_Registration
* Dev - Fixed wrong utils path that would prevent checkout with WooPay OTP
* Dev - Migrate WizardTaskItem and CollapsibleBody components to TypeScript, making the className prop optional.
* Dev - Use official `phpmyadmin` Docker Hub container image

= 8.3.1 - 2024-10-16 =
* Fix - Auto-enabled WooPay for new accounts.
* Fix - Load Stripe with merchant account's key when checking payment method availability.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import classNames from 'classnames';
import WizardTaskContext from './task/context';
import './collapsible-body.scss';

const CollapsibleBody = ( { className, ...restProps } ) => {
const CollapsibleBody: React.FC< React.HTMLAttributes< HTMLDivElement > > = ( {
className,
...restProps
} ) => {
const { isActive } = useContext( WizardTaskContext );

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,19 @@ import { Icon, check } from '@wordpress/icons';
import WizardTaskContext from './task/context';
import './task-item.scss';

const WizardTaskItem = ( { children, title, index, className } ) => {
interface WizardTaskItemProps {
children: React.ReactNode;
title: string;
index: number;
className?: string;
}

const WizardTaskItem: React.FC< WizardTaskItemProps > = ( {
children,
title,
index,
className,
} ) => {
const { isCompleted, isActive } = useContext( WizardTaskContext );

return (
Expand All @@ -26,7 +38,7 @@ const WizardTaskItem = ( { children, title, index, className } ) => {
className="wcpay-wizard-task__headline"
// tabindex with value `-1` is necessary to programmatically set the focus
// on an element that is not interactive.
tabIndex="-1"
tabIndex={ -1 }
>
<div className="wcpay-wizard-task__icon-wrapper">
<div className="wcpay-wizard-task__icon-text">
Expand Down
2 changes: 2 additions & 0 deletions client/checkout/api/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const mockAppearance = {
'.Heading': {},
'.Button': {},
'.Link': {},
'.Container': {},
},
theme: 'stripe',
variables: {
Expand All @@ -50,6 +51,7 @@ const mockAppearance = {
fontFamily: undefined,
fontSizeBase: undefined,
},
labels: 'above',
};

describe( 'WCPayAPI', () => {
Expand Down
2 changes: 1 addition & 1 deletion client/checkout/blocks/payment-elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const PaymentElements = ( { api, ...props } ) => {
useEffect( () => {
async function generateUPEAppearance() {
// Generate UPE input styles.
let upeAppearance = getAppearance( 'blocks_checkout' );
let upeAppearance = getAppearance( 'blocks_checkout', false, true );
upeAppearance = await api.saveUPEAppearance(
upeAppearance,
'blocks_checkout'
Expand Down
51 changes: 50 additions & 1 deletion client/checkout/classic/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,62 @@
}

#payment .payment_methods {
li label img {
li[class*='payment_method_woocommerce_payments'] > label > img {
float: right;
border: 0;
padding: 0;
height: 24px !important;
max-height: 24px !important;
}

li.payment_method_woocommerce_payments {
display: grid;
grid-template-columns: 0fr 0fr 1fr;
grid-template-rows: max-content;

> input[name='payment_method'] {
align-self: center;
}
> label {
grid-column: 3;
display: grid;
grid-template-columns: 0fr auto;
grid-template-rows: max-content;
grid-gap: 0;
margin-bottom: 0;

> .label-title-container {
grid-area: 1 / 2 / 2 / 3;
}

.payment-method-title {
margin-right: 8px;
}

.test-mode.badge {
display: inline-block;
background-color: #fff2d7;
border-radius: 4px;
padding: 4px 6px;
font-size: 12px;
font-weight: 400;
line-height: 16px;
color: #4d3716;
vertical-align: middle;
}

img {
float: none;
grid-area: 1 / 4 / 2 / 5;
align-self: baseline;
justify-self: end;
margin-left: 1em;
}
}
> div.payment_box {
grid-area: 2 / 1 / 3 / 4;
}
}
}

li.wc_payment_method:has( .input-radio:not( :checked )
Expand Down
86 changes: 62 additions & 24 deletions client/checkout/upe-styles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ import {
dashedToCamelCase,
isColorLight,
getBackgroundColor,
maybeConvertRGBAtoRGB,
handleAppearanceForFloatingLabel,
} from './utils.js';

export const appearanceSelectors = {
default: {
hiddenContainer: '#wcpay-hidden-div',
hiddenInput: '#wcpay-hidden-input',
hiddenInvalidInput: '#wcpay-hidden-invalid-input',
hiddenValidActiveLabel: '#wcpay-hidden-valid-active-label',
},
classicCheckout: {
appendTarget: '.woocommerce-billing-fields__field-wrapper',
Expand All @@ -40,16 +43,15 @@ export const appearanceSelectors = {
linkSelectors: [ 'a' ],
},
blocksCheckout: {
appendTarget: '#billing.wc-block-components-address-form',
upeThemeInputSelector: '#billing-first_name',
upeThemeLabelSelector:
'.wc-block-components-checkout-step__description',
appendTarget: '#contact-fields',
upeThemeInputSelector: '.wc-block-components-text-input #email',
upeThemeLabelSelector: '.wc-block-components-text-input label',
rowElement: 'div',
validClasses: [ 'wc-block-components-text-input' ],
validClasses: [ 'wc-block-components-text-input', 'is-active' ],
invalidClasses: [ 'wc-block-components-text-input', 'has-error' ],
alternateSelectors: {
appendTarget: '#shipping.wc-block-components-address-form',
upeThemeInputSelector: '#shipping-first_name',
appendTarget: '#billing.wc-block-components-address-form',
upeThemeInputSelector: '#billing-first_name',
upeThemeLabelSelector:
'.wc-block-components-checkout-step__description',
},
Expand All @@ -63,6 +65,9 @@ export const appearanceSelectors = {
headingSelectors: [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ],
buttonSelectors: [ '.wc-block-components-checkout-place-order-button' ],
linkSelectors: [ 'a' ],
containerSelectors: [
'.wp-block-woocommerce-checkout-order-summary-block',
],
},
bnplProductPage: {
appendTarget: '.product .cart .quantity',
Expand Down Expand Up @@ -99,6 +104,7 @@ export const appearanceSelectors = {
headingSelectors: [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ],
buttonSelectors: [ '.checkout-button' ],
linkSelectors: [ 'a' ],
containerSelectors: [ '.shop_table' ],
},
bnplCartBlock: {
appendTarget: '.wc-block-cart .wc-block-components-quantity-selector',
Expand All @@ -121,6 +127,7 @@ export const appearanceSelectors = {
headingSelectors: [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ],
buttonSelectors: [ '.wc-block-cart__submit-button' ],
linkSelectors: [ 'a' ],
containerSelectors: [ '.wp-block-woocommerce-cart-line-items-block' ],
},
wooPayClassicCheckout: {
appendTarget: '.woocommerce-billing-fields__field-wrapper',
Expand All @@ -142,6 +149,7 @@ export const appearanceSelectors = {
headingSelectors: [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ],
buttonSelectors: [ '#place_order' ],
linkSelectors: [ 'a' ],
containerSelectors: [ '.woocommerce-checkout-review-order-table' ],
},

/**
Expand Down Expand Up @@ -326,6 +334,13 @@ const hiddenElementsForUPE = {
selectors.hiddenInput
);

// Clone & append target label to hidden valid row.
this.appendClone(
hiddenValidRow,
selectors.upeThemeLabelSelector,
selectors.hiddenValidActiveLabel
);

// Clone & append target input to hidden invalid row.
this.appendClone(
hiddenInvalidRow,
Expand Down Expand Up @@ -379,9 +394,11 @@ export const getFieldStyles = (
for ( let i = 0; i < styles.length; i++ ) {
const camelCase = dashedToCamelCase( styles[ i ] );
if ( validProperties.includes( camelCase ) ) {
filteredStyles[ camelCase ] = styles.getPropertyValue(
styles[ i ]
);
let propertyValue = styles.getPropertyValue( styles[ i ] );
if ( camelCase === 'color' ) {
propertyValue = maybeConvertRGBAtoRGB( propertyValue );
}
filteredStyles[ camelCase ] = propertyValue;
}
}

Expand Down Expand Up @@ -482,37 +499,58 @@ export const getAppearance = ( elementsLocation, forWooPay = false ) => {
);
const buttonRules = getFieldStyles( selectors.buttonSelectors, '.Input' );
const linkRules = getFieldStyles( selectors.linkSelectors, '.Label' );
const containerRules = getFieldStyles(
selectors.containerSelectors,
'.Container'
);
const globalRules = {
colorBackground: backgroundColor,
colorText: labelRules.color,
fontFamily: labelRules.fontFamily,
fontSizeBase: labelRules.fontSize,
};

const appearance = {
const isFloatingLabel = elementsLocation === 'blocks_checkout';

let appearance = {
variables: globalRules,
theme: isColorLight( backgroundColor ) ? 'stripe' : 'night',
rules: {
'.Input': inputRules,
'.Input--invalid': inputInvalidRules,
'.Label': labelRules,
'.Block': blockRules,
'.Tab': tabRules,
'.Tab:hover': tabHoverRules,
'.Tab--selected': selectedTabRules,
'.TabIcon:hover': tabIconHoverRules,
'.TabIcon--selected': selectedTabIconRules,
'.Text': labelRules,
'.Text--redirect': labelRules,
},
labels: isFloatingLabel ? 'floating' : 'above',
// We need to clone the object to avoid modifying other rules when updating the appearance for floating labels.
rules: JSON.parse(
JSON.stringify( {
'.Input': inputRules,
'.Input--invalid': inputInvalidRules,
'.Label': labelRules,
'.Block': blockRules,
'.Tab': tabRules,
'.Tab:hover': tabHoverRules,
'.Tab--selected': selectedTabRules,
'.TabIcon:hover': tabIconHoverRules,
'.TabIcon--selected': selectedTabIconRules,
'.Text': labelRules,
'.Text--redirect': labelRules,
} )
),
};

if ( isFloatingLabel ) {
appearance = handleAppearanceForFloatingLabel(
appearance,
getFieldStyles(
selectors.hiddenValidActiveLabel,
'.Label--floating'
)
);
}

if ( forWooPay ) {
appearance.rules = {
...appearance.rules,
'.Heading': headingRules,
'.Button': buttonRules,
'.Link': linkRules,
'.Container': containerRules,
};
}

Expand Down
4 changes: 4 additions & 0 deletions client/checkout/upe-styles/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,11 @@ describe( 'Getting styles for automated theming', () => {
fontSize: '12px',
padding: '10px',
},
'.Container': {
backgroundColor: 'rgba(0, 0, 0, 0)',
},
},
labels: 'above',
} );
} );

Expand Down
Loading
Loading