Skip to content

Commit

Permalink
Fixed default borderRadius value for the express checkout buttons (#9398
Browse files Browse the repository at this point in the history
)
  • Loading branch information
gpressutto5 authored Sep 6, 2024
1 parent 64b54f3 commit f65efc5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
4 changes: 4 additions & 0 deletions changelog/9311-fix-default-border-radius
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Fixed default borderRadius value for the express checkout buttons
2 changes: 1 addition & 1 deletion client/express-checkout/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export const getExpressCheckoutButtonAppearance = () => {
return {
variables: {
borderRadius: `${
buttonSettings?.radius ?? getDefaultBorderRadius()
buttonSettings?.radius || getDefaultBorderRadius()
}px`,
spacingUnit: '6px',
},
Expand Down
7 changes: 7 additions & 0 deletions client/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,11 @@ declare global {
homeUrl: string;
siteTitle: string;
};

interface Window {
wcpaySettings: typeof wcpaySettings;
wc: typeof wc;
wcTracks: typeof wcTracks;
wcSettings: typeof wcSettings;
}
}
14 changes: 0 additions & 14 deletions client/payment-methods-map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,6 @@ import {
SofortIcon,
} from 'wcpay/payment-methods-icons';

declare global {
interface Window {
wcpaySettings: {
accountStatus: {
country: string;
};
};
wcPayFrontendTracks: {
event: string;
properties: Record< string, unknown >;
};
}
}

const accountCountry = window.wcpaySettings?.accountStatus?.country || 'US';

export interface PaymentMethodMapEntry {
Expand Down
2 changes: 1 addition & 1 deletion client/utils/express-checkout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const getExpressCheckoutConfig = ( key ) => {

export const getDefaultBorderRadius = () => {
return parseInt(
wcpaySettings?.defaultExpressCheckoutBorderRadius ?? 4,
window?.wcpaySettings?.defaultExpressCheckoutBorderRadius || 4,
10
);
};
Expand Down

0 comments on commit f65efc5

Please sign in to comment.