Skip to content

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

Closes EMB-997 add a reset function to plugins (#65958)

Sébastiendcca25224776
diff --git a/.eslintrc.js b/.eslintrc.js
index 44ccf2b9919..7eec4cfb4f8 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -180,6 +180,7 @@ module.exports = {
"no-unconditional-metabase-links-render": "error",
"no-color-literals": "error",
"no-literal-metabase-strings": "error",
+ "no-oss-reinitialize-import": "error",
"depend/ban-dependencies": [
"error",
{
diff --git a/frontend/lint/eslint-rules/no-oss-reinitialize-import.js b/frontend/lint/eslint-rules/no-oss-reinitialize-import.js
new file mode 100644
index 00000000000..23827494f6f
--- /dev/null
+++ b/frontend/lint/eslint-rules/no-oss-reinitialize-import.js
@@ -0,0 +1,61 @@
+/**
+ * @fileoverview Rule to prevent importing reinitialize functions from OSS plugin files
+ */
+
+//------------------------------------------------------------------------------
+// Rule Definition
+//------------------------------------------------------------------------------
+
+const ERROR_MESSAGE =
+ 'Direct import of "reinitialize" from OSS plugin files is not allowed. Reinitializing all plugins at once from "metabase/plugins/index.ts" is the way.';
+
+// eslint-disable-next-line import/no-commonjs
+module.exports = {
+ meta: {
+ type: "problem",
+ docs: {
+ description:
+ "Disallow importing reinitialize functions from OSS plugin files",
+ category: "Best Practices",
+ recommended: true,
+ },
+ schema: [],
+ messages: {
+ noReinitializeImport: ERROR_MESSAGE,
+ },
+ },
+ create(context) {
+ const filename = context.getFilename();
+
+ // Allow imports in the main plugins index file
+ if (filename.endsWith("metabase/plugins/index.ts")) {
+ return {};
+ }
+
+ return {
+ ImportDeclaration(node) {
+ const sourceValue = node.source.value;
+
+ // Check if importing from an OSS plugin file
+ if (
+ typeof sourceValue === "string" &&
+ sourceValue.startsWith("metabase/plugins/oss/")
+ ) {
+ // Check if importing 'reinitialize'
+ const reinitializeImport = node.specifiers.find(
+ (specifier) =>
+ specifier.type === "ImportSpecifier" &&
+ specifier.imported.name === "reinitialize",
+ );
+
+ if (reinitializeImport) {
+ context.report({
+ node: reinitializeImport,
+ message: ERROR_MESSAGE,
+ });
+ }
+ }
+ },
+ };
+ },
+};
diff --git a/frontend/src/metabase/plugins/index.ts b/frontend/src/metabase/plugins/index.ts
index f8de67d4367..e2b6219d8ba 100644
--- a/frontend/src/metabase/plugins/index.ts
+++ b/frontend/src/metabase/plugins/index.ts
@@ -1,1063 +1,205 @@
-import type { Middleware } from "@reduxjs/toolkit";
-import type { TagDescription } from "@reduxjs/toolkit/query";
-import React, {
- type ComponentType,
- type Context,
- type Dispatch,
- type HTMLAttributes,
- type ReactNode,
- type SetStateAction,
- createContext,
- useCallback,
-} from "react";
-import { t } from "ttag";
-
-import noResultsSource from "assets/img/no_results.svg";
-import {
- getPerformanceTabMetadata,
- strategies,
-} from "metabase/admin/performance/constants/complex";
-import type { ModelWithClearableCache } from "metabase/admin/performance/types";
-import { UNABLE_TO_CHANGE_ADMIN_PERMISSIONS } from "metabase/admin/permissions/constants/messages";
-import {
- type DataPermission,
- DataPermissionValue,
- type DatabaseEntityId,
- type EntityId,
- type PermissionSubject,
-} from "metabase/admin/permissions/types";
-import type {
- MetricFilterControlsProps,
- MetricFilterSettings,
-} from "metabase/browse/metrics";
-import type {
- ModelFilterControlsProps,
- ModelFilterSettings,
-} from "metabase/browse/models";
-import type { LinkProps } from "metabase/common/components/Link";
-import type { DashCardMenuItem } from "metabase/dashboard/components/DashCard/DashCardMenu/dashcard-menu";
-import type { DataSourceSelectorProps } from "metabase/embedding-sdk/types/components/data-picker";
-import type { ContentTranslationFunction } from "metabase/i18n/types";
-import type { ColorName } from "metabase/lib/colors/types";
-import { getIconBase } from "metabase/lib/icon";
-import type { MetabotContext } from "metabase/metabot";
-import {
- NotFoundPlaceholder,
- PluginPlaceholder,
-} from "metabase/plugins/components/PluginPlaceholder";
-import type { EmbedResourceDownloadOptions } from "metabase/public/lib/types";
-import type { SearchFilterComponent } from "metabase/search/types";
-import { _FileUploadErrorModal } from "metabase/status/components/FileUploadStatusLarge/FileUploadErrorModal";
-import type { IconName, IconProps, StackProps } from "metabase/ui";
-import type { HoveredObject } from "metabase/visualizations/types";
-import type Question from "metabase-lib/v1/Question";
-import type Database from "metabase-lib/v1/metadata/Database";
-import type { UiParameter } from "metabase-lib/v1/parameters/types";
-import type {
- BaseEntityId,
- BaseUser,
- Bookmark,
- CacheableDashboard,
- CacheableModel,
- CheckDependenciesResponse,
- Collection,
- CollectionAuthorityLevelConfig,
- CollectionEssentials,
- CollectionId,
- CollectionInstanceAnaltyicsConfig,
- DashCardId,
- Dashboard,
- DashboardId,
- DatabaseData,
- DatabaseId,
- DatabaseLocalSettingAvailability,
- Database as DatabaseType,
- Dataset,
- DependencyEntry,
- Document,
- Group,
- GroupPermissions,
- GroupsPermissions,
- ModelCacheRefreshStatus,
- ParameterId,
- Pulse,
- PythonTransformSourceDraft,
- Revision,
- SearchModel,
- Series,
- TableId,
- Timeline,
- TimelineEvent,
- Transform,
- TransformId,
- UpdateSnippetRequest,
- UpdateTransformRequest,
- User,
- VisualizationDisplay,
-} from "metabase-types/api";
-import type {
- AdminPath,
- AdminPathKey,
- Dispatch as ReduxDispatch,
- State,
-} from "metabase-types/store";
-import type { EmbeddingEntityType } from "metabase-types/store/embedding-data-picker";
-
-import type {
+// Re-export all plugins from OSS modules (excluding reinitialize functions to avoid conflicts)
+export { PLUGIN_API } from "./oss/api";
+export {
+ PLUGIN_AI_SQL_FIXER,
+ PLUGIN_AI_ENTITY_ANALYSIS,
+ PLUGIN_METABOT,
+ type PluginAiSqlFixer,
+ type AIDashboardAnalysisSidebarProps,
+ type AIQuestionAnalysisSidebarProps,
+ type PluginAIEntityAnalysis,
+} from "./oss/ai";
+export { PLUGIN_AUDIT, type InsightsLinkProps } from "./oss/audit";
+export {
+ PLUGIN_AUTH_PROVIDERS,
+ PLUGIN_LDAP_FORM_FIELDS,
+ PLUGIN_IS_PASSWORD_USER,
+ PLUGIN_ADMIN_USER_FORM_FIELDS,
+} from "./oss/auth";
+export {
+ PLUGIN_CACHING,
+ type InvalidateNowButtonProps,
+ type SidebarCacheSectionProps,
+ type SidebarCacheFormProps,
+ type PreemptiveCachingSwitchProps,
+} from "./oss/caching";
+export {
+ PLUGIN_COLLECTIONS,
+ PLUGIN_COLLECTION_COMPONENTS,
+ type ItemWithCollection,
+ type CollectionAuthorityLevelDisplayProps,
+ type CollectionAuthorityLevelIcon,
+} from "./oss/collections";
+export { PLUGIN_CONTENT_TRANSLATION } from "./oss/content-translation";
+export {
+ PLUGIN_CONTENT_VERIFICATION,
+ type ModelFilterControlsProps,
+ type ModelFilterSettings,
+ type MetricFilterControlsProps,
+ type MetricFilterSettings,
+} from "./oss/content-verification";
+export {
+ PLUGIN_APP_INIT_FUNCTIONS,
+ PLUGIN_LANDING_PAGE,
+ PLUGIN_REDUX_MIDDLEWARES,
+ PLUGIN_LOGO_ICON_COMPONENTS,
+ PLUGIN_ADMIN_ALLOWED_PATH_GETTERS,
+ PLUGIN_ADMIN_TOOLS,
+ PLUGIN_SELECTORS,
+ PLUGIN_FORM_WIDGETS,
+ PLUGIN_SNIPPET_SIDEBAR_PLUS_MENU_OPTIONS,
+ PLUGIN_SNIPPET_SIDEBAR_ROW_RENDERERS,
+ PLUGIN_SNIPPET_SIDEBAR_MODALS,
+ PLUGIN_SNIPPET_SIDEBAR_HEADER_BUTTONS,
+ PLUGIN_DASHBOARD_SUBSCRIPTION_PARAMETERS_SECTION_OVERRIDE,
+ PLUGIN_REDUCERS,
+ PLUGIN_IS_EE_BUILD,
+ type IllustrationValue,
+} from "./oss/core";
+export {
+ PLUGIN_DASHCARD_MENU,
+ type PluginDashcardMenu,
+} from "./oss/dashcard-menu";
+export {
+ PLUGIN_DB_ROUTING,
+ PLUGIN_DATABASE_REPLICATION,
+ PLUGIN_TABLE_EDITING,
+} from "./oss/database";
+export { PLUGIN_DOCUMENTS } from "./oss/documents";
+export { PLUGIN_EMBEDDING, type SimpleDataPickerProps } from "./oss/embedding";
+export { PLUGIN_EMBEDDING_IFRAME_SDK } from "./oss/embedding-iframe-sdk";
+export {
+ PLUGIN_EMBEDDING_IFRAME_SDK_SETUP,
+ type SdkIframeEmbedSetupModalProps,
+ type SdkIframeEmbedSetupModalInitialState,
+} from "./oss/embedding-iframe-sdk-setup";
+export { PLUGIN_EMBEDDING_SDK } from "./oss/embedding-sdk";
+export { PLUGIN_ENTITIES } from "./oss/entities";
+export { PLUGIN_MODEL_PERSISTENCE } from "./oss/model-persistence";
+export {
+ PLUGIN_MODERATION,
+ type RevisionOrModerationEvent,
+} from "./oss/moderation";
+export {
+ PLUGIN_ADMIN_PERMISSIONS_DATABASE_ROUTES,
+ PLUGIN_ADMIN_PERMISSIONS_DATABASE_GROUP_ROUTES,
+ PLUGIN_ADMIN_PERMISSIONS_DATABASE_POST_ACTIONS,
+ PLUGIN_ADMIN_PERMISSIONS_DATABASE_ACTIONS,
+ PLUGIN_ADMIN_PERMISSIONS_TABLE_OPTIONS,
+ PLUGIN_ADMIN_PERMISSIONS_TABLE_ROUTES,
+ PLUGIN_ADMIN_PERMISSIONS_TABLE_GROUP_ROUTES,
+ PLUGIN_ADMIN_PERMISSIONS_TABLE_FIELDS_OPTIONS,
+ PLUGIN_ADMIN_PERMISSIONS_TABLE_FIELDS_CONFIRMATIONS,
+ PLUGIN_ADMIN_PERMISSIONS_TABLE_FIELDS_ACTIONS,
+ PLUGIN_ADMIN_PERMISSIONS_TABLE_FIELDS_POST_ACTION,
+ PLUGIN_DATA_PERMISSIONS,
+ PLUGIN_ADMIN_USER_MENU_ITEMS,
+ PLUGIN_ADMIN_USER_MENU_ROUTES,
+ PLUGIN_ADVANCED_PERMISSIONS,
+ PLUGIN_FEATURE_LEVEL_PERMISSIONS,
+ PLUGIN_APPLICATION_PERMISSIONS,
+ PLUGIN_GROUP_MANAGERS,
+ type UserWithApplicationPermissions,
+} from "./oss/permissions";
+export { PLUGIN_PUBLIC_SHARING } from "./oss/public-sharing";
+export { PLUGIN_REMOTE_SYNC } from "./oss/remote-sync";
+export { PLUGIN_RESOURCE_DOWNLOADS } from "./oss/resource-downloads";
+export { PLUGIN_SEMANTIC_SEARCH } from "./oss/semantic-search";
+export { PLUGIN_ADMIN_SETTINGS } from "./oss/settings";
+export { PLUGIN_SMTP_OVERRIDE } from "./oss/smtp-override";
+export {
+ PLUGIN_TRANSFORMS,
+ PLUGIN_TRANSFORMS_PYTHON,
+ PLUGIN_DEPENDENCIES,
+ type TransformPickerItem,
+ type TransformPickerProps,
+ type TransformsPlugin,
+ type PythonTransformEditorProps,
+ type PythonTransformSourceSectionProps,
+ type PythonTransformsPlugin,
+ type DependencyGraphPageContextType,
+ type CheckDependenciesFormProps,
+ type CheckDependenciesModalProps,
+ type UseCheckDependenciesProps,
+ type UseCheckDependenciesResult,
+} from "./oss/transforms";
+export { PLUGIN_UPLOAD_MANAGEMENT } from "./oss/upload-management";
+export { PLUGIN_WHITELABEL } from "./oss/whitelabel";
+export { PLUGIN_SUPPORT } from "./oss/support";
+
+// Re-export types that are used by other files
+export type {
GetAuthProviders,
PluginGroupManagersType,
SyncedCollectionsSidebarSectionProps,
} from "./types";
-// functions called when the application is started
-export const PLUGIN_APP_INIT_FUNCTIONS: (() => void)[] = [];
-
-export const PLUGIN_LANDING_PAGE: {
- getLandingPage: () => string | null | undefined;
- LandingPageWidget: ComponentType;
-} = {
- getLandingPage: () => "/",
- LandingPageWidget: PluginPlaceholder,
-};
-
-export const PLUGIN_REDUX_MIDDLEWARES: Middleware[] = [];
-
-// override for LogoIcon
-export const PLUGIN_LOGO_ICON_COMPONENTS: ComponentType[] = [];
-
-// admin nav items and routes
-export const PLUGIN_ADMIN_ALLOWED_PATH_GETTERS: ((
- user: any,
-) => AdminPathKey[])[] = [];
-
-export const PLUGIN_ADMIN_TOOLS: {
- COMPONENT: ComponentType | null;
-} = {
- COMPONENT: null,
-};
-
-export const PLUGIN_WHITELABEL = {
- WhiteLabelBrandingSettingsPage: PluginPlaceholder,
- WhiteLabelConcealSettingsPage: PluginPlaceholder,
-};
-
-export const PLUGIN_ADMIN_SETTINGS: {
- InteractiveEmbeddingSettings: ComponentType | null;
- LicenseAndBillingSettings: ComponentType;
- useUpsellFlow: (props: { campaign: string; location: string }) => {
- triggerUpsellFlow: (() => void) | undefined;
- };
-} = {
- InteractiveEmbeddingSettings: null,
- LicenseAndBillingSettings: PluginPlaceholder,
- useUpsellFlow: (_props: {
- campaign: string;
- location: string;
- }): {
- triggerUpsellFlow: (() => void) | undefined;
- } => ({
- triggerUpsellFlow: undefined,
- }),
-};
-
-// admin permissions
-export const PLUGIN_ADMIN_PERMISSIONS_DATABASE_ROUTES = [];
-export const PLUGIN_ADMIN_PERMISSIONS_DATABASE_GROUP_ROUTES = [];
-export const PLUGIN_ADMIN_PERMISSIONS_DATABASE_POST_ACTIONS = {
- impersonated: null,
-};
-export const PLUGIN_ADMIN_PERMISSIONS_DATABASE_ACTIONS = {
- impersonated: [],
-};
-
-export const PLUGIN_ADMIN_PERMISSIONS_TABLE_OPTIONS = [];
-
-export const PLUGIN_ADMIN_PERMISSIONS_TABLE_ROUTES = [];
-export const PLUGIN_ADMIN_PERMISSIONS_TABLE_GROUP_ROUTES = [];
-export const PLUGIN_ADMIN_PERMISSIONS_TABLE_FIELDS_OPTIONS = [];
-export const PLUGIN_ADMIN_PERMISSIONS_TABLE_FIELDS_CONFIRMATIONS = [] as Array<
- (
- _permissions: GroupsPermissions,
- _groupId: number,
- _entityId: EntityId,
- _value: DataPermissionValue,
- ) => any
->;
-export const PLUGIN_ADMIN_PERMISSIONS_TABLE_FIELDS_ACTIONS = {
- sandboxed: [],
-};
-export const PLUGIN_ADMIN_PERMISSIONS_TABLE_FIELDS_POST_ACTION = {
- sandboxed: null,
-};
-
-export const PLUGIN_DATA_PERMISSIONS: {
- permissionsPayloadExtraSelectors: ((
- state: State,
- ) => [Record<string, undefined | { group_id: string }[]>, string[]])[];
- hasChanges: ((state: State) => boolean)[];
- shouldRestrictNativeQueryPermissions: (
- permissions: GroupsPermissions,
- groupId: number,
- entityId: EntityId,
- permission: DataPermission,
- value: DataPermissionValue,
- database: Database,
- ) => boolean;
-
- upgradeViewPermissionsIfNeeded:
- | ((
- permissions: GroupsPermissions,
- groupId: number,
- entityId: EntityId,
- value: any,
- database: Database,
- permission: DataPermission,
- ) => GroupPermissions)
- | null;
-} = {
- permissionsPayloadExtraSelectors: [],
- hasChanges: [],
- upgradeViewPermissionsIfNeeded: null,
- shouldRestrictNativeQueryPermissions: () => false,
-};
-
-// user form fields, e.x. login attributes
-export const PLUGIN_ADMIN_USER_FORM_FIELDS = {
- FormLoginAttributes: PluginPlaceholder,
-};
-
-// menu items in people management tab
-export const PLUGIN_ADMIN_USER_MENU_ITEMS = [] as Array<
- (user: User) => React.ReactNode
->;
-export const PLUGIN_ADMIN_USER_MENU_ROUTES = [];
-
-// authentication providers
-
-export const PLUGIN_AUTH_PROVIDERS = {
- isEnabled: () => false,
- AuthSettingsPage: PluginPlaceholder,
- UserProvisioningSettings: NotFoundPlaceholder,
- SettingsSAMLForm: NotFoundPlaceholder,
- SettingsJWTForm: NotFoundPlaceholder,
- providers: [] as GetAuthProviders[],
-};
-
-export const PLUGIN_LDAP_FORM_FIELDS = {
- LdapUserProvisioning: PluginPlaceholder,
- LdapGroupMembershipFilter: PluginPlaceholder,
-};
-
-// Only show the password tab in account settings if these functions all return true.
-// Otherwise, the user is logged in via SSO and should hide first name, last name, and email field in profile settings metabase#23298.
-export const PLUGIN_IS_PASSWORD_USER: ((user: User) => boolean)[] = [];
-
-const defaultLandingPageIllustration = {
- src: "app/img/bridge.svg",
- isDefault: true,
-};
-
-const defaultLoginPageIllustration = {
- src: "app/img/bridge.svg",
- isDefault: true,
-};
-
-const getLoadingMessage = (isSlow: boolean | undefined = false) =>
- isSlow ? t`Waiting for results...` : t`Doing science...`;
-
-// selectors that customize behavior between app versions
-export const PLUGIN_SELECTORS = {
- canWhitelabel: (_state: State) => false,
- getLoadingMessageFactory: (_state: State) => getLoadingMessage,
- getIsWhiteLabeling: (_state: State) => false,
- // eslint-disable-next-line no-literal-metabase-strings -- This is the actual Metabase name, so we don't want to translate it.
- getApplicationName: (_state: State) => "Metabase",
- getShowMetabaseLinks: (_state: State) => true,
- getLoginPageIllustration: (_state: State): IllustrationValue => {
- return defaultLoginPageIllustration;
- },
- getLandingPageIllustration: (_state: State): IllustrationValue => {
- return defaultLandingPageIllustration;
- },
- getNoDataIllustration: (_state: State): string | null => {
- return noResultsSource;
- },
- getNoObjectIllustration: (_state: State): string | null => {
- return noResultsSource;
- },
-};
-
-export type IllustrationValue = {
- src: string;
- isDefault: boolean;
-} | null;
-
-export const PLUGIN_FORM_WIDGETS: Record<string, ComponentType<any>> = {};
-
-// snippet sidebar
-export const PLUGIN_SNIPPET_SIDEBAR_PLUS_MENU_OPTIONS = [];
-export const PLUGIN_SNIPPET_SIDEBAR_ROW_RENDERERS = {};
-export const PLUGIN_SNIPPET_SIDEBAR_MODALS = [];
-export const PLUGIN_SNIPPET_SIDEBAR_HEADER_BUTTONS = [];
-
-interface PluginDashboardSubscriptionParametersSectionOverride {
- Component?: ComponentType<{
- className?: string;
- parameters: UiParameter[];
- hiddenParameters?: string;
- dashboard: Dashboard;
- pulse: Pulse;
- setPulseParameters: (parameters: UiParameter[]) => void;
- }>;
-}
-export const PLUGIN_DASHBOARD_SUBSCRIPTION_PARAMETERS_SECTION_OVERRIDE: PluginDashboardSubscriptionParametersSectionOverride =
- {
- Component: undefined,
- };
-
-const AUTHORITY_LEVEL_REGULAR: CollectionAuthorityLevelConfig = {
- type: null,
- get name() {
- return t`Regular`;
- },
- icon: "folder",
-};
-
-export type ItemWithCollection = { collection: CollectionEssentials };
-
-type GetCollectionIdType = (
- sourceCollectionId?: CollectionId | null,
-) => CollectionId | null;
-
-export type CollectionAuthorityLevelDisplayProps = {
- collection: Collection;
-};
-
-export const PLUGIN_COLLECTIONS = {
- AUTHORITY_LEVEL: {
- [JSON.stringify(AUTHORITY_LEVEL_REGULAR.type)]: AUTHORITY_LEVEL_REGULAR,
- },
- COLLECTION_TYPES: {
- [JSON.stringify(AUTHORITY_LEVEL_REGULAR.type)]: AUTHORITY_LEVEL_REGULAR,
- },
- REGULAR_COLLECTION: AUTHORITY_LEVEL_REGULAR,
- isRegularCollection: (_data: Partial<Collection> | Bookmark) => true,
- isSyncedCollection: (_data: Partial<Collection>) => false,
- getCollectionType: (
- _collection: Partial<Collection>,
- ): CollectionAuthorityLevelConfig | CollectionInstanceAnaltyicsConfig =>
- AUTHORITY_LEVEL_REGULAR,
- useGetDefaultCollectionId: null as GetCollectionIdType | null,
- CUSTOM_INSTANCE_ANALYTICS_COLLECTION_ENTITY_ID: "" as BaseEntityId | "",
- INSTANCE_ANALYTICS_ADMIN_READONLY_MESSAGE: UNABLE_TO_CHANGE_ADMIN_PERMISSIONS,
- getAuthorityLevelMenuItems: (
- _collection: Collection,
- _onUpdate: (collection: Collection, values: Partial<Collection>) => void,
- ): React.ReactNode[] => [],
- getIcon: getIconBase,
- filterOutItemsFromInstanceAnalytics: <Item extends ItemWithCollection>(
- items: Item[],
- ) => items as Item[],
- canCleanUp: (_collection: Collection) => false as boolean,
- useGetCleanUpMenuItems: (
- _collection: Collection,
- ): { menuItems: JSX.Element[] } => ({
- menuItems: [],
- }),
- cleanUpRoute: null as React.ReactElement | null,
- cleanUpAlert: (() => null) as (props: {
- collection: Collection;
- }) => JSX.Element | null,
-};
-
-export type CollectionAuthorityLevelIcon = ComponentType<
- Omit<IconProps, "name" | "tooltip"> & {
- collection: Pick<Collection, "authority_level">;
- tooltip?: "default" | "belonging";
- archived?: boolean;
- }
->;
-
-type CollectionInstanceAnalyticsIcon = React.ComponentType<
- Omit<IconProps, "name"> & {
- collection: Collection;
- entity: "collection" | "question" | "model" | "dashboard" | "metric";
- }
->;
-
-type FormCollectionAuthorityLevelPicker = React.ComponentType<
- HTMLAttributes<HTMLDivElement> & { name: string; title?: string }
->;
-
-export const PLUGIN_COLLECTION_COMPONENTS = {
- CollectionAuthorityLevelIcon:
- PluginPlaceholder as CollectionAuthorityLevelIcon,
- FormCollectionAuthorityLevelPicker:
- PluginPlaceholder as FormCollectionAuthorityLevelPicker,
- CollectionInstanceAnalyticsIcon:
- PluginPlaceholder as CollectionInstanceAnalyticsIcon,
- CollectionAuthorityLevelDisplay:
- PluginPlaceholder as ComponentType<CollectionAuthorityLevelDisplayProps>,
-};
-
-export type RevisionOrModerationEvent = {
- title: string;
- timestamp: string;
- icon: IconName | { name: IconName; color: ColorName } | Record<string, never>;
- description?: string;
- revision?: Revision;
-};
-
-export const PLUGIN_MODERATION = {
- isEnabled: () => false,
- EntityModerationIcon: PluginPlaceholder,
- QuestionModerationSection: PluginPlaceholder,
- ModerationReviewBanner: PluginPlaceholder,
- ModerationReviewTextForQuestion: PluginPlaceholder,
- ModerationReviewTextForDashboard: PluginPlaceholder,
- ModerationStatusIcon: PluginPlaceholder,
- getQuestionIcon: PluginPlaceholder,
- getStatusIcon: (_moderated_status?: string): string | IconProps | undefined =>
- undefined,
- getModerationTimelineEvents: (_reviews: any, _currentUser: BaseUser | null) =>
- [] as RevisionOrModerationEvent[],
- useDashboardMenuItems: (_model?: Dashboard, _reload?: () => void) => [],
- useQuestionMenuItems: (_model?: Question, _reload?: () => void) => [],
-};
-
-export type InvalidateNowButtonProps = {
- targetId: number;
- /** The type of object that the target is */
- targetModel: ModelWithClearableCache;
- targetName: string;
-};
-
-export type SidebarCacheSectionProps = {
- item: CacheableDashboard | Question;
- model: CacheableModel;
- setPage: Dispatch<SetStateAction<"default" | "caching">>;
-};
-
-export type SidebarCacheFormProps = {
- item: CacheableDashboard | Question;
- model: CacheableModel;
- onClose: () => void;
-} & StackProps;
-
-export type PreemptiveCachingSwitchProps = {
- handleSwitchToggle: () => void;
-};
-
-export const PLUGIN_CACHING = {
- isGranularCachingEnabled: () => false,
- StrategyFormLauncherPanel: PluginPlaceholder as any,
- GranularControlsExplanation: PluginPlaceholder as any,
- SidebarCacheSection:
- PluginPlaceholder as ComponentType<SidebarCacheSectionProps>,
- SidebarCacheForm: PluginPlaceholder as ComponentType<
- SidebarCacheFormProps & { onBack: () => void }
- >,
- InvalidateNowButton:
- PluginPlaceholder as ComponentType<InvalidateNowButtonProps>,
- hasQuestionCacheSection: (_question: Question) => false,
- canOverrideRootStrategy: false,
- /** Metadata describing the different kinds of strategies */
- strategies: strategies,
- DashboardAndQuestionCachingTab: PluginPlaceholder as any,
- StrategyEditorForQuestionsAndDashboards: PluginPlaceholder as any,
- getTabMetadata: getPerformanceTabMetadata,
- PreemptiveCachingSwitch:
- PluginPlaceholder as ComponentType<PreemptiveCachingSwitchProps>,
-};
-
-export const PLUGIN_REDUCERS: {
- applicationPermissionsPlugin: any;
- sandboxingPlugin: any;
- shared: any;
- metabotPlugin: any;
- documents: any;
- remoteSyncPlugin: any;
-} = {
- applicationPermissionsPlugin: () => null,
- sandboxingPlugin: () => null,
- shared: () => null,
- metabotPlugin: () => null,
- documents: () => null,
- remoteSyncPlugin: () => null,
-};
-
-export const PLUGIN_ADVANCED_PERMISSIONS = {
- addDatabasePermissionOptions: (permissions: any[], _database: Database) =>
- permissions,
- addSchemaPermissionOptions: (permissions: any[], _value: string) =>
- permissions,
- addTablePermissionOptions: (permissions: any[], _value: string) =>
- permissions,
- getDatabaseLimitedAccessPermission: (_value: string) => null,
- isAccessPermissionDisabled: (
- _value: string,
- _subject: "schemas" | "tables" | "fields",
- ) => false,
- isRestrictivePermission: (_value: string) => false,
- shouldShowViewDataColumn: false,
- defaultViewDataPermission: DataPermissionValue.UNRESTRICTED,
-};
-
-export const PLUGIN_FEATURE_LEVEL_PERMISSIONS = {
- getFeatureLevelDataPermissions: (
- _entityId: DatabaseEntityId,
- _groupId: number,
- _isAdmin: boolean,
- _permissions: GroupsPermissions,
- _dataAccessPermissionValue: DataPermissionValue,
- _defaultGroup: Group,
- _permissionSubject: PermissionSubject,
- ) => {
- return [] as any;
- },
- getDataColumns: (_subject: PermissionSubject) => [] as any,
- getDownloadWidgetMessageOverride: (_result: Dataset): string | null => null,
- canDownloadResults: (_result: Dataset): boolean => true,
- dataModelQueryProps: {} as any,
- databaseDetailsQueryProps: {} as any,
-};
-
-export const PLUGIN_APPLICATION_PERMISSIONS = {
- getRoutes: (): ReactNode => null,
- tabs: [] as any,
- selectors: {
- canAccessSettings: (_state: any) => false,
- canManageSubscriptions: (_state: any) => true,
- },
-};
-
-// Comes with PLUGIN_APPLICATION_PERMISSIONS
-export interface UserWithApplicationPermissions extends User {
- permissions?: {
- can_access_monitoring: boolean;
- can_access_setting: boolean;
- can_access_subscription: boolean;
- };
-}
-
-export const PLUGIN_GROUP_MANAGERS: PluginGroupManagersType = {
- UserTypeToggle: () => null as any,
- UserTypeCell: null,
-
- getChangeMembershipConfirmation: () => null,
- getRemoveMembershipConfirmation: () => null,
-
- deleteGroup: null,
- confirmDeleteMembershipAction: null,
- confirmUpdateMembershipAction: null,
-};
-
-export const PLUGIN_MODEL_PERSISTENCE = {
- isModelLevelPersistenceEnabled: () => false,
- ModelCacheToggle: PluginPlaceholder as ({
- persistedModel,
- model,
- }: {
- persistedModel?: ModelCacheRefreshStatus;
- model: Question;
- }) => JSX.Element,
-};
-
-export const PLUGIN_EMBEDDING = {
- isEnabled: () => false,
- isInteractiveEmbeddingEnabled: (_state: State) => false,
- SimpleDataPicker: (_props: SimpleDataPickerProps): ReactNode => null,
- DataSourceSelector: (_props: DataSourceSelectorProps): ReactNode => null,
-};
-
-export interface SimpleDataPickerProps {
- filterByDatabaseId: number | null;
- selectedEntity?: TableId;
- isInitiallyOpen: boolean;
- triggerElement: ReactNode;
- setSourceTableFn: (tableId: TableId) => void;
- entityTypes: EmbeddingEntityType[];
-}
-
-export const PLUGIN_EMBEDDING_SDK = {
- isEnabled: () => false,
- onBeforeRequestHandlers: {
- getOrRefreshSessionHandler: async () => {},
- },
-};
-
-export const PLUGIN_EMBEDDING_IFRAME_SDK = {
- hasValidLicense: () => false,
- SdkIframeEmbedRoute: (): ReactNode => null,
-};
-
-export type SdkIframeEmbedSetupModalProps = {
- opened: boolean;
- onClose: () => void;
- initialState?: SdkIframeEmbedSetupModalInitialState;
-};
-
-export type SdkIframeEmbedSetupModalInitialState = {
- resourceType?: string | null;
- resourceId?: string | number | null;
- useExistingUserSession?: boolean;
-};
-
-export const PLUGIN_EMBEDDING_IFRAME_SDK_SETUP = {
- isFeatureEnabled: () => false,
- shouldShowEmbedInNewItemMenu: () => false,
- SdkIframeEmbedSetupModal: (
- _props: SdkIframeEmbedSetupModalProps,
- ): ReactNode => null,
-};
-
-export const PLUGIN_CONTENT_VERIFICATION = {
- contentVerificationEnabled: false,
- VerifiedFilter: {} as SearchFilterComponent<"verified">,
- sortCollectionsByVerification: (
- _a: CollectionEssentials,
- _b: CollectionEssentials,
- ) => 0,
-
- ModelFilterControls: (_props: ModelFilterControlsProps) => null,
- getDefaultModelFilters: (_state: State): ModelFilterSettings => ({
- verified: false,
- }),
-
- getDefaultMetricFilters: (_state: State): MetricFilterSettings => ({
- verified: false,
- }),
- MetricFilterControls: (_props: MetricFilterControlsProps) => null,
-};
-
-export type InsightsLinkProps = (
- | {
- question: Pick<Question, "id" | "collection">;
- dashboard?: never;
- }
- | {
- question?: never;
- dashboard: Pick<Dashboard, "id" | "collection">;
- }
-) &
- Omit<LinkProps, "to">;
-
-export const PLUGIN_AUDIT = {
- isAuditDb: (_db: DatabaseType) => false,
- InsightsLink: PluginPlaceholder as ComponentType<InsightsLinkProps>,
-};
-
-type GdriveConnectionModalProps = {
- isModalOpen: boolean;
- onClose: () => void;
- reconnect: boolean;
-};
-
-type GdriveAddDataPanelProps = {
- onAddDataModalClose: () => void;
-};
-
-export const PLUGIN_UPLOAD_MANAGEMENT = {
- FileUploadErrorModal: _FileUploadErrorModal,
- UploadManagementTable: PluginPlaceholder,
- GdriveSyncStatus: PluginPlaceholder,
- GdriveConnectionModal:
- PluginPlaceholder as ComponentType<GdriveConnectionModalProps>,
- GdriveDbMenu: PluginPlaceholder,
- GdriveAddDataPanel:
- PluginPlaceholder as ComponentType<GdriveAddDataPanelProps>,
-};
-
-export const PLUGIN_IS_EE_BUILD = {
- isEEBuild: () => false,
-};
-
-export const PLUGIN_RESOURCE_DOWNLOADS = {
- /**
- * Returns if 'download results' on cards and pdf exports are enabled in public and embedded contexts.
- */
- areDownloadsEnabled: (_args: {
- downloads?: string | boolean | null;
- }): EmbedResourceDownloadOptions => ({
- pdf: true,
- results: true,
- }),
-};
-
-const defaultMetabotContextValue: MetabotContext = {
- prompt: "",
- setPrompt: () => {},
- promptInputRef: undefined,
- getChatContext: () => ({}) as any,
- registerChatContextProvider: () => () => {},
-};
-
-export type PluginAiSqlFixer = {
- FixSqlQueryButton: ComponentType<Record<string, never>>;
-};
-
-export const PLUGIN_AI_SQL_FIXER: PluginAiSqlFixer = {
- FixSqlQueryButton: PluginPlaceholder,
-};
-
-export interface AIDashboardAnalysisSidebarProps {
- onClose?: () => void;
- dashcardId?: DashCardId;
-}
-
-export interface AIQuestionAnalysisSidebarProps {
- question: Question;
- className?: string;
- onClose?: () => void;
- timelines?: Timeline[];
- visibleTimelineEvents?: TimelineEvent[];
-}
-
-export type PluginAIEntityAnalysis = {
- AIQuestionAnalysisButton: ComponentType<any>;
- AIQuestionAnalysisSidebar: ComponentType<AIQuestionAnalysisSidebarProps>;
- AIDashboardAnalysisSidebar: ComponentType<AIDashboardAnalysisSidebarProps>;
- canAnalyzeQuestion: (question: Question) => boolean;
- chartAnalysisRenderFormats: {
- [display in VisualizationDisplay]?: "png" | "svg" | "none";
- };
-};
-
-export const PLUGIN_AI_ENTITY_ANALYSIS: PluginAIEntityAnalysis = {
- AIQuestionAnalysisButton: PluginPlaceholder,
- AIQuestionAnalysisSidebar: PluginPlaceholder,
- AIDashboardAnalysisSidebar: PluginPlaceholder,
- canAnalyzeQuestion: () => false,
- chartAnalysisRenderFormats: {},
-};
-
-type PluginMetabotConfig = {
- emptyText?: string;
- hideSuggestedPrompts?: boolean;
- preventClose?: boolean;
- preventRetryMessage?: boolean;
- suggestionModels: (SearchModel | "transform" | "user")[];
-};
-
-type PluginMetabotType = {
- isEnabled: () => boolean;
- Metabot: (props: {
- hide?: boolean;
- config?: PluginMetabotConfig;
- }) => React.ReactElement | null;
- defaultMetabotContextValue: MetabotContext;
- MetabotContext: React.Context<MetabotContext>;
- getMetabotProvider: () => ComponentType<{ children: React.ReactNode }>;
- getAdminPaths: () => AdminPath[];
- getAdminRoutes: () => React.ReactElement;
- getMetabotRoutes: () => React.ReactElement | null;
- MetabotAdminPage: ComponentType;
- getMetabotVisible: (state: State) => boolean;
- MetabotToggleButton: ComponentType<{ className?: string }>;
- MetabotAppBarButton: ComponentType;
- MetabotAdminAppBarButton: ComponentType;
-};
-
-export const PLUGIN_METABOT: PluginMetabotType = {
- isEnabled: () => false,
- Metabot: (_props: { hide?: boolean; config?: PluginMetabotConfig }) =>
- null as React.ReactElement | null,
- defaultMetabotContextValue,
- MetabotContext: React.createContext(defaultMetabotContextValue),
- getMetabotProvider: () => {
- return ({ children }) =>
- React.createElement(
- PLUGIN_METABOT.MetabotContext.Provider,
- { value: PLUGIN_METABOT.defaultMetabotContextValue },
- children,
- );
- },
- getAdminPaths: () => [],
- getAdminRoutes: () => PluginPlaceholder as unknown as React.ReactElement,
- getMetabotRoutes: () => null,
- MetabotAdminPage: () => `placeholder`,
- getMetabotVisible: () => false,
- MetabotToggleButton: PluginPlaceholder,
- MetabotAppBarButton: PluginPlaceholder,
- MetabotAdminAppBarButton: PluginPlaceholder,
-};
-
-type DashCardMenuItemGetter = (
- question: Question,
- dashcardId: DashCardId | undefined,
- dispatch: ReduxDispatch,
-) => (DashCardMenuItem & { key: string }) | null;
-
-export type PluginDashcardMenu = {
- dashcardMenuItemGetters: DashCardMenuItemGetter[];
-};
-
-export const PLUGIN_DASHCARD_MENU: PluginDashcardMenu = {
- dashcardMenuItemGetters: [],
-};
-
-export const PLUGIN_CONTENT_TRANSLATION = {
- isEnabled: false,
- setEndpointsForStaticEmbedding: (_encodedToken: string) => {},
- ContentTranslationConfiguration: PluginPlaceholder,
- useTranslateContent: <
- T = string | null | undefined,
- >(): ContentTranslationFunction => {
- // In OSS, the input is not translated
- return useCallback(<U = T>(arg: U) => arg, []);
- },
- translateDisplayNames: <T extends object>(
- obj: T,
- _tc: ContentTranslationFunction,
- ) => obj,
- useTranslateFieldValuesInHoveredObject: (obj?: HoveredObject | null) => obj,
- useTranslateSeries: (obj: Series) => obj,
- useSortByContentTranslation: () => (a: string, b: string) =>
- a.localeCompare(b),
-};
-
-export const PLUGIN_DB_ROUTING = {
- DatabaseRoutingSection: PluginPlaceholder as ComponentType<{
- database: DatabaseType;
- }>,
- getDatabaseNameFieldProps: (_isSlug: boolean) => ({}),
- getDestinationDatabaseRoutes: (_IsAdmin: any) =>
- null as React.ReactElement | null,
- useRedirectDestinationDatabase: (
- _database: Pick<DatabaseType, "id" | "router_database_id"> | undefined,
- ): void => {},
- getPrimaryDBEngineFieldState: (
- _database: Pick<Database, "router_user_attribute">,
- ): "default" | "hidden" | "disabled" => "default",
-};
-
-export const PLUGIN_DATABASE_REPLICATION = {
- DatabaseReplicationSection: PluginPlaceholder as ComponentType<{
- database: DatabaseType;
- }>,
-};
-
-export const PLUGIN_API = {
- getRemappedCardParameterValueUrl: (
- dashboardId: DashboardId,
- parameterId: ParameterId,
- ) =>
- `/api/card/${dashboardId}/params/${encodeURIComponent(parameterId)}/remapping`,
- getRemappedDashboardParameterValueUrl: (
- dashboardId: DashboardId,
- parameterId: ParameterId,
- ) =>
- `/api/dashboard/${dashboardId}/params/${encodeURIComponent(parameterId)}/remapping`,
-};
-
-export const PLUGIN_SMTP_OVERRIDE: {
- CloudSMTPConnectionCard: ComponentType;
- SMTPOverrideConnectionForm: ComponentType<{ onClose: () => void }>;
-} = {
- CloudSMTPConnectionCard: PluginPlaceholder,
- SMTPOverrideConnectionForm: PluginPlaceholder,
-};
-
-export const PLUGIN_TABLE_EDITING = {
- isEnabled: () => false,
- isDatabaseTableEditingEnabled: (_database: DatabaseType): boolean => false,
- getRoutes: () => null as React.ReactElement | null,
- getTableEditUrl: (_tableId: TableId, _databaseId: DatabaseId): string => "/",
- AdminDatabaseTableEditingSection: PluginPlaceholder as ComponentType<{
- database: DatabaseType;
- settingsAvailable?: Record<string, DatabaseLocalSettingAvailability>;
- updateDatabase: (
- database: { id: DatabaseId } & Partial<DatabaseData>,
- ) => Promise<void>;
- }>,
-};
-
-export const PLUGIN_DOCUMENTS = {
- getRoutes: () => null as React.ReactElement | null,
- shouldShowDocumentInNewItemMenu: () => false,
- getCurrentDocument: (_state: any) => null as Document | null,
- getSidebarOpen: (_state: any) => false,
- getCommentSidebarOpen: (_state: any) => false,
- DocumentCopyForm: (_props: any) => null as React.ReactElement | null,
-};
-
-export const PLUGIN_PUBLIC_SHARING = {
- PublicDocumentRoute: (_props: any) => null as React.ReactElement | null,
- PublicLinksDocumentListing: () => null as React.ReactElement | null,
-};
-
-export const PLUGIN_ENTITIES = {
- entities: {} as Record<string, any>,
-};
-
-export const PLUGIN_SEMANTIC_SEARCH = {
- SearchSettingsWidget: PluginPlaceholder,
-};
-
-export type TransformPickerItem = {
- id: TransformId;
- name: string;
- model: "transform";
-};
-
-export type TransformPickerProps = {
- value: TransformPickerItem | undefined;
- onItemSelect: (transform: TransformPickerItem) => void;
-};
-
-export type TransformsPlugin = {
- TransformPicker: ComponentType<TransformPickerProps>;
- getAdminPaths(): AdminPath[];
- getAdminRoutes(): ReactNode;
-};
-
-export const PLUGIN_TRANSFORMS: TransformsPlugin = {
- TransformPicker: PluginPlaceholder,
- getAdminPaths: () => [],
- getAdminRoutes: () => null,
-};
-
-export const PLUGIN_REMOTE_SYNC: {
- LibraryNav: ComponentType;
- RemoteSyncSettings: ComponentType;
- SyncedCollectionsSidebarSection: ComponentType<SyncedCollectionsSidebarSectionProps>;
- REMOTE_SYNC_INVALIDATION_TAGS: TagDescription<any>[] | null;
- useSyncStatus: () => {
- isIdle: boolean;
- taskType: any;
- progress: number;
- message: string;
- progressModal: ReactNode;
- };
-} = {
- LibraryNav: PluginPlaceholder,
- RemoteSyncSettings: NotFoundPlaceholder,
- SyncedCollectionsSidebarSection: PluginPlaceholder,
- REMOTE_SYNC_INVALIDATION_TAGS: null,
- useSyncStatus: () => ({
- isIdle: true,
- taskType: null,
- progress: 0,
- message: "",
- progressModal: null,
- }),
-};
-
-export const PLUGIN_SUPPORT: {
- isEnabled: boolean;
- SupportSettings: ComponentType;
- GrantAccessModal: ComponentType<{ onClose: VoidFunction }>;
-} = {
- isEnabled: false,
- SupportSettings: NotFoundPlaceholder,
- GrantAccessModal: NotFoundPlaceholder,
-};
-
-export type PythonTransformEditorProps = {
- name?: string;
- source: PythonTransformSourceDraft;
- proposedSource?: PythonTransformSourceDraft;
- isNew: boolean;
- isDirty: boolean;
- isSaving: boolean;
- onChangeSource: (source: PythonTransformSourceDraft) => void;
- onSave: () => void;
- onCancel: () => void;
- onAcceptProposed: () => void;
- onRejectProposed: () => void;
-};
-
-export type PythonTransformSourceSectionProps = {
- transform: Transform;
-};
-
-export type PythonTransformsPlugin = {
- isEnabled: boolean;
- TransformEditor: ComponentType<PythonTransformEditorProps>;
- SourceSection: ComponentType<PythonTransformSourceSectionProps>;
- PythonRunnerSettingsPage: ComponentType;
- getAdminRoutes: () => ReactNode;
- getTransformsNavLinks: () => ReactNode;
-};
-
-export const PLUGIN_TRANSFORMS_PYTHON: PythonTransformsPlugin = {
- isEnabled: false,
- TransformEditor: PluginPlaceholder,
- SourceSection: PluginPlaceholder,
- PythonRunnerSettingsPage: NotFoundPlaceholder,
- getAdminRoutes: () => null,
- getTransformsNavLinks: () => null,
-};
-
-type DependenciesPlugin = {
- isEnabled: boolean;
- DependencyGraphPage: ComponentType;
- DependencyGraphPageContext: Context<DependencyGraphPageContextType>;
- CheckDependenciesForm: ComponentType<CheckDependenciesFormProps>;
- CheckDependenciesModal: ComponentType<CheckDependenciesModalProps>;
- CheckDependenciesTitle: ComponentType;
- useCheckCardDependencies: (
- props: UseCheckDependenciesProps<Question>,
- ) => UseCheckDependenciesResult<Question>;
- useCheckSnippetDependencies: (
- props: UseCheckDependenciesProps<UpdateSnippetRequest>,
- ) => UseCheckDependenciesResult<UpdateSnippetRequest>;
- useCheckTransformDependencies: (
- props: UseCheckDependenciesProps<UpdateTransformRequest>,
- ) => UseCheckDependenciesResult<UpdateTransformRequest>;
-};
-
-export type DependencyGraphPageContextType = {
- baseUrl?: string;
- defaultEntry?: DependencyEntry;
-};
-
-export type CheckDependenciesFormProps = {
- checkData: CheckDependenciesResponse;
- onSave: () => void | Promise<void>;
- onCancel: () => void;
-};
-
-export type CheckDependenciesModalProps = {
- checkData: CheckDependenciesResponse;
- opened: boolean;
- onSave: () => void | Promise<void>;
- onClose: () => void;
-};
-
-export type UseCheckDependenciesProps<TChange> = {
- onSave: (change: TChange) => Promise<void>;
-};
-
-export type UseCheckDependenciesResult<TChange> = {
- checkData?: CheckDependenciesResponse;
- isCheckingDependencies: boolean;
- isConfirmationShown: boolean;
- handleInitialSave: (change: TChange) => Promise<void>;
- handleSaveAfterConfirmation: () => Promise<void>;
- handleCloseConfirmation: () => void;
-};
-
-function useCheckDependencies<TChange>({
- onSave,
-}: UseCheckDependenciesProps<TChange>): UseCheckDependenciesResult<TChange> {
- return {
- isConfirmationShown: false,
- isCheckingDependencies: false,
- handleInitialSave: onSave,
- handleSaveAfterConfirmation: () => Promise.resolve(),
- handleCloseConfirmation: () => undefined,
- };
+// Export a single reinitialize function that calls all individual reinitialize functions
+import { reinitialize as reinitializeAi } from "./oss/ai";
+import { reinitialize as reinitializeApi } from "./oss/api";
+import { reinitialize as reinitializeAudit } from "./oss/audit";
+import { reinitialize as reinitializeAuth } from "./oss/auth";
+import { reinitialize as reinitializeCaching } from "./oss/caching";
+import { reinitialize as reinitializeCollections } from "./oss/collections";
+import { reinitialize as reinitializeContentTranslation } from "./oss/content-translation";
+import { reinitialize as reinitializeContentVerification } from "./oss/content-verification";
+import { reinitialize as reinitializeCore } from "./oss/core";
+import { reinitialize as reinitializeDashcardMenu } from "./oss/dashcard-menu";
+import { reinitialize as reinitializeDatabase } from "./oss/database";
+import { reinitialize as reinitializeDocuments } from "./oss/documents";
+import { reinitialize as reinitializeEmbedding } from "./oss/embedding";
+import { reinitialize as reinitializeEmbeddingIframeSdk } from "./oss/embedding-iframe-sdk";
+import { reinitialize as reinitializeEmbeddingIframeSdkSetup } from "./oss/embedding-iframe-sdk-setup";
+import { reinitialize as reinitializeEmbeddingSdk } from "./oss/embedding-sdk";
+import { reinitialize as reinitializeEntities } from "./oss/entities";
+import { reinitialize as reinitializeModelPersistence } from "./oss/model-persistence";
+import { reinitialize as reinitializeModeration } from "./oss/moderation";
+import { reinitialize as reinitializePermissions } from "./oss/permissions";
+import { reinitialize as reinitializePublicSharing } from "./oss/public-sharing";
+import { reinitialize as reinitializeRemoteSync } from "./oss/remote-sync";
+import { reinitialize as reinitializeResourceDownloads } from "./oss/resource-downloads";
+import { reinitialize as reinitializeSemanticSearch } from "./oss/semantic-search";
+import { reinitialize as reinitializeSettings } from "./oss/settings";
+import { reinitialize as reinitializeSmtpOverride } from "./oss/smtp-override";
+import { reinitialize as reinitializeSupport } from "./oss/support";
+import { reinitialize as reinitializeTransforms } from "./oss/transforms";
+import { reinitialize as reinitializeUploadManagement } from "./oss/upload-management";
+import { reinitialize as reinitializeWhitelabel } from "./oss/whitelabel";
+
+/**
+ * Mostly for test purposes, reinitialize all plugins.
+ * You don't reinitialize plugins individually because some plugins depend on others,
+ * so reinitializing them all ensures that dependencies are correctly set up.
+ */
+export function reinitialize() {
+ reinitializeAi();
+ reinitializeApi();
+ reinitializeAudit();
+ reinitializeAuth();
+ reinitializeCaching();
+ reinitializeCollections();
+ reinitializeContentTranslation();
+ reinitializeContentVerification();
+ reinitializeCore();
+ reinitializeDashcardMenu();
+ reinitializeDatabase();
+ reinitializeDocuments();
+ reinitializeEmbedding();
+ reinitializeEmbeddingIframeSdk();
+ reinitializeEmbeddingIframeSdkSetup();
+ reinitializeEmbeddingSdk();
+ reinitializeEntities();
+ reinitializeModelPersistence();
+ reinitializeModeration();
+ reinitializePermissions();
+ reinitializePublicSharing();
+ reinitializeRemoteSync();
+ reinitializeResourceDownloads();
+ reinitializeSemanticSearch();
+ reinitializeSettings();
+ reinitializeSmtpOverride();
+ reinitializeSupport();
+ reinitializeTransforms();
+ reinitializeUploadManagement();
+ reinitializeWhitelabel();
}
-
-export const PLUGIN_DEPENDENCIES: DependenciesPlugin = {
- isEnabled: false,
- DependencyGraphPage: PluginPlaceholder,
- DependencyGraphPageContext: createContext({}),
- CheckDependenciesForm: PluginPlaceholder,
- CheckDependenciesModal: PluginPlaceholder,
- CheckDependenciesTitle: PluginPlaceholder,
- useCheckCardDependencies: useCheckDependencies,
- useCheckSnippetDependencies: useCheckDependencies,
- useCheckTransformDependencies: useCheckDependencies,
-};
diff --git a/frontend/src/metabase/plugins/oss/ai.ts b/frontend/src/metabase/plugins/oss/ai.ts
new file mode 100644
index 00000000000..65f5309b950
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/ai.ts
@@ -0,0 +1,129 @@
+import type { ComponentType } from "react";
+import React from "react";
+
+import type { MetabotContext } from "metabase/metabot";
+import { PluginPlaceholder } from "metabase/plugins/components/PluginPlaceholder";
+import type Question from "metabase-lib/v1/Question";
+import type {
+ DashCardId,
+ SearchModel,
+ Timeline,
+ TimelineEvent,
+ VisualizationDisplay,
+} from "metabase-types/api";
+import type { AdminPath, State } from "metabase-types/store";
+
+export type PluginAiSqlFixer = {
+ FixSqlQueryButton: ComponentType<Record<string, never>>;
+};
+
+export interface AIDashboardAnalysisSidebarProps {
+ onClose?: () => void;
+ dashcardId?: DashCardId;
+}
+
+export interface AIQuestionAnalysisSidebarProps {
+ question: Question;
+ className?: string;
+ onClose?: () => void;
+ timelines?: Timeline[];
+ visibleTimelineEvents?: TimelineEvent[];
+}
+
+export type PluginAIEntityAnalysis = {
+ AIQuestionAnalysisButton: ComponentType<any>;
+ AIQuestionAnalysisSidebar: ComponentType<AIQuestionAnalysisSidebarProps>;
+ AIDashboardAnalysisSidebar: ComponentType<AIDashboardAnalysisSidebarProps>;
+ canAnalyzeQuestion: (question: Question) => boolean;
+ chartAnalysisRenderFormats: {
+ [display in VisualizationDisplay]?: "png" | "svg" | "none";
+ };
+};
+
+type PluginMetabotConfig = {
+ emptyText?: string;
+ hideSuggestedPrompts?: boolean;
+ preventClose?: boolean;
+ preventRetryMessage?: boolean;
+ suggestionModels: (SearchModel | "transform" | "user")[];
+};
+
+type PluginMetabotType = {
+ isEnabled: () => boolean;
+ Metabot: (props: {
+ hide?: boolean;
+ config?: PluginMetabotConfig;
+ }) => React.ReactElement | null;
+ defaultMetabotContextValue: MetabotContext;
+ MetabotContext: React.Context<MetabotContext>;
+ getMetabotProvider: () => ComponentType<{ children: React.ReactNode }>;
+ getAdminPaths: () => AdminPath[];
+ getAdminRoutes: () => React.ReactElement;
+ getMetabotRoutes: () => React.ReactElement | null;
+ MetabotAdminPage: ComponentType;
+ getMetabotVisible: (state: State) => boolean;
+ MetabotToggleButton: ComponentType<{ className?: string }>;
+ MetabotAppBarButton: ComponentType;
+ MetabotAdminAppBarButton: ComponentType;
+};
+
+const getDefaultMetabotContextValue = (): MetabotContext => ({
+ prompt: "",
+ setPrompt: () => {},
+ promptInputRef: undefined,
+ getChatContext: () => ({}) as any,
+ registerChatContextProvider: () => () => {},
+});
+
+const defaultMetabotContextValue: MetabotContext =
+ getDefaultMetabotContextValue();
+
+const getDefaultPluginAiSqlFixer = (): PluginAiSqlFixer => ({
+ FixSqlQueryButton: PluginPlaceholder,
+});
+export const PLUGIN_AI_SQL_FIXER: PluginAiSqlFixer =
+ getDefaultPluginAiSqlFixer();
+
+const getDefaultPluginAIEntityAnalysis = (): PluginAIEntityAnalysis => ({
+ AIQuestionAnalysisButton: PluginPlaceholder,
+ AIQuestionAnalysisSidebar: PluginPlaceholder,
+ AIDashboardAnalysisSidebar: PluginPlaceholder,
+ canAnalyzeQuestion: () => false,
+ chartAnalysisRenderFormats: {},
+});
+export const PLUGIN_AI_ENTITY_ANALYSIS: PluginAIEntityAnalysis =
+ getDefaultPluginAIEntityAnalysis();
+
+const getDefaultPluginMetabot = (): PluginMetabotType => ({
+ isEnabled: () => false,
+ Metabot: (_props: { hide?: boolean; config?: PluginMetabotConfig }) =>
+ null as React.ReactElement | null,
+ defaultMetabotContextValue,
+ MetabotContext: React.createContext(defaultMetabotContextValue),
+ getMetabotProvider: () => {
+ return ({ children }) =>
+ React.createElement(
+ PLUGIN_METABOT.MetabotContext.Provider,
+ { value: PLUGIN_METABOT.defaultMetabotContextValue },
+ children,
+ );
+ },
+ getAdminPaths: () => [],
+ getAdminRoutes: () => PluginPlaceholder as unknown as React.ReactElement,
+ getMetabotRoutes: () => null,
+ MetabotAdminPage: () => `placeholder`,
+ getMetabotVisible: () => false,
+ MetabotToggleButton: PluginPlaceholder,
+ MetabotAppBarButton: PluginPlaceholder,
+ MetabotAdminAppBarButton: PluginPlaceholder,
+});
+export const PLUGIN_METABOT: PluginMetabotType = getDefaultPluginMetabot();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(PLUGIN_AI_SQL_FIXER, getDefaultPluginAiSqlFixer());
+ Object.assign(PLUGIN_AI_ENTITY_ANALYSIS, getDefaultPluginAIEntityAnalysis());
+ Object.assign(PLUGIN_METABOT, getDefaultPluginMetabot());
+}
diff --git a/frontend/src/metabase/plugins/oss/api.ts b/frontend/src/metabase/plugins/oss/api.ts
new file mode 100644
index 00000000000..b793a580743
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/api.ts
@@ -0,0 +1,23 @@
+import type { DashboardId, ParameterId } from "metabase-types/api";
+
+const getDefaultPluginApi = () => ({
+ getRemappedCardParameterValueUrl: (
+ dashboardId: DashboardId,
+ parameterId: ParameterId,
+ ) =>
+ `/api/card/${dashboardId}/params/${encodeURIComponent(parameterId)}/remapping`,
+ getRemappedDashboardParameterValueUrl: (
+ dashboardId: DashboardId,
+ parameterId: ParameterId,
+ ) =>
+ `/api/dashboard/${dashboardId}/params/${encodeURIComponent(parameterId)}/remapping`,
+});
+
+export const PLUGIN_API = getDefaultPluginApi();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(PLUGIN_API, getDefaultPluginApi());
+}
diff --git a/frontend/src/metabase/plugins/oss/audit.ts b/frontend/src/metabase/plugins/oss/audit.ts
new file mode 100644
index 00000000000..2424c5a5e69
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/audit.ts
@@ -0,0 +1,32 @@
+import type { ComponentType } from "react";
+
+import type { LinkProps } from "metabase/common/components/Link";
+import { PluginPlaceholder } from "metabase/plugins/components/PluginPlaceholder";
+import type Question from "metabase-lib/v1/Question";
+import type { Dashboard, Database as DatabaseType } from "metabase-types/api";
+
+export type InsightsLinkProps = (
+ | {
+ question: Pick<Question, "id" | "collection">;
+ dashboard?: never;
+ }
+ | {
+ question?: never;
+ dashboard: Pick<Dashboard, "id" | "collection">;
+ }
+) &
+ Omit<LinkProps, "to">;
+
+const getDefaultPluginAudit = () => ({
+ isAuditDb: (_db: DatabaseType) => false,
+ InsightsLink: PluginPlaceholder as ComponentType<InsightsLinkProps>,
+});
+
+export const PLUGIN_AUDIT = getDefaultPluginAudit();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(PLUGIN_AUDIT, getDefaultPluginAudit());
+}
diff --git a/frontend/src/metabase/plugins/oss/auth.ts b/frontend/src/metabase/plugins/oss/auth.ts
new file mode 100644
index 00000000000..621f13f9d51
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/auth.ts
@@ -0,0 +1,50 @@
+import {
+ NotFoundPlaceholder,
+ PluginPlaceholder,
+} from "metabase/plugins/components/PluginPlaceholder";
+import type { User } from "metabase-types/api";
+
+import type { GetAuthProviders } from "../types";
+
+const getDefaultPluginAuthProviders = () => ({
+ isEnabled: () => false,
+ AuthSettingsPage: PluginPlaceholder,
+ UserProvisioningSettings: NotFoundPlaceholder,
+ SettingsSAMLForm: NotFoundPlaceholder,
+ SettingsJWTForm: NotFoundPlaceholder,
+ providers: [] as GetAuthProviders[],
+});
+
+export const PLUGIN_AUTH_PROVIDERS = getDefaultPluginAuthProviders();
+
+const getDefaultPluginLdapFormFields = () => ({
+ LdapUserProvisioning: PluginPlaceholder,
+ LdapGroupMembershipFilter: PluginPlaceholder,
+});
+
+export const PLUGIN_LDAP_FORM_FIELDS = getDefaultPluginLdapFormFields();
+
+const getDefaultPluginIsPasswordUser = (): ((user: User) => boolean)[] => [];
+
+export const PLUGIN_IS_PASSWORD_USER = getDefaultPluginIsPasswordUser();
+
+const getDefaultPluginAdminUserFormFields = () => ({
+ FormLoginAttributes: PluginPlaceholder,
+});
+
+export const PLUGIN_ADMIN_USER_FORM_FIELDS =
+ getDefaultPluginAdminUserFormFields();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(PLUGIN_AUTH_PROVIDERS, getDefaultPluginAuthProviders());
+ Object.assign(PLUGIN_LDAP_FORM_FIELDS, getDefaultPluginLdapFormFields());
+ PLUGIN_IS_PASSWORD_USER.length = 0;
+ PLUGIN_IS_PASSWORD_USER.push(...getDefaultPluginIsPasswordUser());
+ Object.assign(
+ PLUGIN_ADMIN_USER_FORM_FIELDS,
+ getDefaultPluginAdminUserFormFields(),
+ );
+}
diff --git a/frontend/src/metabase/plugins/oss/caching.ts b/frontend/src/metabase/plugins/oss/caching.ts
new file mode 100644
index 00000000000..33aabb6b6e8
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/caching.ts
@@ -0,0 +1,64 @@
+import type { ComponentType, Dispatch, SetStateAction } from "react";
+
+import {
+ getPerformanceTabMetadata,
+ strategies,
+} from "metabase/admin/performance/constants/complex";
+import type { ModelWithClearableCache } from "metabase/admin/performance/types";
+import { PluginPlaceholder } from "metabase/plugins/components/PluginPlaceholder";
+import type { StackProps } from "metabase/ui";
+import type Question from "metabase-lib/v1/Question";
+import type { CacheableDashboard, CacheableModel } from "metabase-types/api";
+
+// Types
+export type InvalidateNowButtonProps = {
+ targetId: number;
+ targetModel: ModelWithClearableCache;
+ targetName: string;
+};
+
+export type SidebarCacheSectionProps = {
+ item: CacheableDashboard | Question;
+ model: CacheableModel;
+ setPage: Dispatch<SetStateAction<"default" | "caching">>;
+};
+
+export type SidebarCacheFormProps = {
+ item: CacheableDashboard | Question;
+ model: CacheableModel;
+ onClose: () => void;
+} & StackProps;
+
+export type PreemptiveCachingSwitchProps = {
+ handleSwitchToggle: () => void;
+};
+
+const getDefaultPluginCaching = () => ({
+ isGranularCachingEnabled: () => false,
+ StrategyFormLauncherPanel: PluginPlaceholder as any,
+ GranularControlsExplanation: PluginPlaceholder as any,
+ SidebarCacheSection:
+ PluginPlaceholder as ComponentType<SidebarCacheSectionProps>,
+ SidebarCacheForm: PluginPlaceholder as ComponentType<
+ SidebarCacheFormProps & { onBack: () => void }
+ >,
+ InvalidateNowButton:
+ PluginPlaceholder as ComponentType<InvalidateNowButtonProps>,
+ hasQuestionCacheSection: (_question: Question) => false,
+ canOverrideRootStrategy: false,
+ strategies: strategies,
+ DashboardAndQuestionCachingTab: PluginPlaceholder as any,
+ StrategyEditorForQuestionsAndDashboards: PluginPlaceholder as any,
+ getTabMetadata: getPerformanceTabMetadata,
+ PreemptiveCachingSwitch:
+ PluginPlaceholder as ComponentType<PreemptiveCachingSwitchProps>,
+});
+
+export const PLUGIN_CACHING = getDefaultPluginCaching();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(PLUGIN_CACHING, getDefaultPluginCaching());
+}
diff --git a/frontend/src/metabase/plugins/oss/collections.ts b/frontend/src/metabase/plugins/oss/collections.ts
new file mode 100644
index 00000000000..4a453751d71
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/collections.ts
@@ -0,0 +1,119 @@
+import type React from "react";
+import type { ComponentType } from "react";
+import { t } from "ttag";
+
+import { UNABLE_TO_CHANGE_ADMIN_PERMISSIONS } from "metabase/admin/permissions/constants/messages";
+import { getIconBase } from "metabase/lib/icon";
+import { PluginPlaceholder } from "metabase/plugins/components/PluginPlaceholder";
+import type { IconProps } from "metabase/ui";
+import type {
+ BaseEntityId,
+ Bookmark,
+ Collection,
+ CollectionAuthorityLevelConfig,
+ CollectionEssentials,
+ CollectionId,
+ CollectionInstanceAnaltyicsConfig,
+} from "metabase-types/api";
+
+// Types
+export type ItemWithCollection = { collection: CollectionEssentials };
+
+type GetCollectionIdType = (
+ sourceCollectionId?: CollectionId | null,
+) => CollectionId | null;
+
+export type CollectionAuthorityLevelDisplayProps = {
+ collection: Collection;
+};
+
+export type CollectionAuthorityLevelIcon = ComponentType<
+ Omit<IconProps, "name" | "tooltip"> & {
+ collection: Pick<Collection, "authority_level">;
+ tooltip?: "default" | "belonging";
+ archived?: boolean;
+ }
+>;
+
+type CollectionInstanceAnalyticsIcon = React.ComponentType<
+ Omit<IconProps, "name"> & {
+ collection: Collection;
+ entity: "collection" | "question" | "model" | "dashboard" | "metric";
+ }
+>;
+
+type FormCollectionAuthorityLevelPicker = React.ComponentType<
+ React.HTMLAttributes<HTMLDivElement> & { name: string; title?: string }
+>;
+
+const AUTHORITY_LEVEL_REGULAR: CollectionAuthorityLevelConfig = {
+ type: null,
+ get name() {
+ return t`Regular`;
+ },
+ icon: "folder",
+};
+
+const getDefaultPluginCollections = () => ({
+ AUTHORITY_LEVEL: {
+ [JSON.stringify(AUTHORITY_LEVEL_REGULAR.type)]: AUTHORITY_LEVEL_REGULAR,
+ },
+ COLLECTION_TYPES: {
+ [JSON.stringify(AUTHORITY_LEVEL_REGULAR.type)]: AUTHORITY_LEVEL_REGULAR,
+ },
+ REGULAR_COLLECTION: AUTHORITY_LEVEL_REGULAR,
+ isRegularCollection: (_data: Partial<Collection> | Bookmark) => true,
+ isSyncedCollection: (_data: Partial<Collection>) => false,
+ getCollectionType: (
+ _collection: Partial<Collection>,
+ ): CollectionAuthorityLevelConfig | CollectionInstanceAnaltyicsConfig =>
+ AUTHORITY_LEVEL_REGULAR,
+ useGetDefaultCollectionId: null as GetCollectionIdType | null,
+ CUSTOM_INSTANCE_ANALYTICS_COLLECTION_ENTITY_ID: "" as BaseEntityId | "",
+ INSTANCE_ANALYTICS_ADMIN_READONLY_MESSAGE: UNABLE_TO_CHANGE_ADMIN_PERMISSIONS,
+ getAuthorityLevelMenuItems: (
+ _collection: Collection,
+ _onUpdate: (collection: Collection, values: Partial<Collection>) => void,
+ ): React.ReactNode[] => [],
+ getIcon: getIconBase,
+ filterOutItemsFromInstanceAnalytics: <Item extends ItemWithCollection>(
+ items: Item[],
+ ) => items as Item[],
+ canCleanUp: (_collection: Collection) => false as boolean,
+ useGetCleanUpMenuItems: (
+ _collection: Collection,
+ ): { menuItems: JSX.Element[] } => ({
+ menuItems: [],
+ }),
+ cleanUpRoute: null as React.ReactElement | null,
+ cleanUpAlert: (() => null) as (props: {
+ collection: Collection;
+ }) => JSX.Element | null,
+});
+
+export const PLUGIN_COLLECTIONS = getDefaultPluginCollections();
+
+const getDefaultPluginCollectionComponents = () => ({
+ CollectionAuthorityLevelIcon:
+ PluginPlaceholder as CollectionAuthorityLevelIcon,
+ FormCollectionAuthorityLevelPicker:
+ PluginPlaceholder as FormCollectionAuthorityLevelPicker,
+ CollectionInstanceAnalyticsIcon:
+ PluginPlaceholder as CollectionInstanceAnalyticsIcon,
+ CollectionAuthorityLevelDisplay:
+ PluginPlaceholder as ComponentType<CollectionAuthorityLevelDisplayProps>,
+});
+
+export const PLUGIN_COLLECTION_COMPONENTS =
+ getDefaultPluginCollectionComponents();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(PLUGIN_COLLECTIONS, getDefaultPluginCollections());
+ Object.assign(
+ PLUGIN_COLLECTION_COMPONENTS,
+ getDefaultPluginCollectionComponents(),
+ );
+}
diff --git a/frontend/src/metabase/plugins/oss/content-translation.ts b/frontend/src/metabase/plugins/oss/content-translation.ts
new file mode 100644
index 00000000000..944d79467b3
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/content-translation.ts
@@ -0,0 +1,37 @@
+import { useCallback } from "react";
+
+import type { ContentTranslationFunction } from "metabase/i18n/types";
+import { PluginPlaceholder } from "metabase/plugins/components/PluginPlaceholder";
+import type { HoveredObject } from "metabase/visualizations/types";
+import type { Series } from "metabase-types/api";
+
+const getDefaultPluginContentTranslation = () => ({
+ isEnabled: false,
+ setEndpointsForStaticEmbedding: (_encodedToken: string) => {},
+ ContentTranslationConfiguration: PluginPlaceholder,
+ useTranslateContent: <
+ T = string | null | undefined,
+ >(): ContentTranslationFunction => {
+ return useCallback(<U = T>(arg: U) => arg, []);
+ },
+ translateDisplayNames: <T extends object>(
+ obj: T,
+ _tc: ContentTranslationFunction,
+ ) => obj,
+ useTranslateFieldValuesInHoveredObject: (obj?: HoveredObject | null) => obj,
+ useTranslateSeries: (obj: Series) => obj,
+ useSortByContentTranslation: () => (a: string, b: string) =>
+ a.localeCompare(b),
+});
+
+export const PLUGIN_CONTENT_TRANSLATION = getDefaultPluginContentTranslation();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(
+ PLUGIN_CONTENT_TRANSLATION,
+ getDefaultPluginContentTranslation(),
+ );
+}
diff --git a/frontend/src/metabase/plugins/oss/content-verification.ts b/frontend/src/metabase/plugins/oss/content-verification.ts
new file mode 100644
index 00000000000..060f195d6af
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/content-verification.ts
@@ -0,0 +1,45 @@
+import type { SearchFilterComponent } from "metabase/search/types";
+import type { CollectionEssentials } from "metabase-types/api";
+import type { State } from "metabase-types/store";
+
+export type ModelFilterControlsProps = any;
+export type ModelFilterSettings = {
+ verified: boolean;
+};
+
+export type MetricFilterControlsProps = any;
+export type MetricFilterSettings = {
+ verified: boolean;
+};
+
+const getDefaultPluginContentVerification = () => ({
+ contentVerificationEnabled: false,
+ VerifiedFilter: {} as SearchFilterComponent<"verified">,
+ sortCollectionsByVerification: (
+ _a: CollectionEssentials,
+ _b: CollectionEssentials,
+ ) => 0,
+
+ ModelFilterControls: (_props: ModelFilterControlsProps) => null,
+ getDefaultModelFilters: (_state: State): ModelFilterSettings => ({
+ verified: false,
+ }),
+
+ getDefaultMetricFilters: (_state: State): MetricFilterSettings => ({
+ verified: false,
+ }),
+ MetricFilterControls: (_props: MetricFilterControlsProps) => null,
+});
+
+export const PLUGIN_CONTENT_VERIFICATION =
+ getDefaultPluginContentVerification();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(
+ PLUGIN_CONTENT_VERIFICATION,
+ getDefaultPluginContentVerification(),
+ );
+}
diff --git a/frontend/src/metabase/plugins/oss/core.ts b/frontend/src/metabase/plugins/oss/core.ts
new file mode 100644
index 00000000000..5fe4d22f581
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/core.ts
@@ -0,0 +1,198 @@
+import type { Middleware } from "@reduxjs/toolkit";
+import type { ComponentType } from "react";
+import { t } from "ttag";
+
+import noResultsSource from "assets/img/no_results.svg";
+import { PluginPlaceholder } from "metabase/plugins/components/PluginPlaceholder";
+import type { UiParameter } from "metabase-lib/v1/parameters/types";
+import type { Dashboard, Pulse } from "metabase-types/api";
+import type { AdminPathKey, State } from "metabase-types/store";
+
+// Types
+export type IllustrationValue = {
+ src: string;
+ isDefault: boolean;
+} | null;
+
+interface PluginDashboardSubscriptionParametersSectionOverride {
+ Component?: ComponentType<{
+ className?: string;
+ parameters: UiParameter[];
+ hiddenParameters?: string;
+ dashboard: Dashboard;
+ pulse: Pulse;
+ setPulseParameters: (parameters: UiParameter[]) => void;
+ }>;
+}
+
+const defaultLandingPageIllustration = {
+ src: "app/img/bridge.svg",
+ isDefault: true,
+};
+
+const defaultLoginPageIllustration = {
+ src: "app/img/bridge.svg",
+ isDefault: true,
+};
+
+const getLoadingMessage = (isSlow: boolean | undefined = false) =>
+ isSlow ? t`Waiting for results...` : t`Doing science...`;
+
+const getDefaultAppInitFunctions = (): (() => void)[] => [];
+
+export const PLUGIN_APP_INIT_FUNCTIONS = getDefaultAppInitFunctions();
+
+const getDefaultLandingPage = () => ({
+ getLandingPage: () => "/",
+ LandingPageWidget: PluginPlaceholder,
+});
+
+export const PLUGIN_LANDING_PAGE: {
+ getLandingPage: () => string | null | undefined;
+ LandingPageWidget: ComponentType;
+} = getDefaultLandingPage();
+
+const getDefaultReduxMiddlewares = (): Middleware[] => [];
+
+export const PLUGIN_REDUX_MIDDLEWARES = getDefaultReduxMiddlewares();
+
+const getDefaultLogoIconComponents = (): ComponentType[] => [];
+
+export const PLUGIN_LOGO_ICON_COMPONENTS = getDefaultLogoIconComponents();
+
+const getDefaultAdminAllowedPathGetters = (): ((
+ user: any,
+) => AdminPathKey[])[] => [];
+
+export const PLUGIN_ADMIN_ALLOWED_PATH_GETTERS =
+ getDefaultAdminAllowedPathGetters();
+
+const getDefaultAdminTools = () => ({
+ COMPONENT: null,
+});
+
+export const PLUGIN_ADMIN_TOOLS: {
+ COMPONENT: ComponentType | null;
+} = getDefaultAdminTools();
+
+const getDefaultSelectors = () => ({
+ canWhitelabel: (_state: State) => false,
+ getLoadingMessageFactory: (_state: State) => getLoadingMessage,
+ getIsWhiteLabeling: (_state: State) => false,
+ // eslint-disable-next-line no-literal-metabase-strings -- This is the actual Metabase name, so we don't want to translate it.
+ getApplicationName: (_state: State) => "Metabase",
+ getShowMetabaseLinks: (_state: State) => true,
+ getLoginPageIllustration: (_state: State): IllustrationValue => {
+ return defaultLoginPageIllustration;
+ },
+ getLandingPageIllustration: (_state: State): IllustrationValue => {
+ return defaultLandingPageIllustration;
+ },
+ getNoDataIllustration: (_state: State): string | null => {
+ return noResultsSource;
+ },
+ getNoObjectIllustration: (_state: State): string | null => {
+ return noResultsSource;
+ },
+});
+
+export const PLUGIN_SELECTORS = getDefaultSelectors();
+
+const getDefaultFormWidgets = (): Record<string, ComponentType<any>> => ({});
+
+export const PLUGIN_FORM_WIDGETS = getDefaultFormWidgets();
+
+const getDefaultSnippetSidebarPlusMenuOptions = () => [];
+const getDefaultSnippetSidebarRowRenderers = () => ({});
+const getDefaultSnippetSidebarModals = () => [];
+const getDefaultSnippetSidebarHeaderButtons = () => [];
+
+export const PLUGIN_SNIPPET_SIDEBAR_PLUS_MENU_OPTIONS =
+ getDefaultSnippetSidebarPlusMenuOptions();
+export const PLUGIN_SNIPPET_SIDEBAR_ROW_RENDERERS =
+ getDefaultSnippetSidebarRowRenderers();
+export const PLUGIN_SNIPPET_SIDEBAR_MODALS = getDefaultSnippetSidebarModals();
+export const PLUGIN_SNIPPET_SIDEBAR_HEADER_BUTTONS =
+ getDefaultSnippetSidebarHeaderButtons();
+
+const getDefaultDashboardSubscriptionParametersSectionOverride =
+ (): PluginDashboardSubscriptionParametersSectionOverride => ({
+ Component: undefined,
+ });
+
+export const PLUGIN_DASHBOARD_SUBSCRIPTION_PARAMETERS_SECTION_OVERRIDE =
+ getDefaultDashboardSubscriptionParametersSectionOverride();
+
+const getDefaultReducers = () => ({
+ applicationPermissionsPlugin: () => null,
+ sandboxingPlugin: () => null,
+ shared: () => null,
+ metabotPlugin: () => null,
+ documents: () => null,
+ remoteSyncPlugin: () => null,
+});
+
+export const PLUGIN_REDUCERS: {
+ applicationPermissionsPlugin: any;
+ sandboxingPlugin: any;
+ shared: any;
+ metabotPlugin: any;
+ documents: any;
+ remoteSyncPlugin: any;
+} = getDefaultReducers();
+
+const getDefaultIsEeBuild = () => ({
+ isEEBuild: () => false,
+});
+
+export const PLUGIN_IS_EE_BUILD = getDefaultIsEeBuild();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ PLUGIN_APP_INIT_FUNCTIONS.length = 0;
+ PLUGIN_APP_INIT_FUNCTIONS.push(...getDefaultAppInitFunctions());
+
+ Object.assign(PLUGIN_LANDING_PAGE, getDefaultLandingPage());
+
+ PLUGIN_REDUX_MIDDLEWARES.length = 0;
+ PLUGIN_REDUX_MIDDLEWARES.push(...getDefaultReduxMiddlewares());
+
+ PLUGIN_LOGO_ICON_COMPONENTS.length = 0;
+ PLUGIN_LOGO_ICON_COMPONENTS.push(...getDefaultLogoIconComponents());
+
+ PLUGIN_ADMIN_ALLOWED_PATH_GETTERS.length = 0;
+ PLUGIN_ADMIN_ALLOWED_PATH_GETTERS.push(
+ ...getDefaultAdminAllowedPathGetters(),
+ );
+
+ Object.assign(PLUGIN_ADMIN_TOOLS, getDefaultAdminTools());
+ Object.assign(PLUGIN_SELECTORS, getDefaultSelectors());
+ Object.assign(PLUGIN_FORM_WIDGETS, getDefaultFormWidgets());
+
+ PLUGIN_SNIPPET_SIDEBAR_PLUS_MENU_OPTIONS.length = 0;
+ PLUGIN_SNIPPET_SIDEBAR_PLUS_MENU_OPTIONS.push(
+ ...getDefaultSnippetSidebarPlusMenuOptions(),
+ );
+
+ Object.assign(
+ PLUGIN_SNIPPET_SIDEBAR_ROW_RENDERERS,
+ getDefaultSnippetSidebarRowRenderers(),
+ );
+
+ PLUGIN_SNIPPET_SIDEBAR_MODALS.length = 0;
+ PLUGIN_SNIPPET_SIDEBAR_MODALS.push(...getDefaultSnippetSidebarModals());
+
+ PLUGIN_SNIPPET_SIDEBAR_HEADER_BUTTONS.length = 0;
+ PLUGIN_SNIPPET_SIDEBAR_HEADER_BUTTONS.push(
+ ...getDefaultSnippetSidebarHeaderButtons(),
+ );
+
+ Object.assign(
+ PLUGIN_DASHBOARD_SUBSCRIPTION_PARAMETERS_SECTION_OVERRIDE,
+ getDefaultDashboardSubscriptionParametersSectionOverride(),
+ );
+ Object.assign(PLUGIN_REDUCERS, getDefaultReducers());
+ Object.assign(PLUGIN_IS_EE_BUILD, getDefaultIsEeBuild());
+}
diff --git a/frontend/src/metabase/plugins/oss/dashcard-menu.ts b/frontend/src/metabase/plugins/oss/dashcard-menu.ts
new file mode 100644
index 00000000000..21a679d14b0
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/dashcard-menu.ts
@@ -0,0 +1,27 @@
+import type { DashCardMenuItem } from "metabase/dashboard/components/DashCard/DashCardMenu/dashcard-menu";
+import type Question from "metabase-lib/v1/Question";
+import type { DashCardId } from "metabase-types/api";
+import type { Dispatch as ReduxDispatch } from "metabase-types/store";
+
+type DashCardMenuItemGetter = (
+ question: Question,
+ dashcardId: DashCardId | undefined,
+ dispatch: ReduxDispatch,
+) => (DashCardMenuItem & { key: string }) | null;
+
+export type PluginDashcardMenu = {
+ dashcardMenuItemGetters: DashCardMenuItemGetter[];
+};
+
+const getDefaultPluginDashcardMenu = (): PluginDashcardMenu => ({
+ dashcardMenuItemGetters: [],
+});
+
+export const PLUGIN_DASHCARD_MENU = getDefaultPluginDashcardMenu();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(PLUGIN_DASHCARD_MENU, getDefaultPluginDashcardMenu());
+}
diff --git a/frontend/src/metabase/plugins/oss/database.ts b/frontend/src/metabase/plugins/oss/database.ts
new file mode 100644
index 00000000000..4f9c363b767
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/database.ts
@@ -0,0 +1,65 @@
+import type { ComponentType } from "react";
+
+import { PluginPlaceholder } from "metabase/plugins/components/PluginPlaceholder";
+import type Database from "metabase-lib/v1/metadata/Database";
+import type {
+ DatabaseData,
+ DatabaseId,
+ DatabaseLocalSettingAvailability,
+ Database as DatabaseType,
+ TableId,
+} from "metabase-types/api";
+
+const getDefaultPluginDbRouting = () => ({
+ DatabaseRoutingSection: PluginPlaceholder as ComponentType<{
+ database: DatabaseType;
+ }>,
+ getDatabaseNameFieldProps: (_isSlug: boolean) => ({}),
+ getDestinationDatabaseRoutes: (_IsAdmin: any) =>
+ null as React.ReactElement | null,
+ useRedirectDestinationDatabase: (
+ _database: Pick<DatabaseType, "id" | "router_database_id"> | undefined,
+ ): void => {},
+ getPrimaryDBEngineFieldState: (
+ _database: Pick<Database, "router_user_attribute">,
+ ): "default" | "hidden" | "disabled" => "default",
+});
+
+export const PLUGIN_DB_ROUTING = getDefaultPluginDbRouting();
+
+const getDefaultPluginDatabaseReplication = () => ({
+ DatabaseReplicationSection: PluginPlaceholder as ComponentType<{
+ database: DatabaseType;
+ }>,
+});
+
+export const PLUGIN_DATABASE_REPLICATION =
+ getDefaultPluginDatabaseReplication();
+
+const getDefaultPluginTableEditing = () => ({
+ isEnabled: () => false,
+ isDatabaseTableEditingEnabled: (_database: DatabaseType): boolean => false,
+ getRoutes: () => null as React.ReactElement | null,
+ getTableEditUrl: (_tableId: TableId, _databaseId: DatabaseId): string => "/",
+ AdminDatabaseTableEditingSection: PluginPlaceholder as ComponentType<{
+ database: DatabaseType;
+ settingsAvailable?: Record<string, DatabaseLocalSettingAvailability>;
+ updateDatabase: (
+ database: { id: DatabaseId } & Partial<DatabaseData>,
+ ) => Promise<void>;
+ }>,
+});
+
+export const PLUGIN_TABLE_EDITING = getDefaultPluginTableEditing();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(PLUGIN_DB_ROUTING, getDefaultPluginDbRouting());
+ Object.assign(
+ PLUGIN_DATABASE_REPLICATION,
+ getDefaultPluginDatabaseReplication(),
+ );
+ Object.assign(PLUGIN_TABLE_EDITING, getDefaultPluginTableEditing());
+}
diff --git a/frontend/src/metabase/plugins/oss/documents.ts b/frontend/src/metabase/plugins/oss/documents.ts
new file mode 100644
index 00000000000..0cbe3d0c3ae
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/documents.ts
@@ -0,0 +1,21 @@
+import type React from "react";
+
+import type { Document } from "metabase-types/api";
+
+const getDefaultPluginDocuments = () => ({
+ getRoutes: () => null as React.ReactElement | null,
+ shouldShowDocumentInNewItemMenu: () => false,
+ getCurrentDocument: (_state: any) => null as Document | null,
+ getSidebarOpen: (_state: any) => false,
+ getCommentSidebarOpen: (_state: any) => false,
+ DocumentCopyForm: (_props: any) => null as React.ReactElement | null,
+});
+
+export const PLUGIN_DOCUMENTS = getDefaultPluginDocuments();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(PLUGIN_DOCUMENTS, getDefaultPluginDocuments());
+}
diff --git a/frontend/src/metabase/plugins/oss/embedding-iframe-sdk-setup.ts b/frontend/src/metabase/plugins/oss/embedding-iframe-sdk-setup.ts
new file mode 100644
index 00000000000..59a43906796
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/embedding-iframe-sdk-setup.ts
@@ -0,0 +1,34 @@
+import type { ReactNode } from "react";
+
+export type SdkIframeEmbedSetupModalProps = {
+ opened: boolean;
+ onClose: () => void;
+ initialState?: SdkIframeEmbedSetupModalInitialState;
+};
+
+export type SdkIframeEmbedSetupModalInitialState = {
+ resourceType?: string | null;
+ resourceId?: string | number | null;
+ useExistingUserSession?: boolean;
+};
+
+const getDefaultPluginEmbeddingIframeSdkSetup = () => ({
+ isFeatureEnabled: () => false,
+ shouldShowEmbedInNewItemMenu: () => false,
+ SdkIframeEmbedSetupModal: (
+ _props: SdkIframeEmbedSetupModalProps,
+ ): ReactNode => null,
+});
+
+export const PLUGIN_EMBEDDING_IFRAME_SDK_SETUP =
+ getDefaultPluginEmbeddingIframeSdkSetup();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(
+ PLUGIN_EMBEDDING_IFRAME_SDK_SETUP,
+ getDefaultPluginEmbeddingIframeSdkSetup(),
+ );
+}
diff --git a/frontend/src/metabase/plugins/oss/embedding-iframe-sdk.ts b/frontend/src/metabase/plugins/oss/embedding-iframe-sdk.ts
new file mode 100644
index 00000000000..3a9e6c21a91
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/embedding-iframe-sdk.ts
@@ -0,0 +1,18 @@
+import type { ReactNode } from "react";
+
+const getDefaultPluginEmbeddingIframeSdk = () => ({
+ hasValidLicense: () => false,
+ SdkIframeEmbedRoute: (): ReactNode => null,
+});
+
+export const PLUGIN_EMBEDDING_IFRAME_SDK = getDefaultPluginEmbeddingIframeSdk();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(
+ PLUGIN_EMBEDDING_IFRAME_SDK,
+ getDefaultPluginEmbeddingIframeSdk(),
+ );
+}
diff --git a/frontend/src/metabase/plugins/oss/embedding-sdk.ts b/frontend/src/metabase/plugins/oss/embedding-sdk.ts
new file mode 100644
index 00000000000..6ce4f4343d0
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/embedding-sdk.ts
@@ -0,0 +1,15 @@
+const getDefaultPluginEmbeddingSdk = () => ({
+ isEnabled: () => false,
+ onBeforeRequestHandlers: {
+ getOrRefreshSessionHandler: async () => {},
+ },
+});
+
+export const PLUGIN_EMBEDDING_SDK = getDefaultPluginEmbeddingSdk();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(PLUGIN_EMBEDDING_SDK, getDefaultPluginEmbeddingSdk());
+}
diff --git a/frontend/src/metabase/plugins/oss/embedding.ts b/frontend/src/metabase/plugins/oss/embedding.ts
new file mode 100644
index 00000000000..5620664ed93
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/embedding.ts
@@ -0,0 +1,31 @@
+import type { ReactNode } from "react";
+
+import type { DataSourceSelectorProps } from "metabase/embedding-sdk/types/components/data-picker";
+import type { TableId } from "metabase-types/api";
+import type { State } from "metabase-types/store";
+import type { EmbeddingEntityType } from "metabase-types/store/embedding-data-picker";
+
+export interface SimpleDataPickerProps {
+ filterByDatabaseId: number | null;
+ selectedEntity?: TableId;
+ isInitiallyOpen: boolean;
+ triggerElement: ReactNode;
+ setSourceTableFn: (tableId: TableId) => void;
+ entityTypes: EmbeddingEntityType[];
+}
+
+const getDefaultPluginEmbedding = () => ({
+ isEnabled: () => false,
+ isInteractiveEmbeddingEnabled: (_state: State) => false,
+ SimpleDataPicker: (_props: SimpleDataPickerProps): ReactNode => null,
+ DataSourceSelector: (_props: DataSourceSelectorProps): ReactNode => null,
+});
+
+export const PLUGIN_EMBEDDING = getDefaultPluginEmbedding();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(PLUGIN_EMBEDDING, getDefaultPluginEmbedding());
+}
diff --git a/frontend/src/metabase/plugins/oss/entities.ts b/frontend/src/metabase/plugins/oss/entities.ts
new file mode 100644
index 00000000000..660d6e46cb9
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/entities.ts
@@ -0,0 +1,12 @@
+const getDefaultPluginEntities = () => ({
+ entities: {} as Record<string, any>,
+});
+
+export const PLUGIN_ENTITIES = getDefaultPluginEntities();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(PLUGIN_ENTITIES, getDefaultPluginEntities());
+}
diff --git a/frontend/src/metabase/plugins/oss/model-persistence.ts b/frontend/src/metabase/plugins/oss/model-persistence.ts
new file mode 100644
index 00000000000..21797a0dfd2
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/model-persistence.ts
@@ -0,0 +1,23 @@
+import { PluginPlaceholder } from "metabase/plugins/components/PluginPlaceholder";
+import type Question from "metabase-lib/v1/Question";
+import type { ModelCacheRefreshStatus } from "metabase-types/api";
+
+const getDefaultPluginModelPersistence = () => ({
+ isModelLevelPersistenceEnabled: () => false,
+ ModelCacheToggle: PluginPlaceholder as ({
+ persistedModel,
+ model,
+ }: {
+ persistedModel?: ModelCacheRefreshStatus;
+ model: Question;
+ }) => JSX.Element,
+});
+
+export const PLUGIN_MODEL_PERSISTENCE = getDefaultPluginModelPersistence();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(PLUGIN_MODEL_PERSISTENCE, getDefaultPluginModelPersistence());
+}
diff --git a/frontend/src/metabase/plugins/oss/moderation.ts b/frontend/src/metabase/plugins/oss/moderation.ts
new file mode 100644
index 00000000000..06d205ebaae
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/moderation.ts
@@ -0,0 +1,39 @@
+import type { ColorName } from "metabase/lib/colors/types";
+import { PluginPlaceholder } from "metabase/plugins/components/PluginPlaceholder";
+import type { IconName, IconProps } from "metabase/ui";
+import type Question from "metabase-lib/v1/Question";
+import type { BaseUser, Dashboard } from "metabase-types/api";
+
+export type RevisionOrModerationEvent = {
+ title: string;
+ timestamp: string;
+ icon: IconName | { name: IconName; color: ColorName } | Record<string, never>;
+ description?: string;
+ revision?: any;
+};
+
+const getDefaultPluginModeration = () => ({
+ isEnabled: () => false,
+ EntityModerationIcon: PluginPlaceholder,
+ QuestionModerationSection: PluginPlaceholder,
+ ModerationReviewBanner: PluginPlaceholder,
+ ModerationReviewTextForQuestion: PluginPlaceholder,
+ ModerationReviewTextForDashboard: PluginPlaceholder,
+ ModerationStatusIcon: PluginPlaceholder,
+ getQuestionIcon: PluginPlaceholder,
+ getStatusIcon: (_moderated_status?: string): string | IconProps | undefined =>
+ undefined,
+ getModerationTimelineEvents: (_reviews: any, _currentUser: BaseUser | null) =>
+ [] as RevisionOrModerationEvent[],
+ useDashboardMenuItems: (_model?: Dashboard, _reload?: () => void) => [],
+ useQuestionMenuItems: (_model?: Question, _reload?: () => void) => [],
+});
+
+export const PLUGIN_MODERATION = getDefaultPluginModeration();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(PLUGIN_MODERATION, getDefaultPluginModeration());
+}
diff --git a/frontend/src/metabase/plugins/oss/permissions.ts b/frontend/src/metabase/plugins/oss/permissions.ts
new file mode 100644
index 00000000000..a98e254a504
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/permissions.ts
@@ -0,0 +1,264 @@
+import type { ReactNode } from "react";
+
+import {
+ type DataPermission,
+ DataPermissionValue,
+ type DatabaseEntityId,
+ type EntityId,
+ type PermissionSubject,
+} from "metabase/admin/permissions/types";
+import type Database from "metabase-lib/v1/metadata/Database";
+import type {
+ Dataset,
+ Group,
+ GroupPermissions,
+ GroupsPermissions,
+ User,
+} from "metabase-types/api";
+import type { State } from "metabase-types/store";
+
+import type { PluginGroupManagersType } from "../types";
+
+// Types
+export interface UserWithApplicationPermissions extends User {
+ permissions?: {
+ can_access_monitoring: boolean;
+ can_access_setting: boolean;
+ can_access_subscription: boolean;
+ };
+}
+
+const getDefaultAdminPermissionsDatabaseRoutes = () => [];
+const getDefaultAdminPermissionsDatabaseGroupRoutes = () => [];
+const getDefaultAdminPermissionsDatabasePostActions = () => ({
+ impersonated: null,
+});
+const getDefaultAdminPermissionsDatabaseActions = () => ({
+ impersonated: [],
+});
+const getDefaultAdminPermissionsTableOptions = () => [];
+const getDefaultAdminPermissionsTableRoutes = () => [];
+const getDefaultAdminPermissionsTableGroupRoutes = () => [];
+const getDefaultAdminPermissionsTableFieldsOptions = () => [];
+const getDefaultAdminPermissionsTableFieldsConfirmations = (): Array<
+ (
+ _permissions: GroupsPermissions,
+ _groupId: number,
+ _entityId: EntityId,
+ _value: DataPermissionValue,
+ ) => any
+> => [];
+const getDefaultAdminPermissionsTableFieldsActions = () => ({
+ sandboxed: [],
+});
+const getDefaultAdminPermissionsTableFieldsPostAction = () => ({
+ sandboxed: null,
+});
+
+export const PLUGIN_ADMIN_PERMISSIONS_DATABASE_ROUTES =
+ getDefaultAdminPermissionsDatabaseRoutes();
+export const PLUGIN_ADMIN_PERMISSIONS_DATABASE_GROUP_ROUTES =
+ getDefaultAdminPermissionsDatabaseGroupRoutes();
+export const PLUGIN_ADMIN_PERMISSIONS_DATABASE_POST_ACTIONS =
+ getDefaultAdminPermissionsDatabasePostActions();
+export const PLUGIN_ADMIN_PERMISSIONS_DATABASE_ACTIONS =
+ getDefaultAdminPermissionsDatabaseActions();
+export const PLUGIN_ADMIN_PERMISSIONS_TABLE_OPTIONS =
+ getDefaultAdminPermissionsTableOptions();
+export const PLUGIN_ADMIN_PERMISSIONS_TABLE_ROUTES =
+ getDefaultAdminPermissionsTableRoutes();
+export const PLUGIN_ADMIN_PERMISSIONS_TABLE_GROUP_ROUTES =
+ getDefaultAdminPermissionsTableGroupRoutes();
+export const PLUGIN_ADMIN_PERMISSIONS_TABLE_FIELDS_OPTIONS =
+ getDefaultAdminPermissionsTableFieldsOptions();
+export const PLUGIN_ADMIN_PERMISSIONS_TABLE_FIELDS_CONFIRMATIONS =
+ getDefaultAdminPermissionsTableFieldsConfirmations();
+export const PLUGIN_ADMIN_PERMISSIONS_TABLE_FIELDS_ACTIONS =
+ getDefaultAdminPermissionsTableFieldsActions();
+export const PLUGIN_ADMIN_PERMISSIONS_TABLE_FIELDS_POST_ACTION =
+ getDefaultAdminPermissionsTableFieldsPostAction();
+
+const getDefaultDataPermissions = () => ({
+ permissionsPayloadExtraSelectors: [],
+ hasChanges: [],
+ upgradeViewPermissionsIfNeeded: null,
+ shouldRestrictNativeQueryPermissions: () => false,
+});
+
+export const PLUGIN_DATA_PERMISSIONS: {
+ permissionsPayloadExtraSelectors: ((
+ state: State,
+ ) => [Record<string, undefined | { group_id: string }[]>, string[]])[];
+ hasChanges: ((state: State) => boolean)[];
+ shouldRestrictNativeQueryPermissions: (
+ permissions: GroupsPermissions,
+ groupId: number,
+ entityId: EntityId,
+ permission: DataPermission,
+ value: DataPermissionValue,
+ database: Database,
+ ) => boolean;
+
+ upgradeViewPermissionsIfNeeded:
+ | ((
+ permissions: GroupsPermissions,
+ groupId: number,
+ entityId: EntityId,
+ value: any,
+ database: Database,
+ permission: DataPermission,
+ ) => GroupPermissions)
+ | null;
+} = getDefaultDataPermissions();
+
+const getDefaultAdminUserMenuItems = (): Array<
+ (user: User) => React.ReactNode
+> => [];
+const getDefaultAdminUserMenuRoutes = () => [];
+
+export const PLUGIN_ADMIN_USER_MENU_ITEMS = getDefaultAdminUserMenuItems();
+export const PLUGIN_ADMIN_USER_MENU_ROUTES = getDefaultAdminUserMenuRoutes();
+
+const getDefaultAdvancedPermissions = () => ({
+ addDatabasePermissionOptions: (permissions: any[], _database: Database) =>
+ permissions,
+ addSchemaPermissionOptions: (permissions: any[], _value: string) =>
+ permissions,
+ addTablePermissionOptions: (permissions: any[], _value: string) =>
+ permissions,
+ getDatabaseLimitedAccessPermission: (_value: string) => null,
+ isAccessPermissionDisabled: (
+ _value: string,
+ _subject: "schemas" | "tables" | "fields",
+ ) => false,
+ isRestrictivePermission: (_value: string) => false,
+ shouldShowViewDataColumn: false,
+ defaultViewDataPermission: DataPermissionValue.UNRESTRICTED,
+});
+
+export const PLUGIN_ADVANCED_PERMISSIONS = getDefaultAdvancedPermissions();
+
+const getDefaultFeatureLevelPermissions = () => ({
+ getFeatureLevelDataPermissions: (
+ _entityId: DatabaseEntityId,
+ _groupId: number,
+ _isAdmin: boolean,
+ _permissions: GroupsPermissions,
+ _dataAccessPermissionValue: DataPermissionValue,
+ _defaultGroup: Group,
+ _permissionSubject: PermissionSubject,
+ ) => {
+ return [] as any;
+ },
+ getDataColumns: (_subject: PermissionSubject) => [] as any,
+ getDownloadWidgetMessageOverride: (_result: Dataset): string | null => null,
+ canDownloadResults: (_result: Dataset): boolean => true,
+ dataModelQueryProps: {} as any,
+ databaseDetailsQueryProps: {} as any,
+});
+
+export const PLUGIN_FEATURE_LEVEL_PERMISSIONS =
+ getDefaultFeatureLevelPermissions();
+
+const getDefaultApplicationPermissions = () => ({
+ getRoutes: (): ReactNode => null,
+ tabs: [] as any,
+ selectors: {
+ canAccessSettings: (_state: any) => false,
+ canManageSubscriptions: (_state: any) => true,
+ },
+});
+
+export const PLUGIN_APPLICATION_PERMISSIONS =
+ getDefaultApplicationPermissions();
+
+const getDefaultGroupManagers = (): PluginGroupManagersType => ({
+ UserTypeToggle: () => null as any,
+ UserTypeCell: null,
+
+ getChangeMembershipConfirmation: () => null,
+ getRemoveMembershipConfirmation: () => null,
+
+ deleteGroup: null,
+ confirmDeleteMembershipAction: null,
+ confirmUpdateMembershipAction: null,
+});
+
+export const PLUGIN_GROUP_MANAGERS = getDefaultGroupManagers();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ PLUGIN_ADMIN_PERMISSIONS_DATABASE_ROUTES.length = 0;
+ PLUGIN_ADMIN_PERMISSIONS_DATABASE_ROUTES.push(
+ ...getDefaultAdminPermissionsDatabaseRoutes(),
+ );
+
+ PLUGIN_ADMIN_PERMISSIONS_DATABASE_GROUP_ROUTES.length = 0;
+ PLUGIN_ADMIN_PERMISSIONS_DATABASE_GROUP_ROUTES.push(
+ ...getDefaultAdminPermissionsDatabaseGroupRoutes(),
+ );
+
+ Object.assign(
+ PLUGIN_ADMIN_PERMISSIONS_DATABASE_POST_ACTIONS,
+ getDefaultAdminPermissionsDatabasePostActions(),
+ );
+ Object.assign(
+ PLUGIN_ADMIN_PERMISSIONS_DATABASE_ACTIONS,
+ getDefaultAdminPermissionsDatabaseActions(),
+ );
+
+ PLUGIN_ADMIN_PERMISSIONS_TABLE_OPTIONS.length = 0;
+ PLUGIN_ADMIN_PERMISSIONS_TABLE_OPTIONS.push(
+ ...getDefaultAdminPermissionsTableOptions(),
+ );
+
+ PLUGIN_ADMIN_PERMISSIONS_TABLE_ROUTES.length = 0;
+ PLUGIN_ADMIN_PERMISSIONS_TABLE_ROUTES.push(
+ ...getDefaultAdminPermissionsTableRoutes(),
+ );
+
+ PLUGIN_ADMIN_PERMISSIONS_TABLE_GROUP_ROUTES.length = 0;
+ PLUGIN_ADMIN_PERMISSIONS_TABLE_GROUP_ROUTES.push(
+ ...getDefaultAdminPermissionsTableGroupRoutes(),
+ );
+
+ PLUGIN_ADMIN_PERMISSIONS_TABLE_FIELDS_OPTIONS.length = 0;
+ PLUGIN_ADMIN_PERMISSIONS_TABLE_FIELDS_OPTIONS.push(
+ ...getDefaultAdminPermissionsTableFieldsOptions(),
+ );
+
+ PLUGIN_ADMIN_PERMISSIONS_TABLE_FIELDS_CONFIRMATIONS.length = 0;
+ PLUGIN_ADMIN_PERMISSIONS_TABLE_FIELDS_CONFIRMATIONS.push(
+ ...getDefaultAdminPermissionsTableFieldsConfirmations(),
+ );
+
+ Object.assign(
+ PLUGIN_ADMIN_PERMISSIONS_TABLE_FIELDS_ACTIONS,
+ getDefaultAdminPermissionsTableFieldsActions(),
+ );
+ Object.assign(
+ PLUGIN_ADMIN_PERMISSIONS_TABLE_FIELDS_POST_ACTION,
+ getDefaultAdminPermissionsTableFieldsPostAction(),
+ );
+
+ Object.assign(PLUGIN_DATA_PERMISSIONS, getDefaultDataPermissions());
+
+ PLUGIN_ADMIN_USER_MENU_ITEMS.length = 0;
+ PLUGIN_ADMIN_USER_MENU_ITEMS.push(...getDefaultAdminUserMenuItems());
+
+ PLUGIN_ADMIN_USER_MENU_ROUTES.length = 0;
+ PLUGIN_ADMIN_USER_MENU_ROUTES.push(...getDefaultAdminUserMenuRoutes());
+
+ Object.assign(PLUGIN_ADVANCED_PERMISSIONS, getDefaultAdvancedPermissions());
+ Object.assign(
+ PLUGIN_FEATURE_LEVEL_PERMISSIONS,
+ getDefaultFeatureLevelPermissions(),
+ );
+ Object.assign(
+ PLUGIN_APPLICATION_PERMISSIONS,
+ getDefaultApplicationPermissions(),
+ );
+ Object.assign(PLUGIN_GROUP_MANAGERS, getDefaultGroupManagers());
+}
diff --git a/frontend/src/metabase/plugins/oss/public-sharing.ts b/frontend/src/metabase/plugins/oss/public-sharing.ts
new file mode 100644
index 00000000000..fc68e83bd8a
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/public-sharing.ts
@@ -0,0 +1,15 @@
+import type React from "react";
+
+const getDefaultPluginPublicSharing = () => ({
+ PublicDocumentRoute: (_props: any) => null as React.ReactElement | null,
+ PublicLinksDocumentListing: () => null as React.ReactElement | null,
+});
+
+export const PLUGIN_PUBLIC_SHARING = getDefaultPluginPublicSharing();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(PLUGIN_PUBLIC_SHARING, getDefaultPluginPublicSharing());
+}
diff --git a/frontend/src/metabase/plugins/oss/remote-sync.ts b/frontend/src/metabase/plugins/oss/remote-sync.ts
new file mode 100644
index 00000000000..cd348f91cdd
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/remote-sync.ts
@@ -0,0 +1,44 @@
+import type { TagDescription } from "@reduxjs/toolkit/query";
+import type { ComponentType, ReactNode } from "react";
+
+import {
+ NotFoundPlaceholder,
+ PluginPlaceholder,
+} from "metabase/plugins/components/PluginPlaceholder";
+
+import type { SyncedCollectionsSidebarSectionProps } from "../types";
+
+const getDefaultPluginRemoteSync = () => ({
+ LibraryNav: PluginPlaceholder,
+ RemoteSyncSettings: NotFoundPlaceholder,
+ SyncedCollectionsSidebarSection: PluginPlaceholder,
+ REMOTE_SYNC_INVALIDATION_TAGS: null,
+ useSyncStatus: () => ({
+ isIdle: true,
+ taskType: null,
+ progress: 0,
+ message: "",
+ progressModal: null,
+ }),
+});
+
+export const PLUGIN_REMOTE_SYNC: {
+ LibraryNav: ComponentType;
+ RemoteSyncSettings: ComponentType;
+ SyncedCollectionsSidebarSection: ComponentType<SyncedCollectionsSidebarSectionProps>;
+ REMOTE_SYNC_INVALIDATION_TAGS: TagDescription<any>[] | null;
+ useSyncStatus: () => {
+ isIdle: boolean;
+ taskType: any;
+ progress: number;
+ message: string;
+ progressModal: ReactNode;
+ };
+} = getDefaultPluginRemoteSync();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(PLUGIN_REMOTE_SYNC, getDefaultPluginRemoteSync());
+}
diff --git a/frontend/src/metabase/plugins/oss/resource-downloads.ts b/frontend/src/metabase/plugins/oss/resource-downloads.ts
new file mode 100644
index 00000000000..1ebdd483a29
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/resource-downloads.ts
@@ -0,0 +1,19 @@
+import type { EmbedResourceDownloadOptions } from "metabase/public/lib/types";
+
+const getDefaultPluginResourceDownloads = () => ({
+ areDownloadsEnabled: (_args: {
+ downloads?: string | boolean | null;
+ }): EmbedResourceDownloadOptions => ({
+ pdf: true,
+ results: true,
+ }),
+});
+
+export const PLUGIN_RESOURCE_DOWNLOADS = getDefaultPluginResourceDownloads();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(PLUGIN_RESOURCE_DOWNLOADS, getDefaultPluginResourceDownloads());
+}
diff --git a/frontend/src/metabase/plugins/oss/semantic-search.ts b/frontend/src/metabase/plugins/oss/semantic-search.ts
new file mode 100644
index 00000000000..ad79a76dc0b
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/semantic-search.ts
@@ -0,0 +1,14 @@
+import { PluginPlaceholder } from "metabase/plugins/components/PluginPlaceholder";
+
+const getDefaultPluginSemanticSearch = () => ({
+ SearchSettingsWidget: PluginPlaceholder,
+});
+
+export const PLUGIN_SEMANTIC_SEARCH = getDefaultPluginSemanticSearch();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(PLUGIN_SEMANTIC_SEARCH, getDefaultPluginSemanticSearch());
+}
diff --git a/frontend/src/metabase/plugins/oss/settings.ts b/frontend/src/metabase/plugins/oss/settings.ts
new file mode 100644
index 00000000000..abe59af9478
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/settings.ts
@@ -0,0 +1,31 @@
+import type { ComponentType } from "react";
+
+import { PluginPlaceholder } from "metabase/plugins/components/PluginPlaceholder";
+
+const getDefaultPluginAdminSettings = () => ({
+ InteractiveEmbeddingSettings: null,
+ LicenseAndBillingSettings: PluginPlaceholder,
+ useUpsellFlow: (_props: {
+ campaign: string;
+ location: string;
+ }): {
+ triggerUpsellFlow: (() => void) | undefined;
+ } => ({
+ triggerUpsellFlow: undefined,
+ }),
+});
+
+export const PLUGIN_ADMIN_SETTINGS: {
+ InteractiveEmbeddingSettings: ComponentType | null;
+ LicenseAndBillingSettings: ComponentType;
+ useUpsellFlow: (props: { campaign: string; location: string }) => {
+ triggerUpsellFlow: (() => void) | undefined;
+ };
+} = getDefaultPluginAdminSettings();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(PLUGIN_ADMIN_SETTINGS, getDefaultPluginAdminSettings());
+}
diff --git a/frontend/src/metabase/plugins/oss/smtp-override.ts b/frontend/src/metabase/plugins/oss/smtp-override.ts
new file mode 100644
index 00000000000..81e1f28939a
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/smtp-override.ts
@@ -0,0 +1,20 @@
+import type { ComponentType } from "react";
+
+import { PluginPlaceholder } from "metabase/plugins/components/PluginPlaceholder";
+
+const getDefaultPluginSmtpOverride = () => ({
+ CloudSMTPConnectionCard: PluginPlaceholder,
+ SMTPOverrideConnectionForm: PluginPlaceholder,
+});
+
+export const PLUGIN_SMTP_OVERRIDE: {
+ CloudSMTPConnectionCard: ComponentType;
+ SMTPOverrideConnectionForm: ComponentType<{ onClose: () => void }>;
+} = getDefaultPluginSmtpOverride();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(PLUGIN_SMTP_OVERRIDE, getDefaultPluginSmtpOverride());
+}
diff --git a/frontend/src/metabase/plugins/oss/support.ts b/frontend/src/metabase/plugins/oss/support.ts
new file mode 100644
index 00000000000..f88fed95cb3
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/support.ts
@@ -0,0 +1,22 @@
+import type { ComponentType } from "react";
+
+import { NotFoundPlaceholder } from "../components/PluginPlaceholder";
+
+const getDefaultPluginSupport = () => ({
+ isEnabled: false,
+ SupportSettings: NotFoundPlaceholder,
+ GrantAccessModal: NotFoundPlaceholder,
+});
+
+export const PLUGIN_SUPPORT: {
+ isEnabled: boolean;
+ SupportSettings: ComponentType;
+ GrantAccessModal: ComponentType<{ onClose: VoidFunction }>;
+} = getDefaultPluginSupport();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(PLUGIN_SUPPORT, getDefaultPluginSupport());
+}
diff --git a/frontend/src/metabase/plugins/oss/transforms.ts b/frontend/src/metabase/plugins/oss/transforms.ts
new file mode 100644
index 00000000000..1464bbe3580
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/transforms.ts
@@ -0,0 +1,165 @@
+import type { ComponentType, Context, ReactNode } from "react";
+import { createContext } from "react";
+
+import {
+ NotFoundPlaceholder,
+ PluginPlaceholder,
+} from "metabase/plugins/components/PluginPlaceholder";
+import type Question from "metabase-lib/v1/Question";
+import type {
+ CheckDependenciesResponse,
+ PythonTransformSourceDraft,
+ Transform,
+ TransformId,
+ UpdateSnippetRequest,
+ UpdateTransformRequest,
+} from "metabase-types/api";
+import type { AdminPath } from "metabase-types/store";
+
+// Types
+export type TransformPickerItem = {
+ id: TransformId;
+ name: string;
+ model: "transform";
+};
+
+export type TransformPickerProps = {
+ value: TransformPickerItem | undefined;
+ onItemSelect: (transform: TransformPickerItem) => void;
+};
+
+export type TransformsPlugin = {
+ TransformPicker: ComponentType<TransformPickerProps>;
+ getAdminPaths(): AdminPath[];
+ getAdminRoutes(): ReactNode;
+};
+
+export type PythonTransformEditorProps = {
+ name?: string;
+ source: PythonTransformSourceDraft;
+ proposedSource?: PythonTransformSourceDraft;
+ isNew: boolean;
+ isDirty: boolean;
+ isSaving: boolean;
+ onChangeSource: (source: PythonTransformSourceDraft) => void;
+ onSave: () => void;
+ onCancel: () => void;
+ onAcceptProposed: () => void;
+ onRejectProposed: () => void;
+};
+
+export type PythonTransformSourceSectionProps = {
+ transform: Transform;
+};
+
+export type PythonTransformsPlugin = {
+ isEnabled: boolean;
+ TransformEditor: ComponentType<PythonTransformEditorProps>;
+ SourceSection: ComponentType<PythonTransformSourceSectionProps>;
+ PythonRunnerSettingsPage: ComponentType;
+ getAdminRoutes: () => ReactNode;
+ getTransformsNavLinks: () => ReactNode;
+};
+
+type DependenciesPlugin = {
+ isEnabled: boolean;
+ DependencyGraphPage: ComponentType;
+ DependencyGraphPageContext: Context<DependencyGraphPageContextType>;
+ CheckDependenciesForm: ComponentType<CheckDependenciesFormProps>;
+ CheckDependenciesModal: ComponentType<CheckDependenciesModalProps>;
+ CheckDependenciesTitle: ComponentType;
+ useCheckCardDependencies: (
+ props: UseCheckDependenciesProps<Question>,
+ ) => UseCheckDependenciesResult<Question>;
+ useCheckSnippetDependencies: (
+ props: UseCheckDependenciesProps<UpdateSnippetRequest>,
+ ) => UseCheckDependenciesResult<UpdateSnippetRequest>;
+ useCheckTransformDependencies: (
+ props: UseCheckDependenciesProps<UpdateTransformRequest>,
+ ) => UseCheckDependenciesResult<UpdateTransformRequest>;
+};
+
+export type DependencyGraphPageContextType = {
+ baseUrl?: string;
+ defaultEntry?: any;
+};
+
+export type CheckDependenciesFormProps = {
+ checkData: CheckDependenciesResponse;
+ onSave: () => void | Promise<void>;
+ onCancel: () => void;
+};
+
+export type CheckDependenciesModalProps = {
+ checkData: CheckDependenciesResponse;
+ opened: boolean;
+ onSave: () => void | Promise<void>;
+ onClose: () => void;
+};
+
+export type UseCheckDependenciesProps<TChange> = {
+ onSave: (change: TChange) => Promise<void>;
+};
+
+export type UseCheckDependenciesResult<TChange> = {
+ checkData?: CheckDependenciesResponse;
+ isCheckingDependencies: boolean;
+ isConfirmationShown: boolean;
+ handleInitialSave: (change: TChange) => Promise<void>;
+ handleSaveAfterConfirmation: () => Promise<void>;
+ handleCloseConfirmation: () => void;
+};
+
+function useCheckDependencies<TChange>({
+ onSave,
+}: UseCheckDependenciesProps<TChange>): UseCheckDependenciesResult<TChange> {
+ return {
+ isConfirmationShown: false,
+ isCheckingDependencies: false,
+ handleInitialSave: onSave,
+ handleSaveAfterConfirmation: () => Promise.resolve(),
+ handleCloseConfirmation: () => undefined,
+ };
+}
+
+const getDefaultPluginTransforms = (): TransformsPlugin => ({
+ TransformPicker: PluginPlaceholder,
+ getAdminPaths: () => [],
+ getAdminRoutes: () => null,
+});
+
+export const PLUGIN_TRANSFORMS = getDefaultPluginTransforms();
+
+const getDefaultPluginTransformsPython = (): PythonTransformsPlugin => ({
+ isEnabled: false,
+ TransformEditor: PluginPlaceholder,
+ SourceSection: PluginPlaceholder,
+ PythonRunnerSettingsPage: NotFoundPlaceholder,
+ getAdminRoutes: () => null,
+ getTransformsNavLinks: () => null,
+});
+
+export const PLUGIN_TRANSFORMS_PYTHON = getDefaultPluginTransformsPython();
+
+const getDefaultPluginDependencies = (): DependenciesPlugin => ({
+ isEnabled: false,
+ DependencyGraphPage: PluginPlaceholder,
+ DependencyGraphPageContext: createContext({}),
+ CheckDependenciesForm: PluginPlaceholder,
+ CheckDependenciesModal: PluginPlaceholder,
+ CheckDependenciesTitle: PluginPlaceholder,
+ useCheckCardDependencies: useCheckDependencies,
+ useCheckSnippetDependencies: useCheckDependencies,
+ useCheckTransformDependencies: useCheckDependencies,
+});
+
+export const PLUGIN_DEPENDENCIES = getDefaultPluginDependencies();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(PLUGIN_TRANSFORMS, getDefaultPluginTransforms());
+ Object.assign(PLUGIN_TRANSFORMS_PYTHON, getDefaultPluginTransformsPython());
+ Object.assign(PLUGIN_DEPENDENCIES, getDefaultPluginDependencies());
+}
diff --git a/frontend/src/metabase/plugins/oss/upload-management.ts b/frontend/src/metabase/plugins/oss/upload-management.ts
new file mode 100644
index 00000000000..ade45a72f0f
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/upload-management.ts
@@ -0,0 +1,34 @@
+import type { ComponentType } from "react";
+
+import { PluginPlaceholder } from "metabase/plugins/components/PluginPlaceholder";
+import { _FileUploadErrorModal } from "metabase/status/components/FileUploadStatusLarge/FileUploadErrorModal";
+
+type GdriveConnectionModalProps = {
+ isModalOpen: boolean;
+ onClose: () => void;
+ reconnect: boolean;
+};
+
+type GdriveAddDataPanelProps = {
+ onAddDataModalClose: () => void;
+};
+
+const getDefaultPluginUploadManagement = () => ({
+ FileUploadErrorModal: _FileUploadErrorModal,
+ UploadManagementTable: PluginPlaceholder,
+ GdriveSyncStatus: PluginPlaceholder,
+ GdriveConnectionModal:
+ PluginPlaceholder as ComponentType<GdriveConnectionModalProps>,
+ GdriveDbMenu: PluginPlaceholder,
+ GdriveAddDataPanel:
+ PluginPlaceholder as ComponentType<GdriveAddDataPanelProps>,
+});
+
+export const PLUGIN_UPLOAD_MANAGEMENT = getDefaultPluginUploadManagement();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(PLUGIN_UPLOAD_MANAGEMENT, getDefaultPluginUploadManagement());
+}
diff --git a/frontend/src/metabase/plugins/oss/whitelabel.ts b/frontend/src/metabase/plugins/oss/whitelabel.ts
new file mode 100644
index 00000000000..e33db8cad6e
--- /dev/null
+++ b/frontend/src/metabase/plugins/oss/whitelabel.ts
@@ -0,0 +1,15 @@
+import { PluginPlaceholder } from "metabase/plugins/components/PluginPlaceholder";
+
+const getDefaultPluginWhitelabel = () => ({
+ WhiteLabelBrandingSettingsPage: PluginPlaceholder,
+ WhiteLabelConcealSettingsPage: PluginPlaceholder,
+});
+
+export const PLUGIN_WHITELABEL = getDefaultPluginWhitelabel();
+
+/**
+ * @internal Do not call directly. Use the main reinitialize function from metabase/plugins instead.
+ */
+export function reinitialize() {
+ Object.assign(PLUGIN_WHITELABEL, getDefaultPluginWhitelabel());
+}