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

Use built-in mechanism to disable OpenInvoice when Pay pressed #3142

Merged
merged 3 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,10 @@
.adyen-checkout__open-invoice .adyen-checkout__field--consentCheckbox {
margin-top: token(spacer-070);
}

.adyen-checkout__open-invoice{
&--loading{
@include index.adyen-checkout-component-loading;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import Field from '../FormFields/Field';
import FormInstruction from '../FormInstruction';
import { ComponentMethodsRef } from '../UIElement/types';
import useSRPanelForOpenInvoiceErrors from './useSRPanelForOpenInvoiceErrors';
import classNames from 'classnames';

const consentCBErrorObj: GenericError = {
isValid: false,
Expand Down Expand Up @@ -111,7 +112,12 @@ export default function OpenInvoice(props: OpenInvoiceProps) {
setErrors(prevErrors => ({ ...prevErrors, ...{ consentCheckbox: !checked ? consentCBErrorObj : null } }));
};
return (
<div className="adyen-checkout__open-invoice">
<div
className={classNames({
'adyen-checkout__open-invoice': true,
'adyen-checkout__open-invoice--loading': status === 'loading'
})}
>
<FormInstruction />

{activeFieldsets.companyDetails && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,17 @@ export abstract class UIElement<P extends UIElementProps = UIElementProps> exten
return this;
}

/**
* elementRef is a ref to the subclass that extends UIElement e.g. Card.tsx
*/
public setElementStatus(status: UIElementStatus, props?: any): this {
this.elementRef?.setStatus(status, props);
return this;
}

/**
* componentRef is a ref to the primary component inside that subclass e.g. CardInput.tsx
*/
public setStatus(status: UIElementStatus, props?): this {
if (this.componentRef?.setStatus) {
this.componentRef.setStatus(status, props);
Expand Down
4 changes: 4 additions & 0 deletions packages/lib/src/styles/mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,7 @@ $adyen-checkout-media-query-l-min: 1024px;
padding: 0;
position: absolute;
}

@mixin adyen-checkout-component-loading {
pointer-events: none;
}
Loading