Skip to content

Commit

Permalink
Fix: Loading logos when handling qrCode/await actions (#2490)
Browse files Browse the repository at this point in the history
* fix: getting proper logos for actions

* changeset
  • Loading branch information
ribeiroguilherme authored Dec 13, 2023
1 parent daeb705 commit d1c9282
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/fair-masks-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@adyen/adyen-web': patch
---

Loading the logo images properly when handling qrCode/await actions
3 changes: 2 additions & 1 deletion packages/lib/src/components/UIElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ export class UIElement<P extends UIElementProps = any> extends BaseElement<P> im
* Get the element icon URL for the current environment
*/
get icon(): string {
return this.props.icon ?? this.resources.getImage()(this.type);
const type = this.props.paymentMethodType || this.type;
return this.props.icon ?? this.resources.getImage()(type);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/src/components/internal/QRLoader/QRLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class QRLoader extends Component<QRLoaderProps, QRLoaderState> {
src={qrCodeImage}
alt={i18n.get('wechatpay.scanqrcode')}
onLoad={() => {
onActionHandled({ componentType: this.props.type, actionDescription: 'qr-code-loaded' });
onActionHandled?.({ componentType: this.props.type, actionDescription: 'qr-code-loaded' });
}}
/>

Expand Down
7 changes: 7 additions & 0 deletions packages/lib/src/components/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,13 @@ export interface UIElementProps extends BaseElementProps {
/** @internal */
clientKey?: string;

/**
* Returned after the payments call, when an action is returned. It represents the payment method tx variant
* that was used for the payment
* @internal
*/
paymentMethodType?: string;

/** @internal */
elementRef?: any;

Expand Down

0 comments on commit d1c9282

Please sign in to comment.