@adyen/adyen-web 5.58.0 → 5.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -126,6 +126,11 @@ export declare class CardElement extends UIElement<CardElementProps> {
126
126
  private handleClickToPaySubmit;
127
127
  onBinLookup(obj: CbObjOnBinLookup): void;
128
128
  onBinValue: (callbackObj: import("../internal/SecuredFields/lib/types").CbObjOnBinValue) => void;
129
+ get storePaymentMethodPayload(): {
130
+ storePaymentMethod?: undefined;
131
+ } | {
132
+ storePaymentMethod: boolean;
133
+ };
129
134
  get isValid(): boolean;
130
135
  get icon(): string;
131
136
  get brands(): {
@@ -6,19 +6,25 @@ import './Paypal.scss';
6
6
  declare class PaypalElement extends UIElement<PayPalElementProps> {
7
7
  static type: string;
8
8
  static subtype: string;
9
- private paymentData;
9
+ paymentData: string;
10
10
  private resolve;
11
11
  private reject;
12
12
  protected static defaultProps: PayPalElementProps;
13
13
  constructor(props: any);
14
14
  formatProps(props: PayPalElementProps): PayPalElementProps;
15
15
  submit: () => void;
16
+ /**
17
+ * Updates the paymentData value. It must be used in the PayPal Express flow, when patching the amount
18
+ * @param paymentData - Payment data value
19
+ */
20
+ updatePaymentData(paymentData: string): void;
16
21
  /**
17
22
  * Formats the component data output
18
23
  */
19
24
  protected formatData(): {
20
25
  paymentMethod: {
21
26
  type: string;
27
+ userAction: "continue" | "pay";
22
28
  subtype: string;
23
29
  };
24
30
  };
@@ -36,6 +42,24 @@ declare class PaypalElement extends UIElement<PayPalElementProps> {
36
42
  handleResolve(token: string): void;
37
43
  handleReject(errorMessage: string): void;
38
44
  private handleSubmit;
45
+ /**
46
+ * If the merchant provides the 'onShippingAddressChange' callback, then this method is used as a wrapper to it, in order
47
+ * to expose to the merchant the 'component' instance. The merchant needs the 'component' in order to manipulate the
48
+ * paymentData
49
+ *
50
+ * @param data - PayPal data
51
+ * @param actions - PayPal actions.
52
+ */
53
+ private handleOnShippingAddressChange;
54
+ /**
55
+ * If the merchant provides the 'onShippingOptionsChange' callback, then this method is used as a wrapper to it, in order
56
+ * to expose to the merchant the 'component' instance. The merchant needs the 'component' in order to manipulate the
57
+ * paymentData
58
+ *
59
+ * @param data - PayPal data
60
+ * @param actions - PayPal actions.
61
+ */
62
+ private handleOnShippingOptionsChange;
39
63
  render(): h.JSX.Element;
40
64
  }
41
65
  export default PaypalElement;
@@ -1,3 +1,3 @@
1
1
  import { h } from 'preact';
2
2
  import { PayPalButtonsProps } from '../types';
3
- export default function PaypalButtons({ onInit, onApprove, onClick, onCancel, onError, onShippingChange, onSubmit, isProcessingPayment, paypalRef, style, ...props }: PayPalButtonsProps): h.JSX.Element;
3
+ export default function PaypalButtons({ onInit, onApprove, onClick, onCancel, onError, onShippingChange, onShippingAddressChange, onShippingOptionsChange, onSubmit, isProcessingPayment, paypalRef, style, ...props }: PayPalButtonsProps): h.JSX.Element;
@@ -2,6 +2,7 @@ import { PaymentAmount, PaymentMethod, ShopperDetails } from '../../types';
2
2
  import UIElement from '../UIElement';
3
3
  import { UIElementProps } from '../types';
4
4
  import { SUPPORTED_LOCALES } from './config';
5
+ import PaypalElement from './Paypal';
5
6
  declare global {
6
7
  interface Window {
7
8
  paypal: object;
@@ -114,8 +115,23 @@ interface PayPalCommonProps {
114
115
  onClick?: () => void;
115
116
  /**
116
117
  * @see {@link https://developer.paypal.com/docs/business/javascript-sdk/javascript-sdk-reference/#onshippingchange}
118
+ * @deprecated - Use 'onShippingAddressChange' instead, as described in the PayPal docs
117
119
  */
118
120
  onShippingChange?: (data: any, actions: any) => void;
121
+ /**
122
+ * While the buyer is on the PayPal site, you can update their shopping cart to reflect the shipping address they chose on PayPal
123
+ * @see {@link https://developer.paypal.com/sdk/js/reference/#onshippingaddresschange}
124
+ */
125
+ onShippingAddressChange?: (data: any, actions: {
126
+ reject: (reason?: string) => Promise<void>;
127
+ }) => Promise<void>;
128
+ /**
129
+ * While the buyer is on the PayPal site, you can update their shopping cart to reflect the shipping options they chose on PayPal
130
+ * @see {@link https://developer.paypal.com/sdk/js/reference/#onshippingoptionschange}
131
+ */
132
+ onShippingOptionsChange?: (data: any, actions: {
133
+ reject: (reason?: string) => Promise<void>;
134
+ }) => Promise<void>;
119
135
  /**
120
136
  * Identifies if the payment is Express.
121
137
  * @defaultValue false
@@ -132,12 +148,39 @@ export interface PayPalConfig {
132
148
  */
133
149
  intent?: Intent;
134
150
  }
135
- export interface PayPalElementProps extends PayPalCommonProps, UIElementProps {
151
+ export interface PayPalElementProps extends Omit<PayPalCommonProps, 'onShippingAddressChange' | 'onShippingOptionsChange'>, UIElementProps {
136
152
  onSubmit?: (state: any, element: UIElement) => void;
137
153
  onComplete?: (state: any, element?: UIElement) => void;
138
154
  onAdditionalDetails?: (state: any, element: UIElement) => void;
139
155
  onCancel?: (state: any, element: UIElement) => void;
140
156
  onError?: (state: any, element?: UIElement) => void;
157
+ /**
158
+ * While the buyer is on the PayPal site, you can update their shopping cart to reflect the shipping address they chose on PayPal
159
+ * @see {@link https://developer.paypal.com/sdk/js/reference/#onshippingaddresschange}
160
+ *
161
+ * @param data - PayPal data object
162
+ * @param actions - Used to reject the address change in case the address is invalid
163
+ * @param component - Adyen instance of its PayPal implementation. It must be used to manipulate the 'paymentData' in order to apply the amount patch correctly
164
+ */
165
+ onShippingAddressChange?: (data: any, actions: {
166
+ reject: (reason?: string) => Promise<void>;
167
+ }, component: PaypalElement) => Promise<void>;
168
+ /**
169
+ * This callback is triggered any time the user selects a new shipping option.
170
+ * @see {@link https://developer.paypal.com/sdk/js/reference/#onshippingoptionschange}
171
+ *
172
+ * @param data - An PayPal object containing the payer’s selected shipping option
173
+ * @param actions - Used to indicates to PayPal that you will not support the shipping method selected by the buyer
174
+ * @param component - Adyen instance of its PayPal implementation. It must be used to manipulate the 'paymentData' in order to apply the amount patch correctly
175
+ */
176
+ onShippingOptionsChange?: (data: any, actions: {
177
+ reject: (reason?: string) => Promise<void>;
178
+ }, component: PaypalElement) => Promise<void>;
179
+ /**
180
+ * If set to 'continue' , the button inside the lightbox will display the 'Continue' button
181
+ * @default pay
182
+ */
183
+ userAction?: 'continue' | 'pay';
141
184
  onShopperDetails?(shopperDetails: ShopperDetails, rawData: any, actions: {
142
185
  resolve: () => void;
143
186
  reject: () => void;
package/package.json CHANGED
@@ -25,7 +25,7 @@
25
25
  "./dist/es/adyen.css": "./dist/es/adyen.css",
26
26
  "./package.json": "./package.json"
27
27
  },
28
- "version": "5.58.0",
28
+ "version": "5.59.0",
29
29
  "license": "MIT",
30
30
  "homepage": "https://docs.adyen.com/checkout",
31
31
  "repository": "github:Adyen/adyen-web",