From ee86ebb74cb2997e0b554eb585cc2f600a1ed6a9 Mon Sep 17 00:00:00 2001 From: Dan Haas Date: Thu, 6 Jun 2024 16:57:29 -0400 Subject: [PATCH 1/3] updates buttons component to add message --- .../paypal-js/types/components/buttons.d.ts | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/packages/paypal-js/types/components/buttons.d.ts b/packages/paypal-js/types/components/buttons.d.ts index 87cfa2dc..f053d7ad 100644 --- a/packages/paypal-js/types/components/buttons.d.ts +++ b/packages/paypal-js/types/components/buttons.d.ts @@ -29,7 +29,7 @@ export type CreateSubscriptionActions = { /** Used to revise an existing subscription for client-side integrations. Accepts the same options as the request body of the [/v1/billing/subscription/{id}/revise api](https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_revise). */ revise: ( subscriptionID: string, - options: ReviseSubscriptionRequestBody, + options: ReviseSubscriptionRequestBody ) => Promise; }; }; @@ -211,14 +211,14 @@ export interface PayPalButtonsComponentOptions { */ createOrder?: ( data: CreateOrderData, - actions: CreateOrderActions, + actions: CreateOrderActions ) => Promise; /** * Called on button click to set up a recurring payment. [createSubscription docs](https://developer.paypal.com/docs/business/javascript-sdk/javascript-sdk-reference/#createsubscription). */ createSubscription?: ( data: Record, - actions: CreateSubscriptionActions, + actions: CreateSubscriptionActions ) => Promise; /** * Save payment methods to charge payers after a set amount of time. For example, you can offer a free trial and charge payers after the trial expires. Payers don't need to be present when charged. No checkout required. @@ -235,7 +235,7 @@ export interface PayPalButtonsComponentOptions { */ onApprove?: ( data: OnApproveData, - actions: OnApproveActions, + actions: OnApproveActions ) => Promise; /** * Called when the buyer cancels the transaction. @@ -243,14 +243,14 @@ export interface PayPalButtonsComponentOptions { */ onCancel?: ( data: Record, - actions: OnCancelledActions, + actions: OnCancelledActions ) => void; /** * Called when the button is clicked. Often used for [validation](https://developer.paypal.com/docs/checkout/integration-features/validation/). */ onClick?: ( data: Record, - actions: OnClickActions, + actions: OnClickActions ) => Promise | void; /** * Catch all for errors preventing buyer checkout. @@ -267,21 +267,21 @@ export interface PayPalButtonsComponentOptions { */ onShippingChange?: ( data: OnShippingChangeData, - actions: OnShippingChangeActions, + actions: OnShippingChangeActions ) => Promise; /** * Called when the buyer selects a new shipping option on PayPal. */ onShippingOptionsChange?: ( data: OnShippingOptionsChangeData, - actions: OnShippingOptionsChangeActions, + actions: OnShippingOptionsChangeActions ) => Promise; /** * Called when the buyer updates their shipping address on PayPal. */ onShippingAddressChange?: ( data: OnShippingAddressChangeData, - actions: OnShippingAddressChangeActions, + actions: OnShippingAddressChangeActions ) => Promise; /** * [Styling options](https://developer.paypal.com/docs/business/checkout/reference/style-guide/#customize-the-payment-buttons) for customizing the button appearance. @@ -306,6 +306,16 @@ export interface PayPalButtonsComponentOptions { * Used for displaying only vaultable buttons. */ displayOnly?: DisplayOnlyOptions[]; + /** + * [Message options](https://developer.paypal.com/sdk/js/reference/#message) for customizing the message appearance and limited content control. + */ + message?: { + amount?: number; + align?: "center" | "left" | "right"; + color?: "black" | "white"; + position?: "top" | "bottom"; + offer?: "pay_later_short_term" | "pay_later_long_term"; + }; } export interface PayPalButtonsComponent { From b4b32c216294f3b48172c39a02354c35d2db240a Mon Sep 17 00:00:00 2001 From: Dan Haas Date: Thu, 6 Jun 2024 17:28:12 -0400 Subject: [PATCH 2/3] undoes comma change --- .../paypal-js/types/components/buttons.d.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/paypal-js/types/components/buttons.d.ts b/packages/paypal-js/types/components/buttons.d.ts index f053d7ad..73f592e3 100644 --- a/packages/paypal-js/types/components/buttons.d.ts +++ b/packages/paypal-js/types/components/buttons.d.ts @@ -29,7 +29,7 @@ export type CreateSubscriptionActions = { /** Used to revise an existing subscription for client-side integrations. Accepts the same options as the request body of the [/v1/billing/subscription/{id}/revise api](https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_revise). */ revise: ( subscriptionID: string, - options: ReviseSubscriptionRequestBody + options: ReviseSubscriptionRequestBody, ) => Promise; }; }; @@ -211,14 +211,14 @@ export interface PayPalButtonsComponentOptions { */ createOrder?: ( data: CreateOrderData, - actions: CreateOrderActions + actions: CreateOrderActions, ) => Promise; /** * Called on button click to set up a recurring payment. [createSubscription docs](https://developer.paypal.com/docs/business/javascript-sdk/javascript-sdk-reference/#createsubscription). */ createSubscription?: ( data: Record, - actions: CreateSubscriptionActions + actions: CreateSubscriptionActions, ) => Promise; /** * Save payment methods to charge payers after a set amount of time. For example, you can offer a free trial and charge payers after the trial expires. Payers don't need to be present when charged. No checkout required. @@ -235,7 +235,7 @@ export interface PayPalButtonsComponentOptions { */ onApprove?: ( data: OnApproveData, - actions: OnApproveActions + actions: OnApproveActions, ) => Promise; /** * Called when the buyer cancels the transaction. @@ -243,14 +243,14 @@ export interface PayPalButtonsComponentOptions { */ onCancel?: ( data: Record, - actions: OnCancelledActions + actions: OnCancelledActions, ) => void; /** * Called when the button is clicked. Often used for [validation](https://developer.paypal.com/docs/checkout/integration-features/validation/). */ onClick?: ( data: Record, - actions: OnClickActions + actions: OnClickActions, ) => Promise | void; /** * Catch all for errors preventing buyer checkout. @@ -267,21 +267,21 @@ export interface PayPalButtonsComponentOptions { */ onShippingChange?: ( data: OnShippingChangeData, - actions: OnShippingChangeActions + actions: OnShippingChangeActions, ) => Promise; /** * Called when the buyer selects a new shipping option on PayPal. */ onShippingOptionsChange?: ( data: OnShippingOptionsChangeData, - actions: OnShippingOptionsChangeActions + actions: OnShippingOptionsChangeActions, ) => Promise; /** * Called when the buyer updates their shipping address on PayPal. */ onShippingAddressChange?: ( data: OnShippingAddressChangeData, - actions: OnShippingAddressChangeActions + actions: OnShippingAddressChangeActions, ) => Promise; /** * [Styling options](https://developer.paypal.com/docs/business/checkout/reference/style-guide/#customize-the-payment-buttons) for customizing the button appearance. From 55115e534ba2c511b8ef19d0d069fac1cd148ea5 Mon Sep 17 00:00:00 2001 From: Dan Haas Date: Thu, 6 Jun 2024 18:01:19 -0400 Subject: [PATCH 3/3] adds changeset --- .changeset/smart-foxes-trade.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/smart-foxes-trade.md diff --git a/.changeset/smart-foxes-trade.md b/.changeset/smart-foxes-trade.md new file mode 100644 index 00000000..a642f687 --- /dev/null +++ b/.changeset/smart-foxes-trade.md @@ -0,0 +1,5 @@ +--- +"@paypal/paypal-js": patch +--- + +updates PayPalButtonComponentOptions to add message