From 2f5433cfa57add4a03291d351bfb81b2cb9e99e8 Mon Sep 17 00:00:00 2001 From: jajjibhai008 Date: Thu, 17 Oct 2024 16:03:41 +0500 Subject: [PATCH] feat: updated the custom expiration model design and truly blocking --- .../expired-subscription-modal/index.jsx | 44 ++++++++++++++----- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/src/components/expired-subscription-modal/index.jsx b/src/components/expired-subscription-modal/index.jsx index d53430732..578878b5a 100644 --- a/src/components/expired-subscription-modal/index.jsx +++ b/src/components/expired-subscription-modal/index.jsx @@ -1,27 +1,47 @@ import { - StandardModal, useToggle, + useToggle, AlertModal, Button, ActionRow, } from '@openedx/paragon'; -import { Link } from 'react-router-dom'; import { useSubscriptions } from '../app/data'; const ExpiredSubscriptionModal = () => { const { data: { customerAgreement } } = useSubscriptions(); - const [isOpen, ,close] = useToggle(true); + const [isOpen] = useToggle(true); if (!customerAgreement?.hasCustomLicenseExpirationMessaging) { return null; } + const onClickHandler = () => { + let url = customerAgreement?.urlForButtonInModal; + + if (url) { + // Check if the URL starts with 'http://' or 'https://' + if (!url.startsWith('http://') && !url.startsWith('https://')) { + // Prepend 'https://' if the URL is missing the protocol + url = `https://${url}`; + } + + // Navigate to the full URL + window.open(url, '_blank'); // Opening in a new tab + } + }; return ( - {}} + isBlocking + footerNode={( + + + + )} > -

- {customerAgreement?.expiredSubscriptionModalMessaging} - {customerAgreement?.hyperLinkTextForExpiredModal} -

-
+ {/* eslint-disable-next-line react/no-danger */} +
+ ); };