Skip to content

Commit

Permalink
handling action for klarna standalone component
Browse files Browse the repository at this point in the history
  • Loading branch information
ribeiroguilherme committed Jan 6, 2025
1 parent 2c6271f commit 9fc3a50
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/fresh-terms-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@adyen/adyen-web': patch
---

Klarna - Fix issue where Klarna as standalone component didn't initialize the Klarna Widget SDK accordingly
8 changes: 8 additions & 0 deletions packages/lib/src/components/Klarna/KlarnaPayments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ class KlarnaPayments extends UIElement<KlarnaConfiguration> {
return <PayButton amount={this.props.amount} onClick={this.submit} {...props} />;
};

public override handleAction(action: KlarnaAction, props = {}): UIElement | null {
if (action.type === 'sdk') {
this.updateWithAction(action);
return;
}
return super.handleAction(action, props);
}

updateWithAction(action: KlarnaAction): void {
if (action.paymentMethodType !== this.type) throw new Error('Invalid Action');
this.componentRef.setAction(action);
Expand Down

0 comments on commit 9fc3a50

Please sign in to comment.