From a3479a6dda34c1c89e61874168a289860c688484 Mon Sep 17 00:00:00 2001 From: Jacques Larique Date: Tue, 12 Nov 2024 10:49:41 +0100 Subject: [PATCH] feat(container): added aggreements modal and reviewed modals display ref: MANAGER-14722 Signed-off-by: Jacques Larique --- .../IdentityDocumentsModal.tsx | 1 + .../container/src/payment-modal/PaymentModal.tsx | 13 +++++-------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/manager/apps/container/src/identity-documents-modal/IdentityDocumentsModal.tsx b/packages/manager/apps/container/src/identity-documents-modal/IdentityDocumentsModal.tsx index 4ddc87d49bf6..e20edcd25c99 100644 --- a/packages/manager/apps/container/src/identity-documents-modal/IdentityDocumentsModal.tsx +++ b/packages/manager/apps/container/src/identity-documents-modal/IdentityDocumentsModal.tsx @@ -52,6 +52,7 @@ export const IdentityDocumentsModal: FunctionComponent = () => { setStorage(true); trackingPlugin.trackClick({ name: `${trackingPrefix}::pop-up::link::kyc::cancel`, + type: 'action', ...trackingContext, }); }; diff --git a/packages/manager/apps/container/src/payment-modal/PaymentModal.tsx b/packages/manager/apps/container/src/payment-modal/PaymentModal.tsx index 89eeffa58251..846410156c82 100644 --- a/packages/manager/apps/container/src/payment-modal/PaymentModal.tsx +++ b/packages/manager/apps/container/src/payment-modal/PaymentModal.tsx @@ -35,8 +35,8 @@ interface IPaymentMethod { paymentMethodId: number; } -const computeAlert = (paymentMethods: IPaymentMethod[]): string => { - const currentCreditCard: IPaymentMethod = paymentMethods?.find(currentPaymentMethod => currentPaymentMethod.paymentType === 'CREDIT_CARD' +const computeAlert = (paymentMethods: IPaymentMethod[] =[]): string => { + const currentCreditCard: IPaymentMethod = paymentMethods.find(currentPaymentMethod => currentPaymentMethod.paymentType === 'CREDIT_CARD' && currentPaymentMethod.default); if (currentCreditCard) { @@ -83,19 +83,16 @@ const PaymentModal = (): JSX.Element => { }); useEffect(() => { - if (paymentResponse) { - const alert = computeAlert(paymentResponse.data); + if (isReadyToRequest && !isLoading) { + const alert = computeAlert(paymentResponse?.data); if (alert) { setAlert(alert); setShowPaymentModal(true); } - else if (isReadyToRequest) { + else { shell.getPlugin('ux').notifyModalActionDone(); } } - else if (isReadyToRequest && !isLoading) { - shell.getPlugin('ux').notifyModalActionDone(); - } }, [paymentResponse, isReadyToRequest, isLoading]); return !showPaymentModal ? (