Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Move home to feature tier (#75213)

Fraserfd771cbb26c8
diff --git a/frontend/lint/module-boundaries.mjs b/frontend/lint/module-boundaries.mjs
index 7f76e0408d6..c83ee5bcec0 100644
--- a/frontend/lint/module-boundaries.mjs
+++ b/frontend/lint/module-boundaries.mjs
@@ -108,7 +108,7 @@ const elements = [
createElement({ type: "shared", name: "forms" }),
createElement({ type: "shared", name: "history" }),
createElement({ type: "shared", name: "hoc" }),
- createElement({ type: "shared", name: "home" }),
+ createElement({ type: "feature", name: "home" }),
createElement({ type: "shared", name: "hooks" }),
createElement({ type: "shared", name: "i18n" }),
createElement({
diff --git a/frontend/src/metabase/home/components/Onboarding/Onboarding.tsx b/frontend/src/metabase/home/components/Onboarding/Onboarding.tsx
index 5a2d10b001b..b17ccebbad4 100644
--- a/frontend/src/metabase/home/components/Onboarding/Onboarding.tsx
+++ b/frontend/src/metabase/home/components/Onboarding/Onboarding.tsx
@@ -17,6 +17,7 @@ import CS from "metabase/css/core/index.css";
import { getIsXrayEnabled } from "metabase/home/selectors";
import { useHelpLink } from "metabase/nav/components/AppSwitcher/useHelpLink";
import { useSelector } from "metabase/redux";
+import type { ChecklistItemValue } from "metabase/redux/store";
import {
getDocsUrl,
getIsHosted,
@@ -46,7 +47,6 @@ import {
trackChecklistItemCTAClicked,
trackChecklistItemExpanded,
} from "./analytics";
-import type { ChecklistItemValue } from "./types";
export const Onboarding = () => {
const applicationName = useSelector(getApplicationName);
diff --git a/frontend/src/metabase/home/components/Onboarding/analytics.ts b/frontend/src/metabase/home/components/Onboarding/analytics.ts
index 34ca9d3a1c0..8ec46b42134 100644
--- a/frontend/src/metabase/home/components/Onboarding/analytics.ts
+++ b/frontend/src/metabase/home/components/Onboarding/analytics.ts
@@ -1,6 +1,7 @@
import { trackSimpleEvent } from "metabase/analytics";
+import type { ChecklistItemValue } from "metabase/redux/store";
-import type { ChecklistItemCTA, ChecklistItemValue } from "./types";
+import type { ChecklistItemCTA } from "./types";
export const trackChecklistItemExpanded = (value: ChecklistItemValue) => {
trackSimpleEvent({
diff --git a/frontend/src/metabase/home/components/Onboarding/tests/common.unit.spec.tsx b/frontend/src/metabase/home/components/Onboarding/tests/common.unit.spec.tsx
index 67f8ae9e9d1..d7a1ab9d7b2 100644
--- a/frontend/src/metabase/home/components/Onboarding/tests/common.unit.spec.tsx
+++ b/frontend/src/metabase/home/components/Onboarding/tests/common.unit.spec.tsx
@@ -1,8 +1,7 @@
import userEvent from "@testing-library/user-event";
import { getScrollIntoViewMock, screen, within } from "__support__/ui";
-
-import type { ChecklistItemValue } from "../types";
+import type { ChecklistItemValue } from "metabase/redux/store";
import { setup } from "./setup";
diff --git a/frontend/src/metabase/home/components/Onboarding/tests/setup.tsx b/frontend/src/metabase/home/components/Onboarding/tests/setup.tsx
index 795ed221c7a..2f4ccc3c76f 100644
--- a/frontend/src/metabase/home/components/Onboarding/tests/setup.tsx
+++ b/frontend/src/metabase/home/components/Onboarding/tests/setup.tsx
@@ -7,6 +7,7 @@ import {
} from "__support__/server-mocks";
import { mockSettings } from "__support__/settings";
import { renderWithProviders } from "__support__/ui";
+import type { ChecklistItemValue } from "metabase/redux/store";
import {
createMockAppState,
createMockState,
@@ -20,7 +21,6 @@ import {
} from "metabase-types/api/mocks";
import { Onboarding } from "../Onboarding";
-import type { ChecklistItemValue } from "../types";
export type SetupProps = {
isAdmin?: boolean;
diff --git a/frontend/src/metabase/home/components/Onboarding/types.ts b/frontend/src/metabase/home/components/Onboarding/types.ts
index 225ddb6203a..aca071d2ee6 100644
--- a/frontend/src/metabase/home/components/Onboarding/types.ts
+++ b/frontend/src/metabase/home/components/Onboarding/types.ts
@@ -1,11 +1 @@
-export type ChecklistItemValue =
- | "database"
- | "invite"
- | "x-ray"
- | "notebook"
- | "sql"
- | "dashboard"
- | "subscription"
- | "alert";
-
export type ChecklistItemCTA = "primary" | "secondary";
diff --git a/frontend/src/metabase/home/selectors.ts b/frontend/src/metabase/home/selectors.ts
index d1eecd2fff3..66a63dede35 100644
--- a/frontend/src/metabase/home/selectors.ts
+++ b/frontend/src/metabase/home/selectors.ts
@@ -1,10 +1,5 @@
-import { createSelector } from "@reduxjs/toolkit";
-import dayjs from "dayjs";
-
import type { State } from "metabase/redux/store";
-import { getIsEmbeddingIframe } from "metabase/selectors/embed";
import { getSetting } from "metabase/selectors/settings";
-import { getIsWhiteLabeling } from "metabase/selectors/whitelabel";
export const getIsXrayEnabled = (state: State) => {
return getSetting(state, "enable-xrays");
@@ -13,16 +8,3 @@ export const getIsXrayEnabled = (state: State) => {
export const getHasMetabotLogo = (state: State) => {
return getSetting(state, "show-metabot");
};
-
-export const getIsNewInstance = (state: State) => {
- const instanceCreated = getSetting(state, "instance-creation");
- const daysSinceCreation = dayjs().diff(dayjs(instanceCreated), "days");
- return daysSinceCreation <= 30;
-};
-
-export const getCanAccessOnboardingPage = createSelector(
- [getIsEmbeddingIframe, getIsWhiteLabeling],
- (isEmbeddingIframe, isWhiteLabelled) => {
- return !isEmbeddingIframe && !isWhiteLabelled;
- },
-);
diff --git a/frontend/src/metabase/nav/components/AppSwitcher/AppSwitcher.tsx b/frontend/src/metabase/nav/components/AppSwitcher/AppSwitcher.tsx
index fc5619aac8b..f3e07eca168 100644
--- a/frontend/src/metabase/nav/components/AppSwitcher/AppSwitcher.tsx
+++ b/frontend/src/metabase/nav/components/AppSwitcher/AppSwitcher.tsx
@@ -8,15 +8,15 @@ import { ForwardRefLink } from "metabase/common/components/Link";
import { userInitials } from "metabase/common/utils/user";
import { trackDataStudioOpened } from "metabase/data-studio/analytics";
import { canAccessDataStudio as canAccessDataStudioSelector } from "metabase/data-studio/selectors";
-import {
- getCanAccessOnboardingPage,
- getIsNewInstance,
-} from "metabase/home/selectors";
import { useDispatch, useSelector } from "metabase/redux";
import { openDiagnostics } from "metabase/redux/app";
import { logout } from "metabase/redux/auth";
import { setOpenModal } from "metabase/redux/ui";
import { getAdminPaths } from "metabase/selectors/admin";
+import {
+ getCanAccessOnboardingPage,
+ getIsNewInstance,
+} from "metabase/selectors/onboarding";
import { getUser } from "metabase/selectors/user";
import { getApplicationName } from "metabase/selectors/whitelabel";
import {
diff --git a/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/MainNavbarView.tsx b/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/MainNavbarView.tsx
index f1e117945b0..266a1c41346 100644
--- a/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/MainNavbarView.tsx
+++ b/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/MainNavbarView.tsx
@@ -17,12 +17,12 @@ import { useSetting, useUserSetting } from "metabase/common/hooks";
import { useIsAtHomepageDashboard } from "metabase/common/hooks/use-is-at-homepage-dashboard";
import { useShowOtherUsersCollections } from "metabase/common/hooks/use-show-other-users-collections";
import { NavbarLibrarySection } from "metabase/data-studio/nav/components/NavbarLibrarySection";
+import { PLUGIN_REMOTE_SYNC, PLUGIN_TENANTS } from "metabase/plugins";
+import { useSelector } from "metabase/redux";
import {
getCanAccessOnboardingPage,
getIsNewInstance,
-} from "metabase/home/selectors";
-import { PLUGIN_REMOTE_SYNC, PLUGIN_TENANTS } from "metabase/plugins";
-import { useSelector } from "metabase/redux";
+} from "metabase/selectors/onboarding";
import {
getIsTenantUser,
getUser,
diff --git a/frontend/src/metabase/redux/store/app.ts b/frontend/src/metabase/redux/store/app.ts
index 6586d23f76e..702da5e3240 100644
--- a/frontend/src/metabase/redux/store/app.ts
+++ b/frontend/src/metabase/redux/store/app.ts
@@ -1,7 +1,16 @@
-import type { ChecklistItemValue } from "metabase/home/components/Onboarding/types";
import type { Table } from "metabase-types/api";
import type { CollectionId } from "metabase-types/api/collection";
+export type ChecklistItemValue =
+ | "database"
+ | "invite"
+ | "x-ray"
+ | "notebook"
+ | "sql"
+ | "dashboard"
+ | "subscription"
+ | "alert";
+
export interface AppErrorDescriptor {
status: number;
data?: {
diff --git a/frontend/src/metabase/route-guards.tsx b/frontend/src/metabase/route-guards.tsx
index 097266dc818..7adb5b7fbc2 100644
--- a/frontend/src/metabase/route-guards.tsx
+++ b/frontend/src/metabase/route-guards.tsx
@@ -6,10 +6,10 @@ import { PLUGIN_FEATURE_LEVEL_PERMISSIONS } from "metabase/plugins";
import { metabaseReduxContext } from "metabase/redux";
import type { State } from "metabase/redux/store";
import { getAdminPaths } from "metabase/selectors/admin";
+import { getCanAccessOnboardingPage } from "metabase/selectors/onboarding";
import { getSetting } from "metabase/selectors/settings";
import { isSameOrSiteUrlOrigin } from "metabase/utils/dom";
-import { getCanAccessOnboardingPage } from "./home/selectors";
import { getIsEmbeddingIframe } from "./selectors/embed";
import { canAccessTransforms } from "./transforms/selectors";
diff --git a/frontend/src/metabase/selectors/onboarding.ts b/frontend/src/metabase/selectors/onboarding.ts
new file mode 100644
index 00000000000..c0a1d37e3f5
--- /dev/null
+++ b/frontend/src/metabase/selectors/onboarding.ts
@@ -0,0 +1,20 @@
+import { createSelector } from "@reduxjs/toolkit";
+import dayjs from "dayjs";
+
+import type { State } from "metabase/redux/store";
+import { getIsEmbeddingIframe } from "metabase/selectors/embed";
+import { getSetting } from "metabase/selectors/settings";
+import { getIsWhiteLabeling } from "metabase/selectors/whitelabel";
+
+export const getIsNewInstance = (state: State) => {
+ const instanceCreated = getSetting(state, "instance-creation");
+ const daysSinceCreation = dayjs().diff(dayjs(instanceCreated), "days");
+ return daysSinceCreation <= 30;
+};
+
+export const getCanAccessOnboardingPage = createSelector(
+ [getIsEmbeddingIframe, getIsWhiteLabeling],
+ (isEmbeddingIframe, isWhiteLabelled) => {
+ return !isEmbeddingIframe && !isWhiteLabelled;
+ },
+);