diff --git a/packages/lib/src/components/Dropin/components/DropinComponent.tsx b/packages/lib/src/components/Dropin/components/DropinComponent.tsx index b5b85e62d..7385d04ed 100644 --- a/packages/lib/src/components/Dropin/components/DropinComponent.tsx +++ b/packages/lib/src/components/Dropin/components/DropinComponent.tsx @@ -58,10 +58,19 @@ export class DropinComponent extends Component { + // console.log('\n### DropinComponent::setActivePaymentMethod:: cachedPaymentMethods', this.state.cachedPaymentMethods); this.setState(prevState => ({ activePaymentMethod: paymentMethod, cachedPaymentMethods: { ...prevState.cachedPaymentMethods, [paymentMethod._id]: true } })); + + for (const [key] of Object.entries(this.state.cachedPaymentMethods)) { + if (key === paymentMethod._id) { + // console.log('### DropinComponent::setActivePaymentMethod:: payment method is cached=', key); + paymentMethod.onPaymentMethodActive(); + break; + } + } }; componentDidUpdate(prevProps, prevState) { diff --git a/packages/lib/src/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.tsx b/packages/lib/src/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.tsx index c784c50b7..73ba57693 100644 --- a/packages/lib/src/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.tsx +++ b/packages/lib/src/components/Dropin/components/PaymentMethod/PaymentMethodItem/PaymentMethodItem.tsx @@ -84,9 +84,9 @@ class PaymentMethodItem extends Component { const showBrands = !paymentMethod.props.oneClick && paymentMethod.brands && paymentMethod.brands.length > 0; return ( - // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions -
-
+
+ {/*eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions*/} +
{ this.setElementStatus('ready'); } + protected onPaymentMethodActive() { + // TODO do something to reinit the PM + } + render() { return ( diff --git a/packages/lib/src/components/internal/UIElement/UIElement.tsx b/packages/lib/src/components/internal/UIElement/UIElement.tsx index 7fbdeee91..e12b1771c 100644 --- a/packages/lib/src/components/internal/UIElement/UIElement.tsx +++ b/packages/lib/src/components/internal/UIElement/UIElement.tsx @@ -124,6 +124,10 @@ export abstract class UIElement

exten return this; } + protected onPaymentMethodActive() { + return null; + } + protected onChange(): void { this.props.onChange?.( {