feat: usage and billing ce (#20653)

### Description
 - Removes feature flags for usage & billing.
 - moves pricing url to constant.

---------

Co-authored-by: Vishnu Gp <vishnu@appsmith.com>
This commit is contained in:
Sangeeth Sivan 2023-02-20 22:29:06 +05:30 committed by GitHub
parent 6282932c89
commit 872f799778
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 24 additions and 60 deletions

View File

@ -8,8 +8,6 @@ import { useParams } from "react-router";
import { Icon, IconSize } from "design-system-old";
import { createMessage } from "design-system-old/build/constants/messages";
import { UPGRADE } from "@appsmith/constants/messages";
import { useSelector } from "react-redux";
import { selectFeatureFlags } from "selectors/usersSelectors";
import AnalyticsUtil from "utils/AnalyticsUtil";
import camelCase from "lodash/camelCase";
@ -136,7 +134,6 @@ export function Categories({
}
export default function LeftPane() {
const features = useSelector(selectFeatureFlags);
const categories = getSettingsCategory();
const { category, selected: subCategory } = useParams() as any;
@ -184,21 +181,19 @@ export default function LeftPane() {
<div>Audit logs</div>
</StyledLink>
</CategoryItem>
{features.USAGE_AND_BILLING && (
<CategoryItem>
<StyledLink
$active={category === "business-edition"}
data-testid="t--enterprise-settings-category-item-be"
onClick={() => triggerAnalytics("BusinessEdition")}
to="/settings/business-edition"
>
<div>
<Icon name="arrow-up-line" size={IconSize.XL} />
</div>
<div>{camelCase(createMessage(UPGRADE))}</div>
</StyledLink>
</CategoryItem>
)}
<CategoryItem>
<StyledLink
$active={category === "business-edition"}
data-testid="t--enterprise-settings-category-item-be"
onClick={() => triggerAnalytics("BusinessEdition")}
to="/settings/business-edition"
>
<div>
<Icon name="arrow-up-line" size={IconSize.XL} />
</div>
<div>{camelCase(createMessage(UPGRADE))}</div>
</StyledLink>
</CategoryItem>
</CategoryList>
</HeaderContainer>
</Wrapper>

View File

@ -22,7 +22,7 @@ import useOnUpgrade from "utils/hooks/useOnUpgrade";
export function AccessControlUpgradePage() {
const { onUpgrade } = useOnUpgrade({
logEventName: "ADMIN_SETTINGS_UPGRADE_HOOK",
logEventName: "GAC_UPGRADE_CLICK_ADMIN_SETTINGS",
logEventData: { source: "Granular Access Control" },
intercomMessage: createMessage(
UPGRADE_TO_EE_FEATURE,

View File

@ -23,7 +23,7 @@ import useOnUpgrade from "utils/hooks/useOnUpgrade";
export function AuditLogsUpgradePage() {
const { onUpgrade } = useOnUpgrade({
logEventName: "ADMIN_SETTINGS_UPGRADE_HOOK",
logEventName: "AUDIT_LOGS_UPGRADE_ADMIN_SETTINGS",
logEventData: { source: "AuditLogs" },
intercomMessage: createMessage(UPGRADE_TO_EE_FEATURE, "Audit Logs"),
});

View File

@ -15,7 +15,6 @@ import history from "utils/history";
export const redirectUserAfterSignup = (
redirectUrl: string,
shouldEnableFirstTimeUserOnboarding: string | null,
_isUsageAndBillingEnabled: boolean | undefined,
_validLicense?: boolean,
dispatch?: any,
): any => {

View File

@ -21,3 +21,5 @@ export const EMAIL_SETUP_DOC =
"https://docs.appsmith.com/getting-started/setup/instance-configuration/email";
export const SIGNUP_RESTRICTION_DOC =
"https://docs.appsmith.com/getting-started/setup/instance-configuration/disable-user-signup#disable-sign-up";
export const PRICING_PAGE_URL = (source: string, instanceId: string) =>
`https://www.appsmith.com/pricing?source=${source}&instance=${instanceId}`;

View File

@ -5,7 +5,7 @@ import React from "react";
import { useCallback } from "react";
import { useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
import { getCurrentUser, selectFeatureFlags } from "selectors/usersSelectors";
import { getCurrentUser } from "selectors/usersSelectors";
import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
@ -22,8 +22,6 @@ export function SignupSuccess() {
const shouldEnableFirstTimeUserOnboarding = urlObject?.searchParams.get(
"enableFirstTimeUserExperience",
);
const isUsageAndBillingEnabled = useSelector(selectFeatureFlags)
?.USAGE_AND_BILLING;
const validLicense = useSelector(isValidLicense);
useEffect(() => {
PerformanceTracker.stopTracking(PerformanceTransactionName.SIGN_UP);
@ -34,7 +32,6 @@ export function SignupSuccess() {
redirectUserAfterSignup(
redirectUrl,
shouldEnableFirstTimeUserOnboarding,
isUsageAndBillingEnabled,
validLicense,
dispatch,
),

View File

@ -229,6 +229,8 @@ export type EventName =
| "ADMIN_SETTINGS_ENABLE_AUTH_METHOD"
| "ADMIN_SETTINGS_UPGRADE_HOOK"
| "BILLING_UPGRADE_ADMIN_SETTINGS"
| "AUDIT_LOGS_UPGRADE_ADMIN_SETTINGS"
| "GAC_UPGRADE_CLICK_ADMIN_SETTINGS"
| "REFLOW_BETA_FLAG"
| "CONTAINER_JUMP"
| "CONNECT_GIT_CLICK"

View File

@ -1,15 +1,8 @@
import { getAppsmithConfigs } from "@appsmith/configs";
import {
createMessage,
UPGRADE_TO_EE_GENERIC,
} from "@appsmith/constants/messages";
import { getInstanceId } from "@appsmith/selectors/tenantSelectors";
import { useSelector } from "react-redux";
import { selectFeatureFlags } from "selectors/usersSelectors";
import { getInstanceId } from "@appsmith/selectors/tenantSelectors";
import { PRICING_PAGE_URL } from "constants/ThirdPartyConstants";
import AnalyticsUtil, { EventName } from "utils/AnalyticsUtil";
const { intercomAppID } = getAppsmithConfigs();
type Props = {
intercomMessage?: string;
logEventName?: EventName;
@ -17,29 +10,15 @@ type Props = {
};
const useOnUpgrade = (props: Props) => {
const { intercomMessage, logEventData, logEventName } = props;
const features = useSelector(selectFeatureFlags);
const { logEventData, logEventName } = props;
const instanceId = useSelector(getInstanceId);
const triggerIntercom = (message: string) => {
if (intercomAppID && window.Intercom) {
window.Intercom("showNewMessage", message);
}
};
const onUpgrade = () => {
AnalyticsUtil.logEvent(
logEventName || "ADMIN_SETTINGS_UPGRADE",
logEventData,
);
if (features.USAGE_AND_BILLING) {
window.open(
`https://www.appsmith.com/api/preview?secret=8JPsJRnSkt6Va8FzxUPFhZezxZuHRnSU&slug=pricing-preview?source=CE&instance=${instanceId}`,
"_blank",
);
} else {
triggerIntercom(intercomMessage || createMessage(UPGRADE_TO_EE_GENERIC));
}
window.open(PRICING_PAGE_URL("CE", instanceId), "_blank");
};
return { onUpgrade };

View File

@ -37,5 +37,4 @@ public enum FeatureFlagEnum {
// Put EE flags below this line, to avoid conflicts.
RBAC,
USAGE_AND_BILLING,
}

View File

@ -108,15 +108,6 @@ ff4j:
- name: emailDomains
value: appsmith.com
- uid: USAGE_AND_BILLING
enable: true
description: Enable usage and billing
flipstrategy:
class: com.appsmith.server.featureflags.strategies.EmailBasedRolloutStrategy
param:
- name: emails
value: usage@appsmith.com,usage1@appsmith.com
- uid: LAZY_CANVAS_RENDERING
enable: true
description: Enable Canvas to lazily render widgets below the fold