Skip to content

Commit

Permalink
Merge pull request #2075 from woocommerce/release/2.5.4
Browse files Browse the repository at this point in the history
Release 2.5.4
  • Loading branch information
ianlin authored Aug 29, 2023
2 parents 9ecc3eb + ac20adf commit 51a81fc
Show file tree
Hide file tree
Showing 49 changed files with 45,129 additions and 1,347 deletions.
12 changes: 1 addition & 11 deletions .github/workflows/php-hook-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,7 @@ on:
branches:
- "release/**"
paths:
- "**.php"
- .github/workflows/php-hook-documentation.yml
pull_request:
types:
- opened
branches:
- "release/**"
paths:
- "**.php"
- .github/workflows/php-hook-documentation.yml
- changelog.txt # Run the workflow only after the last commit of Woo Release. When it updates the changelog.
workflow_dispatch:

concurrency:
Expand All @@ -37,7 +28,6 @@ jobs:
id: generate-hook-docs
uses: woocommerce/grow/hook-documentation@actions-v1
with:
debug-output: yes
source-directories: src/,views/,google-listings-and-ads.php,uninstall.php

- name: Commit hook documentation
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/fermium
v16
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
*** WooCommerce Google Listings and Ads Changelog ***

= 2.5.4 - 2023-08-29 =
* Dev - Override vulnerability packages: xmlhttprequest-ssl and ws.
* Dev - Update trigger method in Hooks Generator Workflow.

= 2.5.3 - 2023-08-22 =
* Dev - Add Action for Hooks Documentation Generator.
* Dev - Allow E2E testing with Release Candidates.
Expand Down
4 changes: 2 additions & 2 deletions google-listings-and-ads.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Google Listings and Ads
* Plugin URL: https://wordpress.org/plugins/google-listings-and-ads/
* Description: Native integration with Google that allows merchants to easily display their products across Google’s network.
* Version: 2.5.3
* Version: 2.5.4
* Author: WooCommerce
* Author URI: https://woocommerce.com/
* Text Domain: google-listings-and-ads
Expand All @@ -30,7 +30,7 @@

defined( 'ABSPATH' ) || exit;

define( 'WC_GLA_VERSION', '2.5.3' ); // WRCS: DEFINED_VERSION.
define( 'WC_GLA_VERSION', '2.5.4' ); // WRCS: DEFINED_VERSION.

Check warning on line 33 in google-listings-and-ads.php

View check run for this annotation

Codecov / codecov/patch

google-listings-and-ads.php#L33

Added line #L33 was not covered by tests
define( 'WC_GLA_MIN_PHP_VER', '7.4' );
define( 'WC_GLA_MIN_WC_VER', '6.9' );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ function EditPhoneNumberCard( {
} ) {
const { loaded, data } = phoneNumber;
const [ verifying, setVerifying ] = useState( false );
const [ unverifiedPhoneNumber, setUnverifiedPhoneNumber ] = useState(
null
);
const [ unverifiedPhoneNumber, setUnverifiedPhoneNumber ] =
useState( null );

let cardContent = <AppSpinner />;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,8 @@ export default function VerifyPhoneNumberContent( {
const [ verifying, setVerifying ] = useState( false );
const [ error, setError ] = useState( null );
const verificationIdRef = useRef( {} );
const {
requestPhoneVerificationCode,
verifyPhoneNumber,
} = useAppDispatch();
const { requestPhoneVerificationCode, verifyPhoneNumber } =
useAppDispatch();

const isSMS = method === VERIFICATION_METHOD.SMS;

Expand Down Expand Up @@ -160,12 +158,8 @@ export default function VerifyPhoneNumberContent( {
}, [ method, callCount, handleVerificationCodeRequest ] );

// Render related.
const {
toInstruction,
textResend,
textResendCooldown,
textSwitch,
} = appearanceDict[ method ];
const { toInstruction, textResend, textResendCooldown, textSwitch } =
appearanceDict[ method ];

const verificationId = verificationIdRef.current[ method ];
const disabledVerify = ! ( verification?.isFilled && verificationId );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,8 @@ import ConditionalSection from '.~/components/conditional-section';
const FormContent = ( {
submitLabel = __( 'Complete setup', 'google-listings-and-ads' ),
} ) => {
const {
values,
isValidForm,
handleSubmit,
adapter,
} = useAdaptiveFormContext();
const { values, isValidForm, handleSubmit, adapter } =
useAdaptiveFormContext();
const shouldDisplayTaxRate = useDisplayTaxRate( adapter.audienceCountries );
const shouldDisplayShippingTime = values.shipping_time === 'flat';

Expand Down
5 changes: 2 additions & 3 deletions js/src/components/free-listings/setup-free-listings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,8 @@ const SetupFreeListings = ( {
refund_tos_visible: settings.refund_tos_visible,
contact_info_visible: settings.contact_info_visible,
// This is used in UI only, not used in API.
offer_free_shipping: getOfferFreeShippingInitialValue(
shippingRates
),
offer_free_shipping:
getOfferFreeShippingInitialValue( shippingRates ),
// Glue shipping rates and times together, as the Form does not support nested structures.
shipping_country_rates: shippingRates,
shipping_country_times: shippingTimes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ import useGoogleConnectFlow from './use-google-connect-flow';
*/
const ConnectGoogleAccountCard = ( { disabled } ) => {
const pageName = glaData.mcSetupComplete ? 'reconnect' : 'setup-mc';
const [ handleConnect, { loading, data } ] = useGoogleConnectFlow(
pageName
);
const [ handleConnect, { loading, data } ] =
useGoogleConnectFlow( pageName );

return (
<AccountCard
Expand Down
24 changes: 10 additions & 14 deletions js/src/components/google-account-card/useSwitchGoogleAccount.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@ import useApiFetchCallback from '.~/hooks/useApiFetchCallback';
const useSwitchGoogleAccount = () => {
const { createNotice, removeNotice } = useDispatchCoreNotices();

const [
fetchGoogleMCDisconnect,
{ loading: loadingGoogleMCDisconnect },
] = useApiFetchCallback( {
path: `${ API_NAMESPACE }/mc/connection`,
method: 'DELETE',
} );
const [ fetchGoogleMCDisconnect, { loading: loadingGoogleMCDisconnect } ] =
useApiFetchCallback( {
path: `${ API_NAMESPACE }/mc/connection`,
method: 'DELETE',
} );

/**
* Note: we are manually calling `DELETE /google/connect` instead of using
Expand All @@ -46,13 +44,11 @@ const useSwitchGoogleAccount = () => {
* and the UI will display the Connect card for a brief moment,
* before the browser redirects to the Google Auth page.
*/
const [
fetchGoogleDisconnect,
{ loading: loadingGoogleDisconnect },
] = useApiFetchCallback( {
path: `${ API_NAMESPACE }/google/connect`,
method: 'DELETE',
} );
const [ fetchGoogleDisconnect, { loading: loadingGoogleDisconnect } ] =
useApiFetchCallback( {
path: `${ API_NAMESPACE }/google/connect`,
method: 'DELETE',
} );

const [
fetchGoogleConnect,
Expand Down
12 changes: 5 additions & 7 deletions js/src/components/google-ads-account-card/create-account.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ const ClaimTermsAndCreateAccountButton = () => {
const { createNotice } = useDispatchCoreNotices();
const { fetchGoogleAdsAccount } = useAppDispatch();
const [ fetchAccountLoading, setFetchAccountLoading ] = useState( false );
const [
fetchCreateAdsAccount,
{ loading: createLoading },
] = useApiFetchCallback( {
path: `/wc/gla/ads/accounts`,
method: 'POST',
} );
const [ fetchCreateAdsAccount, { loading: createLoading } ] =
useApiFetchCallback( {
path: `/wc/gla/ads/accounts`,
method: 'POST',
} );

const handleCreateAccount = async () => {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,11 @@ const ConnectedGoogleMCAccountCard = ( {
const { createNotice, removeNotice } = useDispatchCoreNotices();
const { invalidateResolution } = useAppDispatch();

const [
fetchGoogleMCDisconnect,
{ loading: loadingGoogleMCDisconnect },
] = useApiFetchCallback( {
path: `${ API_NAMESPACE }/mc/connection`,
method: 'DELETE',
} );
const [ fetchGoogleMCDisconnect, { loading: loadingGoogleMCDisconnect } ] =
useApiFetchCallback( {
path: `${ API_NAMESPACE }/mc/connection`,
method: 'DELETE',
} );

const domain = new URL( getSetting( 'homeUrl' ) ).host;

Expand Down
6 changes: 2 additions & 4 deletions js/src/components/google-mc-account-card/create-account.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ import useCreateMCAccount from './useCreateMCAccount';
*/
const CreateAccount = ( props ) => {
const { onSwitchAccount } = props;
const [
handleCreateAccount,
{ loading, error, response },
] = useCreateMCAccount();
const [ handleCreateAccount, { loading, error, response } ] =
useCreateMCAccount();

if ( loading || ( response && response.status === 503 ) ) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ import DisabledCard from './disabled-card';
import NonConnected from './non-connected';

const GoogleMCAccountCard = () => {
const {
hasFinishedResolution,
isPreconditionReady,
googleMCAccount,
} = useGoogleMCAccount();
const { hasFinishedResolution, isPreconditionReady, googleMCAccount } =
useGoogleMCAccount();

if ( ! hasFinishedResolution ) {
return <SpinnerCard />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,12 @@ import AppInputLinkControl from '.~/components/app-input-link-control';
*/
const ReclaimUrlCard = ( { id, websiteUrl, onSwitchAccount = noop } ) => {
const { invalidateResolution } = useAppDispatch();
const [
fetchClaimOverwrite,
{ loading, error, reset },
] = useApiFetchCallback( {
path: `/wc/gla/mc/accounts/claim-overwrite`,
method: 'POST',
data: { id },
} );
const [ fetchClaimOverwrite, { loading, error, reset } ] =
useApiFetchCallback( {
path: `/wc/gla/mc/accounts/claim-overwrite`,
method: 'POST',
data: { id },
} );
const homeUrl = getSetting( 'homeUrl' );

const handleReclaimClick = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,12 @@ const SwitchUrlCard = ( {
} ) => {
const { createNotice } = useDispatchCoreNotices();
const { invalidateResolution } = useAppDispatch();
const [
fetchMCAccountSwitchUrl,
{ loading, error, response },
] = useApiFetchCallback( {
path: `/wc/gla/mc/accounts/switch-url`,
method: 'POST',
data: { id },
} );
const [ fetchMCAccountSwitchUrl, { loading, error, response } ] =
useApiFetchCallback( {
path: `/wc/gla/mc/accounts/switch-url`,
method: 'POST',
data: { id },
} );
const homeUrl = getSetting( 'homeUrl' );

const handleSwitch = async () => {
Expand Down
8 changes: 2 additions & 6 deletions js/src/components/paid-ads/asset-group/asset-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,8 @@ export const ACTION_SUBMIT_CAMPAIGN_ONLY = 'submit-campaign-only';
*/
export default function AssetGroup( { campaign } ) {
const isCreation = ! campaign;
const {
isValidForm,
handleSubmit,
adapter,
values,
} = useAdaptiveFormContext();
const { isValidForm, handleSubmit, adapter, values } =
useAdaptiveFormContext();
const { isValidAssetGroup, isSubmitting, isSubmitted, submitter } = adapter;
const currentAction = submitter?.dataset.action;

Expand Down
6 changes: 2 additions & 4 deletions js/src/components/paid-ads/billing-card/billing-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ const { APPROVED } = GOOGLE_ADS_BILLING_STATUS;
* of the connected Google Ads account.
*/
export default function BillingCard() {
const {
billingStatus,
hasFinishedResolution,
} = useGoogleAdsAccountBillingStatus();
const { billingStatus, hasFinishedResolution } =
useGoogleAdsAccountBillingStatus();

if ( ! hasFinishedResolution ) {
return <SpinnerCard />;
Expand Down
12 changes: 6 additions & 6 deletions js/src/components/paid-ads/validateAssetGroup.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ describe( 'validateAssetGroup', () => {
);

it.each(
ASSET_TEXT_SPECS.filter(
( spec ) => spec.max > 1
).map( ( spec ) => [ spec.key, spec ] )
ASSET_TEXT_SPECS.filter( ( spec ) => spec.max > 1 ).map(
( spec ) => [ spec.key, spec ]
)
)(
'When there is duplication in values.%s, it should not pass',
( key, spec ) => {
Expand All @@ -129,9 +129,9 @@ describe( 'validateAssetGroup', () => {
);

it.each(
ASSET_TEXT_SPECS.filter(
( spec ) => spec.max > 1
).map( ( spec ) => [ spec.key, spec ] )
ASSET_TEXT_SPECS.filter( ( spec ) => spec.max > 1 ).map(
( spec ) => [ spec.key, spec ]
)
)(
'When checking duplication, it should ignore empty strings',
( key, spec ) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@ export default function EstimatedShippingRatesCard( {
onChange,
} ) {
const { code: currencyCode } = useStoreCurrency();
const {
handleAddSubmit,
getChangeHandler,
getDeleteHandler,
} = getHandlers( { value, onChange } );
const { handleAddSubmit, getChangeHandler, getDeleteHandler } = getHandlers(
{ value, onChange }
);

/**
* Function to render the shipping rate groups from `value`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ describe( 'groupShippingRatesByCurrencyFreeShippingThreshold', () => {
},
];

const result = groupShippingRatesByCurrencyFreeShippingThreshold(
shippingRates
);
const result =
groupShippingRatesByCurrencyFreeShippingThreshold( shippingRates );

expect( result.length ).toEqual( 3 );
expect( result[ 0 ] ).toStrictEqual( {
Expand Down Expand Up @@ -102,9 +101,8 @@ describe( 'groupShippingRatesByCurrencyFreeShippingThreshold', () => {
},
];

const result = groupShippingRatesByCurrencyFreeShippingThreshold(
shippingRates
);
const result =
groupShippingRatesByCurrencyFreeShippingThreshold( shippingRates );

expect( result.length ).toEqual( 3 );
expect( result[ 0 ] ).toStrictEqual( {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ import './minimum-order-card.scss';
const MinimumOrderCard = ( { value = [], helper, onChange } ) => {
const renderGroups = () => {
const nonZeroShippingRates = value.filter( isNonFreeShippingRate );
const groups = groupShippingRatesByCurrencyFreeShippingThreshold(
nonZeroShippingRates
);
const groups =
groupShippingRatesByCurrencyFreeShippingThreshold(
nonZeroShippingRates
);
const countryOptions = nonZeroShippingRates.map(
( shippingRate ) => shippingRate.country
);
Expand Down
5 changes: 2 additions & 3 deletions js/src/dashboard/all-programs-table-card/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,8 @@ const AllProgramsTableCard = ( props ) => {
// Budget is given in the currency that is used by Google Ads, which may differ from the current store's currency.
// We will still use the store's currency **formatting** settings.
const { formatAmount } = useAdsCurrency();
const {
data: finalCountryCodesData,
} = useTargetAudienceFinalCountryCodes();
const { data: finalCountryCodesData } =
useTargetAudienceFinalCountryCodes();
const { data: adsCampaignsData } = useAdsCampaigns();
const map = useCountryKeyNameMap();

Expand Down
Loading

0 comments on commit 51a81fc

Please sign in to comment.