From a7e6caa58a5285f630b42b66e629d7a1654ed23e Mon Sep 17 00:00:00 2001 From: nidhigarg-bmw <101316912+nidhigarg-bmw@users.noreply.github.com> Date: Thu, 31 Aug 2023 14:38:39 +0530 Subject: [PATCH] fix(app subscription): fix api error and validation (#244) --- .../AppSubscription/ActivateSubscriptionOverlay/index.tsx | 4 ++-- .../shared/templates/Subscription/SubscriptionElements.tsx | 2 +- src/types/Patterns.ts | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/pages/AppSubscription/ActivateSubscriptionOverlay/index.tsx b/src/components/pages/AppSubscription/ActivateSubscriptionOverlay/index.tsx index b5abe0fa7..05479c3d8 100644 --- a/src/components/pages/AppSubscription/ActivateSubscriptionOverlay/index.tsx +++ b/src/components/pages/AppSubscription/ActivateSubscriptionOverlay/index.tsx @@ -32,7 +32,7 @@ import { } from '@catena-x/portal-shared-components' import HelpOutlineIcon from '@mui/icons-material/HelpOutline' import { useTranslation, Trans } from 'react-i18next' -import { isURL } from 'types/Patterns' +import { isKeycloakURL } from 'types/Patterns' import CheckCircleOutlinedIcon from '@mui/icons-material/CheckCircleOutlined' import { SubscriptionActivationResponse, @@ -86,7 +86,7 @@ const ActivateSubscriptionOverlay = ({ const addInputURL = (value: string) => { setInputURL(value) setURLErrorMessage( - !isURL(value.trim()) + !isKeycloakURL(value.trim()) ? t('content.appSubscription.pleaseEnterValidURL') : '' ) diff --git a/src/components/shared/templates/Subscription/SubscriptionElements.tsx b/src/components/shared/templates/Subscription/SubscriptionElements.tsx index 147e8e326..df22c1d6a 100644 --- a/src/components/shared/templates/Subscription/SubscriptionElements.tsx +++ b/src/components/shared/templates/Subscription/SubscriptionElements.tsx @@ -266,7 +266,7 @@ export default function SubscriptionElements({ }} /> )} - {viewDetails && ( + {viewDetails.appId && ( Patterns.MAIL.test(expr) export const isBPN = (expr: string) => Patterns.BPN.test(expr) export const isDomain = (expr: string) => Patterns.DOMAIN.test(expr) export const isURL = (expr: string) => Patterns.URL.test(expr) +export const isKeycloakURL = (expr: string) => + isURL(expr) && !expr.includes('#') export const isUUID = (expr: string) => Patterns.UUID.test(expr) export const isCompanyName = (expr: string) => Patterns.COMPANY_NAME.test(expr) export const isFirstName = (expr: string) => Patterns.firstName.test(expr)