import React from "react";
import { useSelector } from "react-redux";
import { Text, Link, Button } from "design-system";
import { PRICING_PAGE_URL } from "constants/ThirdPartyConstants";
import {
createMessage,
IN_APP_EMBED_SETTING,
} from "@appsmith/constants/messages";
import {
isPermitted,
PERMISSION_TYPE,
} from "@appsmith/utils/permissionHelpers";
import { getAppsmithConfigs } from "@appsmith/configs";
import { getInstanceId } from "@appsmith/selectors/tenantSelectors";
import styled from "styled-components";
const StyledLink = styled(Link)`
text-decoration: underline !important;
display: inline;
`;
function PrivateEmbeddingContent(props: {
userAppPermissions: any[];
changeTab?: () => void;
isAppSettings?: boolean;
}) {
const { changeTab, isAppSettings = false } = props;
const canMakeAppPublic = isPermitted(
props.userAppPermissions,
PERMISSION_TYPE.MAKE_PUBLIC_APPLICATION,
);
if (isAppSettings)
return ;
return (
);
}
export default PrivateEmbeddingContent;
function EmbeddedLink() {
const appsmithConfigs = getAppsmithConfigs();
const instanceId = useSelector(getInstanceId);
return (
{createMessage(IN_APP_EMBED_SETTING.upgradeContent)}
{
window.open(
PRICING_PAGE_URL(
appsmithConfigs.pricingUrl,
appsmithConfigs.cloudHosting ? "Cloud" : "CE",
instanceId,
),
"_blank",
);
}}
rel="noreferrer"
to="#"
>
{createMessage(IN_APP_EMBED_SETTING.appsmithBusinessEdition)}
);
}
function AppSettingsContent({
canMakeAppPublic,
}: {
canMakeAppPublic: boolean;
}) {
return (
{createMessage(IN_APP_EMBED_SETTING.embed)}
{canMakeAppPublic
? createMessage(IN_APP_EMBED_SETTING.secondaryHeadingForAppSettings)
: createMessage(IN_APP_EMBED_SETTING.secondaryHeading)}
);
}
function SnippetTabContent({
canMakeAppPublic,
changeTab,
}: {
canMakeAppPublic: boolean;
changeTab?: () => void;
}) {
return (
{canMakeAppPublic
? createMessage(IN_APP_EMBED_SETTING.upgradeHeadingForInviteModal)
: createMessage(IN_APP_EMBED_SETTING.upgradeHeading)}
{canMakeAppPublic && (
)}
);
}