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

GooglePay - Adding borderRadius support #2736

Merged
merged 2 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .changeset/good-needles-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@adyen/adyen-web': minor
---

GooglePay - Adding support for borderRadius property
2 changes: 1 addition & 1 deletion packages/lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
"@babel/runtime": "^7.15.4",
"@babel/runtime-corejs3": "^7.20.1",
"@types/applepayjs": "14.0.6",
"@types/googlepay": "^0.7.0",
"@types/googlepay": "0.7.6",
"classnames": "^2.3.1",
"core-js-pure": "^3.25.3",
"preact": "10.13.2"
Expand Down
1 change: 1 addition & 0 deletions packages/lib/src/components/GooglePay/GooglePay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ class GooglePay extends UIElement<GooglePayProps> {
buttonSizeMode={this.props.buttonSizeMode}
buttonLocale={this.props.buttonLocale}
buttonRootNode={this.props.buttonRootNode}
buttonRadius={this.props.buttonRadius}
paymentsClient={this.googlePay.paymentsClient}
onClick={this.submit}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ interface GooglePayButtonProps {
buttonType: google.payments.api.ButtonType;
buttonSizeMode: google.payments.api.ButtonSizeMode;
buttonLocale: string;
buttonRadius?: number;
buttonRootNode?: HTMLDocument | ShadowRoot;
paymentsClient: Promise<google.payments.api.PaymentsClient>;
onClick: (e: Event) => void;
Expand Down Expand Up @@ -36,7 +37,7 @@ class GooglePayButton extends Component<GooglePayButtonProps> {
};

componentDidMount() {
const { buttonColor, buttonType, buttonLocale, buttonSizeMode, buttonRootNode, paymentsClient } = this.props;
const { buttonRadius, buttonColor, buttonType, buttonLocale, buttonSizeMode, buttonRootNode, paymentsClient } = this.props;

paymentsClient
.then(client =>
Expand All @@ -46,7 +47,8 @@ class GooglePayButton extends Component<GooglePayButtonProps> {
buttonColor,
buttonLocale,
buttonSizeMode,
buttonRootNode
buttonRootNode,
...(buttonRadius && { buttonRadius })
})
)
.then(googlePayButton => {
Expand Down
1 change: 1 addition & 0 deletions packages/lib/src/components/GooglePay/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export interface GooglePayProps extends UIElementProps {
buttonSizeMode?: google.payments.api.ButtonSizeMode;
buttonRootNode?: HTMLDocument | ShadowRoot;
buttonLocale?: string;
buttonRadius?: number;

// Events
onClick?: (resolve, reject) => void;
Expand Down
5 changes: 3 additions & 2 deletions packages/playground/src/pages/Dropin/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ export async function initSession() {
// console.log('onChange', state);
// },
paymentMethodsConfiguration: {
paywithgoogle: {
buttonType: 'plain'
googlepay: {
buttonType: 'plain',
buttonRadius: 20
},
card: {
hasHolderName: true,
Expand Down
4 changes: 3 additions & 1 deletion packages/playground/src/pages/Wallets/Wallets.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,10 @@ getPaymentMethods({ amount, shopperLocale }).then(async paymentMethodsResponse =
shippingAddressParameters: {}, // https://developers.google.com/pay/api/web/reference/object#ShippingAddressParameters

// Button config (optional)
buttonSizeMode: 'fill',
buttonType: 'long', // https://developers.google.com/pay/api/web/reference/object#ButtonOptions
buttonColor: 'default' // https://developers.google.com/pay/api/web/reference/object#ButtonOptions
buttonColor: 'default', // https://developers.google.com/pay/api/web/reference/object#ButtonOptions
buttonRadius: 20
});

// First, check availability. If environment is TEST, Google Pay will always be considered available.
Expand Down
15 changes: 10 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4700,10 +4700,10 @@
"@types/minimatch" "*"
"@types/node" "*"

"@types/googlepay@^0.7.0":
version "0.7.4"
resolved "https://registry.yarnpkg.com/@types/googlepay/-/googlepay-0.7.4.tgz#271a1b3b191107713a392314bd39c2ce8a1b4b84"
integrity sha512-7j0iu4lUQfML5c+3zS8t/BNUJFH5MqKnMWEFD141eWsAXmmm6piJ0p+mJlM2Om61FYGe5pUWKRYB8HlZT7n4rQ==
"@types/[email protected].6":
version "0.7.6"
resolved "https://registry.yarnpkg.com/@types/googlepay/-/googlepay-0.7.6.tgz#ba444ad8b2945e70f873673b8f5371745b8cfe37"
integrity sha512-5003wG+qvf4Ktf1hC9IJuRakNzQov00+Xf09pAWGJLpdOjUrq0SSLCpXX7pwSeTG9r5hrdzq1iFyZcW7WVyr4g==

"@types/graceful-fs@^4.1.3":
version "4.1.9"
Expand Down Expand Up @@ -13531,11 +13531,16 @@ regenerate@^1.4.2:
resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.2.tgz#b9346d8827e8f5a32f7ba29637d398b69014848a"
integrity sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==

regenerator-runtime@^0.13.11, regenerator-runtime@^0.13.9, regenerator-runtime@^0.14.0:
regenerator-runtime@^0.13.11:
version "0.13.11"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9"
integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==

regenerator-runtime@^0.14.0:
version "0.14.1"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz#356ade10263f685dda125100cd862c1db895327f"
integrity sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==

regenerator-transform@^0.15.1:
version "0.15.1"
resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.15.1.tgz#f6c4e99fc1b4591f780db2586328e4d9a9d8dc56"
Expand Down
Loading