From bee20912fd139a6513f142e1125fb91f001142b8 Mon Sep 17 00:00:00 2001 From: Ankita Kinger Date: Tue, 8 Apr 2025 13:57:47 +0530 Subject: [PATCH] chore: Updating upgrade link for cloud billing (#40156) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Updating upgrade link for cloud billing Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.Settings" ### :mag: Cypress test results > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: 7502e28220824eba1461cb9f981be9392f3efea8 > Cypress dashboard. > Tags: `@tag.Settings` > Spec: >
Tue, 08 Apr 2025 08:22:33 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No ## Summary by CodeRabbit - **New Features** - Adjusted link behavior so that when multi-organization features are active, users are directed to a dedicated settings page. - Enhanced the upgrade process to detect cloud billing activation and open the appropriate licensing page for a more seamless experience. --- app/client/src/ce/selectors/rampSelectors.tsx | 41 ++++++++++++------- app/client/src/utils/hooks/useOnUpgrade.ts | 5 +++ 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/app/client/src/ce/selectors/rampSelectors.tsx b/app/client/src/ce/selectors/rampSelectors.tsx index 06f755382c..e2a56fc417 100644 --- a/app/client/src/ce/selectors/rampSelectors.tsx +++ b/app/client/src/ce/selectors/rampSelectors.tsx @@ -11,6 +11,9 @@ import { } from "utils/ProductRamps/RampsControlList"; import type { EnvTypes } from "utils/ProductRamps/RampTypes"; import { isPermitted, PERMISSION_TYPE } from "ee/utils/permissionHelpers"; +import { selectFeatureFlags } from "./featureFlagsSelectors"; +import { isMultiOrgFFEnabled } from "ee/utils/planHelpers"; +import { WORKSPACE_SETTINGS_LICENSE_PAGE_URL } from "constants/routes"; const { cloudHosting, customerPortalUrl, pricingUrl } = getAppsmithConfigs(); @@ -26,21 +29,31 @@ export const getRampLink = ({ feature: string; isBusinessFeature?: boolean; }) => - createSelector(organizationState, (organization) => { - const instanceId = organization?.instanceId; - const source = cloudHosting ? "cloud" : "CE"; - const RAMP_LINK_TO = isBusinessFeature - ? CUSTOMER_PORTAL_URL_WITH_PARAMS( - customerPortalUrl, - source, - instanceId, - feature, - section, - ) - : PRICING_PAGE_URL(pricingUrl, source, instanceId, feature, section); + createSelector( + organizationState, + selectFeatureFlags, + (organization, featureFlags) => { + const instanceId = organization?.instanceId; + const source = cloudHosting ? "cloud" : "CE"; + const isCloudBillingEnabled = isMultiOrgFFEnabled(featureFlags); - return RAMP_LINK_TO; - }); + if (isCloudBillingEnabled) { + return WORKSPACE_SETTINGS_LICENSE_PAGE_URL; + } + + const RAMP_LINK_TO = isBusinessFeature + ? CUSTOMER_PORTAL_URL_WITH_PARAMS( + customerPortalUrl, + source, + instanceId, + feature, + section, + ) + : PRICING_PAGE_URL(pricingUrl, source, instanceId, feature, section); + + return RAMP_LINK_TO; + }, + ); export const showProductRamps = ( rampName: string, diff --git a/app/client/src/utils/hooks/useOnUpgrade.ts b/app/client/src/utils/hooks/useOnUpgrade.ts index 372c939321..2c8026f27a 100644 --- a/app/client/src/utils/hooks/useOnUpgrade.ts +++ b/app/client/src/utils/hooks/useOnUpgrade.ts @@ -12,6 +12,8 @@ import type { RampFeature, RampSection, } from "utils/ProductRamps/RampsControlList"; +import { useIsCloudBillingEnabled } from "hooks"; +import { WORKSPACE_SETTINGS_LICENSE_PAGE_URL } from "constants/routes"; interface Props { logEventName?: EventName; @@ -28,6 +30,7 @@ const useOnUpgrade = (props: Props) => { props; const instanceId = useSelector(getInstanceId); const appsmithConfigs = getAppsmithConfigs(); + const isCloudBillingEnabled = useIsCloudBillingEnabled(); const onUpgrade = () => { AnalyticsUtil.logEvent( @@ -45,6 +48,8 @@ const useOnUpgrade = (props: Props) => { sectionName, ), ); + } else if (isCloudBillingEnabled) { + window.open(WORKSPACE_SETTINGS_LICENSE_PAGE_URL, "_blank"); } else { window.open( CUSTOMER_PORTAL_URL_WITH_PARAMS(