2023-06-01 14:06:57 +00:00
|
|
|
import React, { useEffect, useState } from "react";
|
2021-03-08 08:24:12 +00:00
|
|
|
|
|
|
|
|
import { HELP_MODAL_WIDTH } from "constants/HelpConstants";
|
2024-08-06 14:52:22 +00:00
|
|
|
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
|
2022-04-12 10:50:01 +00:00
|
|
|
import { getCurrentUser } from "selectors/usersSelectors";
|
2023-06-01 14:06:57 +00:00
|
|
|
import { useDispatch, useSelector } from "react-redux";
|
|
|
|
|
import bootIntercom, { updateIntercomProperties } from "utils/bootIntercom";
|
2022-02-11 18:08:46 +00:00
|
|
|
import {
|
2023-05-19 18:37:06 +00:00
|
|
|
APPSMITH_DISPLAY_VERSION,
|
2023-06-01 14:06:57 +00:00
|
|
|
CONTINUE,
|
2022-02-11 18:08:46 +00:00
|
|
|
createMessage,
|
|
|
|
|
HELP_RESOURCE_TOOLTIP,
|
2023-06-01 14:06:57 +00:00
|
|
|
INTERCOM_CONSENT_MESSAGE,
|
2024-08-06 14:52:22 +00:00
|
|
|
} from "ee/constants/messages";
|
2023-05-19 18:37:06 +00:00
|
|
|
import {
|
|
|
|
|
Button,
|
|
|
|
|
Menu,
|
|
|
|
|
MenuContent,
|
|
|
|
|
MenuItem,
|
|
|
|
|
MenuTrigger,
|
|
|
|
|
Tooltip,
|
|
|
|
|
MenuSeparator,
|
2023-06-01 14:06:57 +00:00
|
|
|
Text,
|
2024-08-09 14:20:29 +00:00
|
|
|
} from "@appsmith/ads";
|
2024-08-06 14:52:22 +00:00
|
|
|
import { getAppsmithConfigs } from "ee/configs";
|
2023-05-19 18:37:06 +00:00
|
|
|
import moment from "moment/moment";
|
|
|
|
|
import styled from "styled-components";
|
2023-06-22 13:05:01 +00:00
|
|
|
import {
|
|
|
|
|
getFirstTimeUserOnboardingModal,
|
|
|
|
|
getIsFirstTimeUserOnboardingEnabled,
|
|
|
|
|
getSignpostingSetOverlay,
|
|
|
|
|
getSignpostingTooltipVisible,
|
|
|
|
|
getSignpostingUnreadSteps,
|
|
|
|
|
} from "selectors/onboardingSelectors";
|
|
|
|
|
import SignpostingPopup from "pages/Editor/FirstTimeUserOnboarding/Modal";
|
|
|
|
|
import { showSignpostingModal } from "actions/onboardingActions";
|
|
|
|
|
import TooltipContent from "./FirstTimeUserOnboarding/TooltipContent";
|
chore: Migrate Tenant to Organization (#38891)
## Description
> [!TIP]
> _Add a TL;DR when the description is longer than 500 words or
extremely technical (helps the content, marketing, and DevRel team)._
>
> _Please also include relevant motivation and context. List any
dependencies that are required for this change. Add links to Notion,
Figma or any other documents that might be relevant to the PR._
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
/test all
### :mag: Cypress test results
<!-- This is an auto-generated comment: Cypress test results -->
> [!CAUTION]
> 🔴 🔴 🔴 Some tests have failed.
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/13391658708>
> Commit: d30db4487d93622533aec846a17fecea12e0205e
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13391658708&attempt=1&selectiontype=test&testsstatus=failed&specsstatus=fail"
target="_blank">Cypress dashboard</a>.
> Tags: @tag.All
> Spec:
> The following are new failures, please fix them before merging the PR:
<ol>
>
<li>cypress/e2e/Regression/ClientSide/ActionExecution/FrameworkFunctions_LocalStoreValueFunctions_spec.ts
>
<li>cypress/e2e/Regression/ClientSide/SetProperty/WidgetPropertySetters2_spec.ts
>
<li>cypress/e2e/Regression/ClientSide/Widgets/TableV2/table_data_change_spec.ts</ol>
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/identified-flaky-tests-65890b3c81d7400d08fa9ee3?branch=master"
target="_blank">List of identified flaky tests</a>.
> <hr>Tue, 18 Feb 2025 14:35:32 UTC
<!-- end of auto-generated comment: Cypress test results -->
## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Introduced organization-level configuration management, impacting
admin settings, login, and branding displays.
- Enhanced handling of permissions and feature flags now centered on
organizations.
- **Refactor**
- Updated user-facing terminology across the application from “tenant”
to “organization” (e.g., in dashboards, profile settings, error pages,
and admin panels).
- Refactored multiple components and services to utilize
organization-based logic instead of tenant-based logic.
- **Chore**
- Deployed comprehensive migration scripts to seamlessly transition all
settings and cached data to the new organization model.
These updates improve consistency and clarity in how configurations and
permissions are managed and presented.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-02-18 15:11:07 +00:00
|
|
|
import { getInstanceId } from "ee/selectors/organizationSelectors";
|
2023-06-01 14:06:57 +00:00
|
|
|
import { updateIntercomConsent, updateUserDetails } from "actions/userActions";
|
2025-05-13 12:06:58 +00:00
|
|
|
import { getIsAiAgentApp } from "ee/selectors/aiAgentSelectors";
|
2025-04-08 06:35:03 +00:00
|
|
|
import { DOCS_AI_BASE_URL } from "constants/ThirdPartyConstants";
|
2021-03-08 08:24:12 +00:00
|
|
|
|
2023-05-19 18:37:06 +00:00
|
|
|
const { appVersion, cloudHosting, intercomAppID } = getAppsmithConfigs();
|
2021-03-08 08:24:12 +00:00
|
|
|
|
2023-05-19 18:37:06 +00:00
|
|
|
const HelpFooter = styled.div`
|
2021-03-08 08:24:12 +00:00
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2023-05-19 18:37:06 +00:00
|
|
|
justify-content: space-between;
|
|
|
|
|
font-size: 8px;
|
2021-03-08 08:24:12 +00:00
|
|
|
`;
|
2023-06-22 13:05:01 +00:00
|
|
|
const UnreadSteps = styled.div`
|
|
|
|
|
position: absolute;
|
|
|
|
|
height: 6px;
|
|
|
|
|
width: 6px;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
top: 10px;
|
|
|
|
|
left: 22px;
|
|
|
|
|
background-color: var(--ads-v2-color-fg-error);
|
|
|
|
|
`;
|
2023-06-01 14:06:57 +00:00
|
|
|
const ConsentContainer = styled.div`
|
|
|
|
|
padding: 10px;
|
|
|
|
|
`;
|
|
|
|
|
const ActionsRow = styled.div`
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
margin-bottom: 8px;
|
|
|
|
|
`;
|
2023-06-22 13:05:01 +00:00
|
|
|
|
2023-10-11 07:35:24 +00:00
|
|
|
interface HelpItem {
|
2023-05-19 18:37:06 +00:00
|
|
|
label: string;
|
|
|
|
|
link?: string;
|
|
|
|
|
id?: string;
|
|
|
|
|
icon: string;
|
2023-10-11 07:35:24 +00:00
|
|
|
}
|
2023-05-19 18:37:06 +00:00
|
|
|
|
2025-04-10 05:13:01 +00:00
|
|
|
let HELP_MENU_ITEMS: HelpItem[] = [
|
2023-05-19 18:37:06 +00:00
|
|
|
{
|
2023-06-22 13:05:01 +00:00
|
|
|
icon: "book-line",
|
2023-05-19 18:37:06 +00:00
|
|
|
label: "Documentation",
|
|
|
|
|
link: "https://docs.appsmith.com/",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
icon: "bug-line",
|
|
|
|
|
label: "Report a bug",
|
|
|
|
|
link: "https://github.com/appsmithorg/appsmith/issues/new/choose",
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
if (intercomAppID && window.Intercom) {
|
|
|
|
|
HELP_MENU_ITEMS.push({
|
|
|
|
|
icon: "chat-help",
|
|
|
|
|
label: "Chat with us",
|
|
|
|
|
id: "intercom-trigger",
|
|
|
|
|
});
|
|
|
|
|
}
|
2021-03-08 08:24:12 +00:00
|
|
|
|
2023-06-22 13:05:01 +00:00
|
|
|
export function IntercomConsent({
|
2023-06-01 14:06:57 +00:00
|
|
|
showIntercomConsent,
|
|
|
|
|
}: {
|
|
|
|
|
showIntercomConsent: (val: boolean) => void;
|
|
|
|
|
}) {
|
|
|
|
|
const user = useSelector(getCurrentUser);
|
|
|
|
|
const instanceId = useSelector(getInstanceId);
|
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
|
2024-10-20 03:46:25 +00:00
|
|
|
const sendUserDataToIntercom = async () => {
|
2023-12-19 12:38:33 +00:00
|
|
|
const { email } = user || {};
|
2024-09-18 16:35:28 +00:00
|
|
|
|
2023-06-01 14:06:57 +00:00
|
|
|
updateIntercomProperties(instanceId, user);
|
|
|
|
|
dispatch(
|
|
|
|
|
updateUserDetails({
|
|
|
|
|
intercomConsentGiven: true,
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
dispatch(updateIntercomConsent());
|
|
|
|
|
showIntercomConsent(false);
|
2023-12-19 12:38:33 +00:00
|
|
|
|
|
|
|
|
if (user?.enableTelemetry) {
|
2024-10-20 03:46:25 +00:00
|
|
|
await AnalyticsUtil.identifyUser(user, true);
|
2023-12-19 12:38:33 +00:00
|
|
|
AnalyticsUtil.logEvent("SUPPORT_REQUEST_INITIATED", {
|
|
|
|
|
email,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-01 14:06:57 +00:00
|
|
|
window.Intercom("show");
|
|
|
|
|
};
|
2024-09-18 16:35:28 +00:00
|
|
|
|
2023-06-01 14:06:57 +00:00
|
|
|
return (
|
|
|
|
|
<ConsentContainer>
|
|
|
|
|
<ActionsRow>
|
|
|
|
|
<Button
|
|
|
|
|
isIconButton
|
|
|
|
|
kind="tertiary"
|
|
|
|
|
onClick={() => showIntercomConsent(false)}
|
|
|
|
|
size="sm"
|
|
|
|
|
startIcon="arrow-left"
|
|
|
|
|
/>
|
|
|
|
|
</ActionsRow>
|
|
|
|
|
<div className="mb-3" data-testid="t--intercom-consent-text">
|
|
|
|
|
<Text kind="body-s" renderAs="p">
|
|
|
|
|
{createMessage(INTERCOM_CONSENT_MESSAGE)}
|
|
|
|
|
</Text>
|
|
|
|
|
</div>
|
|
|
|
|
<Button kind="primary" onClick={sendUserDataToIntercom} size="sm">
|
|
|
|
|
{createMessage(CONTINUE)}
|
|
|
|
|
</Button>
|
|
|
|
|
</ConsentContainer>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-22 13:05:01 +00:00
|
|
|
function HelpButtonTooltip(props: {
|
|
|
|
|
isFirstTimeUserOnboardingEnabled: boolean;
|
|
|
|
|
showSignpostingTooltip: boolean;
|
|
|
|
|
}) {
|
|
|
|
|
if (props.isFirstTimeUserOnboardingEnabled) {
|
|
|
|
|
return (
|
|
|
|
|
<TooltipContent showSignpostingTooltip={props.showSignpostingTooltip} />
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return <>{createMessage(HELP_RESOURCE_TOOLTIP)}</>;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-28 10:28:39 +00:00
|
|
|
function HelpButton() {
|
2023-06-01 14:06:57 +00:00
|
|
|
const [showIntercomConsent, setShowIntercomConsent] = useState(false);
|
2023-06-22 13:05:01 +00:00
|
|
|
const [showTooltip, setShowTooltip] = useState(false);
|
|
|
|
|
const user = useSelector(getCurrentUser);
|
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
const isFirstTimeUserOnboardingEnabled = useSelector(
|
|
|
|
|
getIsFirstTimeUserOnboardingEnabled,
|
|
|
|
|
);
|
|
|
|
|
const showSignpostingTooltip = useSelector(getSignpostingTooltipVisible);
|
|
|
|
|
const onboardingModalOpen = useSelector(getFirstTimeUserOnboardingModal);
|
|
|
|
|
const unreadSteps = useSelector(getSignpostingUnreadSteps);
|
|
|
|
|
const setOverlay = useSelector(getSignpostingSetOverlay);
|
|
|
|
|
const showUnreadSteps =
|
|
|
|
|
!!unreadSteps.length &&
|
|
|
|
|
isFirstTimeUserOnboardingEnabled &&
|
|
|
|
|
!onboardingModalOpen;
|
|
|
|
|
const menuProps = isFirstTimeUserOnboardingEnabled
|
|
|
|
|
? {
|
|
|
|
|
open: onboardingModalOpen,
|
|
|
|
|
}
|
|
|
|
|
: {};
|
|
|
|
|
const tooltipProps = isFirstTimeUserOnboardingEnabled
|
|
|
|
|
? {
|
|
|
|
|
visible: showTooltip || showSignpostingTooltip,
|
|
|
|
|
onVisibleChange: setShowTooltip,
|
|
|
|
|
}
|
|
|
|
|
: {};
|
2021-08-11 05:33:11 +00:00
|
|
|
|
2025-05-13 12:06:58 +00:00
|
|
|
const isAgentApp = useSelector(getIsAiAgentApp);
|
2025-04-07 17:42:19 +00:00
|
|
|
|
2025-05-13 12:06:58 +00:00
|
|
|
if (isAgentApp) {
|
2025-04-07 17:42:19 +00:00
|
|
|
const docItem = HELP_MENU_ITEMS.find(
|
|
|
|
|
(item) => item.label === "Documentation",
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (docItem) {
|
2025-04-08 06:35:03 +00:00
|
|
|
docItem.link = DOCS_AI_BASE_URL;
|
2025-04-07 17:42:19 +00:00
|
|
|
}
|
2025-04-08 10:13:03 +00:00
|
|
|
|
2025-04-10 05:13:01 +00:00
|
|
|
HELP_MENU_ITEMS = HELP_MENU_ITEMS.filter(
|
|
|
|
|
(item) => item.label !== "Report a bug",
|
2025-04-08 10:13:03 +00:00
|
|
|
);
|
2025-04-07 17:42:19 +00:00
|
|
|
}
|
|
|
|
|
|
2021-08-11 05:33:11 +00:00
|
|
|
useEffect(() => {
|
2021-08-16 11:03:27 +00:00
|
|
|
bootIntercom(user);
|
2021-08-11 05:33:11 +00:00
|
|
|
}, [user?.email]);
|
|
|
|
|
|
2021-03-08 08:24:12 +00:00
|
|
|
return (
|
2023-05-19 18:37:06 +00:00
|
|
|
<Menu
|
|
|
|
|
onOpenChange={(open) => {
|
|
|
|
|
if (open) {
|
2023-06-22 13:05:01 +00:00
|
|
|
if (isFirstTimeUserOnboardingEnabled) {
|
|
|
|
|
dispatch(showSignpostingModal(true));
|
|
|
|
|
setShowTooltip(false);
|
|
|
|
|
}
|
2024-09-18 16:35:28 +00:00
|
|
|
|
2023-06-01 14:06:57 +00:00
|
|
|
setShowIntercomConsent(false);
|
2023-06-22 13:05:01 +00:00
|
|
|
AnalyticsUtil.logEvent("OPEN_HELP", {
|
|
|
|
|
page: "Editor",
|
|
|
|
|
signpostingActive: isFirstTimeUserOnboardingEnabled,
|
|
|
|
|
});
|
2023-05-19 18:37:06 +00:00
|
|
|
}
|
2021-03-08 08:24:12 +00:00
|
|
|
}}
|
2023-06-22 13:05:01 +00:00
|
|
|
{...menuProps}
|
2021-03-08 08:24:12 +00:00
|
|
|
>
|
2023-05-19 18:37:06 +00:00
|
|
|
<MenuTrigger>
|
2023-06-22 13:05:01 +00:00
|
|
|
<div className="relative">
|
2023-05-19 18:37:06 +00:00
|
|
|
<Tooltip
|
2023-06-22 13:05:01 +00:00
|
|
|
align={{
|
|
|
|
|
targetOffset: [5, 0],
|
|
|
|
|
}}
|
|
|
|
|
content={
|
|
|
|
|
<HelpButtonTooltip
|
|
|
|
|
isFirstTimeUserOnboardingEnabled={
|
|
|
|
|
isFirstTimeUserOnboardingEnabled
|
|
|
|
|
}
|
|
|
|
|
showSignpostingTooltip={showSignpostingTooltip}
|
|
|
|
|
/>
|
|
|
|
|
}
|
|
|
|
|
destroyTooltipOnHide={isFirstTimeUserOnboardingEnabled}
|
|
|
|
|
isDisabled={onboardingModalOpen}
|
|
|
|
|
mouseLeaveDelay={0}
|
2023-05-19 18:37:06 +00:00
|
|
|
placement="bottomRight"
|
2023-06-22 13:05:01 +00:00
|
|
|
{...tooltipProps}
|
2023-05-19 18:37:06 +00:00
|
|
|
>
|
2023-06-01 14:06:57 +00:00
|
|
|
<Button
|
|
|
|
|
data-testid="t--help-button"
|
|
|
|
|
kind="tertiary"
|
|
|
|
|
size="md"
|
|
|
|
|
startIcon="question-line"
|
|
|
|
|
>
|
2023-05-19 18:37:06 +00:00
|
|
|
Help
|
|
|
|
|
</Button>
|
|
|
|
|
</Tooltip>
|
2023-06-22 13:05:01 +00:00
|
|
|
{showUnreadSteps && <UnreadSteps className="unread" />}
|
2023-04-10 12:59:14 +00:00
|
|
|
</div>
|
2023-05-19 18:37:06 +00:00
|
|
|
</MenuTrigger>
|
2023-06-22 13:05:01 +00:00
|
|
|
{isFirstTimeUserOnboardingEnabled ? (
|
|
|
|
|
<SignpostingPopup
|
|
|
|
|
setOverlay={setOverlay}
|
|
|
|
|
setShowIntercomConsent={setShowIntercomConsent}
|
|
|
|
|
showIntercomConsent={showIntercomConsent}
|
|
|
|
|
/>
|
|
|
|
|
) : (
|
|
|
|
|
<MenuContent collisionPadding={10} style={{ width: HELP_MODAL_WIDTH }}>
|
|
|
|
|
{showIntercomConsent ? (
|
|
|
|
|
<IntercomConsent showIntercomConsent={setShowIntercomConsent} />
|
|
|
|
|
) : (
|
|
|
|
|
<>
|
|
|
|
|
{HELP_MENU_ITEMS.map((item) => (
|
|
|
|
|
<MenuItem
|
|
|
|
|
id={item.id}
|
|
|
|
|
key={item.label}
|
|
|
|
|
onSelect={(e) => {
|
|
|
|
|
if (item.link) {
|
|
|
|
|
window.open(item.link, "_blank");
|
2023-06-01 14:06:57 +00:00
|
|
|
}
|
2024-09-18 16:35:28 +00:00
|
|
|
|
2023-06-22 13:05:01 +00:00
|
|
|
if (item.id === "intercom-trigger") {
|
|
|
|
|
e?.preventDefault();
|
2024-09-18 16:35:28 +00:00
|
|
|
|
2023-06-22 13:05:01 +00:00
|
|
|
if (intercomAppID && window.Intercom) {
|
|
|
|
|
if (user?.isIntercomConsentGiven || cloudHosting) {
|
|
|
|
|
window.Intercom("show");
|
|
|
|
|
} else {
|
|
|
|
|
setShowIntercomConsent(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
startIcon={item.icon}
|
|
|
|
|
>
|
|
|
|
|
{item.label}
|
|
|
|
|
</MenuItem>
|
|
|
|
|
))}
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
{appVersion.id && (
|
|
|
|
|
<>
|
|
|
|
|
<MenuSeparator />
|
|
|
|
|
<MenuItem className="menuitem-nohover">
|
|
|
|
|
<HelpFooter>
|
|
|
|
|
<span>
|
|
|
|
|
{createMessage(
|
|
|
|
|
APPSMITH_DISPLAY_VERSION,
|
|
|
|
|
appVersion.edition,
|
|
|
|
|
appVersion.id,
|
|
|
|
|
)}
|
|
|
|
|
</span>
|
|
|
|
|
<span>
|
|
|
|
|
Released {moment(appVersion.releaseDate).fromNow()}
|
|
|
|
|
</span>
|
|
|
|
|
</HelpFooter>
|
|
|
|
|
</MenuItem>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</MenuContent>
|
|
|
|
|
)}
|
2023-05-19 18:37:06 +00:00
|
|
|
</Menu>
|
2021-03-08 08:24:12 +00:00
|
|
|
);
|
2021-04-28 10:28:39 +00:00
|
|
|
}
|
2021-03-08 08:24:12 +00:00
|
|
|
|
|
|
|
|
export default HelpButton;
|