Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Loading logos when handling qrCode/await actions #2490

Merged
merged 2 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Loading