@firecms/core 3.0.0-canary.127 → 3.0.0-canary.128

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  </p>
10
10
 
11
11
  <h1 align="center">FireCMS</h1>
12
- <h3 align="center">Awesome Firebase/Firestore-based headless CMS</h3>
12
+ <h3 align="center">Awesome Firebase/MongoDB-based headless CMS</h3>
13
13
  <p align="center"><a href="https://demo.firecms.co">Live demo</a></p>
14
14
 
15
15
  <br />
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- export declare function DeleteConfirmationDialog({ open, onAccept, onCancel, title, loading, body }: {
2
+ export declare function ConfirmationDialog({ open, onAccept, onCancel, title, loading, body }: {
3
3
  open: boolean;
4
4
  onAccept: () => void;
5
5
  onCancel: () => void;
@@ -18,7 +18,7 @@ export * from "./EntityCollectionTable";
18
18
  export * from "./NotFoundPage";
19
19
  export * from "./VirtualTable";
20
20
  export * from "./ErrorBoundary";
21
- export * from "./DeleteConfirmationDialog";
21
+ export * from "./ConfirmationDialog";
22
22
  export * from "./FireCMSLogo";
23
23
  export * from "../core/DefaultAppBar";
24
24
  export * from "./ArrayContainer";
@@ -5,4 +5,10 @@ export type AccessResponse = {
5
5
  blocked?: boolean;
6
6
  message?: string;
7
7
  };
8
- export declare function useProjectLog(authController: AuthController, dataSourceDelegate: DataSourceDelegate, plugins?: FireCMSPlugin<any, any, any>[]): AccessResponse | null;
8
+ export interface UseProjectLogParams {
9
+ apiKey?: string;
10
+ authController: AuthController;
11
+ dataSourceDelegate: DataSourceDelegate;
12
+ plugins?: FireCMSPlugin<any, any, any>[];
13
+ }
14
+ export declare function useProjectLog({ authController, dataSourceDelegate, plugins, apiKey }: UseProjectLogParams): AccessResponse | null;
package/dist/index.es.js CHANGED
@@ -13033,7 +13033,7 @@ function NotFoundPage() {
13033
13033
  }
13034
13034
  ) });
13035
13035
  }
13036
- function DeleteConfirmationDialog({
13036
+ function ConfirmationDialog({
13037
13037
  open,
13038
13038
  onAccept,
13039
13039
  onCancel,
@@ -13568,7 +13568,7 @@ function ArrayItemOptions({
13568
13568
  return /* @__PURE__ */ jsx(
13569
13569
  "div",
13570
13570
  {
13571
- className: `pl-2 pt-1 pb-4 flex ${direction === "row" ? "flex-row-reverse" : "flex-col"} items-center`,
13571
+ className: `pl-2 pt-1 pb-1 flex ${direction === "row" ? "flex-row-reverse" : "flex-col"} items-center`,
13572
13572
  ref: iconRef,
13573
13573
  ...provided.dragHandleProps,
13574
13574
  children: /* @__PURE__ */ jsxs(
@@ -19056,7 +19056,7 @@ function useBuildDataSource({
19056
19056
  };
19057
19057
  }
19058
19058
  const DEFAULT_SERVER = "https://api-drplyi3b6q-ey.a.run.app";
19059
- async function makeRequest(authController, dataSourceKey, pluginKeys) {
19059
+ async function makeRequest(authController, dataSourceKey, pluginKeys, apiKey) {
19060
19060
  let idToken;
19061
19061
  try {
19062
19062
  idToken = await authController.getAuthToken();
@@ -19073,6 +19073,7 @@ async function makeRequest(authController, dataSourceKey, pluginKeys) {
19073
19073
  Authorization: `Basic ${idToken}`
19074
19074
  },
19075
19075
  body: JSON.stringify({
19076
+ apiKey,
19076
19077
  email: authController.user?.email ?? null,
19077
19078
  datasource: dataSourceKey,
19078
19079
  plugins: pluginKeys
@@ -19082,14 +19083,19 @@ async function makeRequest(authController, dataSourceKey, pluginKeys) {
19082
19083
  return res.json();
19083
19084
  });
19084
19085
  }
19085
- function useProjectLog(authController, dataSourceDelegate, plugins) {
19086
+ function useProjectLog({
19087
+ authController,
19088
+ dataSourceDelegate,
19089
+ plugins,
19090
+ apiKey
19091
+ }) {
19086
19092
  const [accessResponse, setAccessResponse] = useState(null);
19087
19093
  const accessedUserRef = useRef(null);
19088
19094
  const dataSourceKey = dataSourceDelegate.key;
19089
19095
  const pluginKeys = plugins?.map((plugin) => plugin.key);
19090
19096
  useEffect(() => {
19091
19097
  if (authController.user && authController.user.uid !== accessedUserRef.current && !authController.initialLoading) {
19092
- makeRequest(authController, dataSourceKey, pluginKeys).then(setAccessResponse);
19098
+ makeRequest(authController, dataSourceKey, pluginKeys, apiKey).then(setAccessResponse);
19093
19099
  accessedUserRef.current = authController.user.uid;
19094
19100
  }
19095
19101
  }, [authController, dataSourceKey, pluginKeys]);
@@ -19110,7 +19116,8 @@ function FireCMS(props) {
19110
19116
  propertyConfigs,
19111
19117
  entityViews,
19112
19118
  components,
19113
- navigationController
19119
+ navigationController,
19120
+ apiKey
19114
19121
  } = props;
19115
19122
  useLocaleConfig(locale);
19116
19123
  const dataSource = useBuildDataSource({
@@ -19134,7 +19141,15 @@ function FireCMS(props) {
19134
19141
  const analyticsController = useMemo(() => ({
19135
19142
  onAnalyticsEvent
19136
19143
  }), []);
19137
- const accessResponse = useProjectLog(authController, dataSourceDelegate, plugins);
19144
+ const accessResponse = useProjectLog({
19145
+ apiKey,
19146
+ authController,
19147
+ dataSourceDelegate,
19148
+ plugins
19149
+ });
19150
+ if (accessResponse?.message) {
19151
+ console.warn(accessResponse.message);
19152
+ }
19138
19153
  if (navigationController.navigationLoadingError) {
19139
19154
  return /* @__PURE__ */ jsx(CenteredView, { maxWidth: "md", children: /* @__PURE__ */ jsx(
19140
19155
  ErrorView,
@@ -19154,10 +19169,10 @@ function FireCMS(props) {
19154
19169
  ) });
19155
19170
  }
19156
19171
  if (accessResponse?.blocked) {
19157
- return /* @__PURE__ */ jsxs(CenteredView, { maxWidth: "md", fullScreen: true, children: [
19158
- /* @__PURE__ */ jsx(Typography, { variant: "h4", children: "Access blocked" }),
19172
+ return /* @__PURE__ */ jsxs(CenteredView, { maxWidth: "md", fullScreen: true, className: "flex flex-col gap-2", children: [
19173
+ /* @__PURE__ */ jsx(Typography, { variant: "h4", gutterBottom: true, children: "License needed" }),
19159
19174
  /* @__PURE__ */ jsxs(Typography, { children: [
19160
- "This app has been blocked. Please reach out at ",
19175
+ "You need a valid license to use FireCMS PRO. Please reach out at ",
19161
19176
  /* @__PURE__ */ jsx(
19162
19177
  "a",
19163
19178
  {
@@ -19167,10 +19182,7 @@ function FireCMS(props) {
19167
19182
  ),
19168
19183
  " for more information."
19169
19184
  ] }),
19170
- accessResponse?.message && /* @__PURE__ */ jsxs(Typography, { children: [
19171
- "Response from the server: ",
19172
- accessResponse?.message
19173
- ] })
19185
+ accessResponse?.message && /* @__PURE__ */ jsx(Typography, { children: accessResponse?.message })
19174
19186
  ] });
19175
19187
  }
19176
19188
  return /* @__PURE__ */ jsx(AnalyticsContext.Provider, { value: analyticsController, children: /* @__PURE__ */ jsx(CustomizationControllerContext.Provider, { value: customizationController, children: /* @__PURE__ */ jsx(
@@ -19803,6 +19815,7 @@ export {
19803
19815
  BooleanPreview,
19804
19816
  COLLECTION_PATH_SEPARATOR,
19805
19817
  CircularProgressCenter,
19818
+ ConfirmationDialog,
19806
19819
  DEFAULT_FIELD_CONFIGS,
19807
19820
  DRAWER_WIDTH,
19808
19821
  DatePreview,
@@ -19810,7 +19823,6 @@ export {
19810
19823
  DefaultAppBar,
19811
19824
  DefaultDrawer,
19812
19825
  DefaultHomePage,
19813
- DeleteConfirmationDialog,
19814
19826
  Drawer,
19815
19827
  DrawerLogo,
19816
19828
  DrawerNavigationItem,