@paypal/checkout-components
Advanced tools
Comparing version 4.1.44 to 4.1.45
{ | ||
"name": "@paypal/checkout-components", | ||
"version": "4.1.44", | ||
"version": "4.1.45", | ||
"description": "PayPal Checkout components, for integrating checkout products.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -24,3 +24,3 @@ /* @flow */ | ||
import { normalizeButtonStyle, type ButtonProps, type PrerenderDetails, type ButtonStyle, type ProxyRest, type CreateOrder, type OnCancel, type OnClick, | ||
type CreateOrderData, type CreateOrderActions, type OnApprove, type OnApproveActions, type OnApproveData, type GetPrerenderDetails, type OnClickData } from './props'; | ||
type CreateOrderData, type CreateOrderActions, type OnApprove, type OnApproveActions, type OnApproveData, type OnShippingChange, type GetPrerenderDetails, type OnClickData } from './props'; | ||
@@ -176,3 +176,7 @@ export const Buttons : ZoidComponent<ButtonProps> = create({ | ||
}, | ||
default() : CreateOrder { | ||
default({ props }) : ?CreateOrder { | ||
if (props.createBillingAgreement) { | ||
return; | ||
} | ||
return (data : CreateOrderData, actions : CreateOrderActions) => { | ||
@@ -204,2 +208,6 @@ return actions.order.create({ | ||
return ZalgoPromise.try(() => { | ||
if (!getVault()) { | ||
throw new Error(`Must pass vault=true to sdk to use billing agreement flow`); | ||
} | ||
// $FlowFixMe | ||
@@ -279,2 +287,36 @@ return value(); | ||
onShippingChange: { | ||
type: 'function', | ||
required: false, | ||
decorate({ value, props, onError }) : OnShippingChange { | ||
return function decorateOnShippingChange(data, actions = {}) : void | ZalgoPromise<void> { | ||
const logger = getLogger(); | ||
logger.info('button_shipping_change'); | ||
logger.track({ | ||
[ FPTI_KEY.STATE ]: FPTI_STATE.CHECKOUT, | ||
[ FPTI_KEY.TRANSITION ]: FPTI_TRANSITION.CHECKOUT_SHIPPING_CHANGE, | ||
[ FPTI_KEY.BUTTON_SESSION_UID ]: props.buttonSessionID | ||
}); | ||
logger.flush(); | ||
const resolve = () => ZalgoPromise.resolve(); | ||
const reject = actions.reject || function reject() { | ||
throw new Error(`Missing reject action callback`); | ||
}; | ||
return ZalgoPromise.try(() => { | ||
return value.call(this, data, { ...actions, resolve, reject }); | ||
}).catch(err => { | ||
if (onError) { | ||
onError(err); | ||
} | ||
throw err; | ||
}); | ||
}; | ||
} | ||
}, | ||
onCancel: { | ||
@@ -281,0 +323,0 @@ type: 'function', |
@@ -47,2 +47,34 @@ /* @flow */ | ||
type OnShippingChangeAddress = {| | ||
city : string, | ||
state : string, | ||
country_code : string, | ||
postal_code : string | ||
|}; | ||
type OnShippingChangeMethod = {| | ||
label : string, | ||
type : string, | ||
amount : { | ||
currency_code : string, | ||
value : string | ||
} | ||
|}; | ||
export type OnShippingChangeData = {| | ||
orderID : string, | ||
payerID : string, | ||
paymentID? : string, | ||
shipping_address : OnShippingChangeAddress, | ||
selected_shipping_method : OnShippingChangeMethod | ||
|}; | ||
export type OnShippingChangeActions = {| | ||
order : { | ||
patch : () => ZalgoPromise<OrderGetResponse> | ||
} | ||
|}; | ||
export type OnShippingChange = (data : OnShippingChangeData, actions : OnShippingChangeActions) => ZalgoPromise<void> | void; | ||
export type OnCancelData = {| | ||
@@ -49,0 +81,0 @@ orderID : string, |
@@ -14,2 +14,3 @@ /* @flow */ | ||
display: inline-block; | ||
vertical-align: top; | ||
} | ||
@@ -16,0 +17,0 @@ |
@@ -198,2 +198,7 @@ /* @flow */ | ||
onShippingChange: { | ||
type: 'function', | ||
required: false | ||
}, | ||
onAuth: { | ||
@@ -200,0 +205,0 @@ type: 'function', |
@@ -26,6 +26,7 @@ /* @flow */ | ||
CHECKOUT_INIT: ('process_checkout_init' : 'process_checkout_init'), | ||
CHECKOUT_AUTHORIZE: ('process_checkout_authorize' : 'process_checkout_authorize'), | ||
CHECKOUT_CANCEL: ('process_checkout_cancel' : 'process_checkout_cancel'), | ||
CHECKOUT_ERROR: ('process_checkout_error' : 'process_checkout_error'), | ||
CHECKOUT_INIT: ('process_checkout_init' : 'process_checkout_init'), | ||
CHECKOUT_AUTHORIZE: ('process_checkout_authorize' : 'process_checkout_authorize'), | ||
CHECKOUT_SHIPPING_CHANGE: ('process_checkout_shipping_change' : 'process_checkout_shipping_change'), | ||
CHECKOUT_CANCEL: ('process_checkout_cancel' : 'process_checkout_cancel'), | ||
CHECKOUT_ERROR: ('process_checkout_error' : 'process_checkout_error'), | ||
@@ -32,0 +33,0 @@ EXTERNAL_EXPERIMENT: ('process_external_experiment' : 'process_external_experiment'), |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
421949
3852