@firecms/core 3.0.0-beta.2-pre.4 → 3.0.0-beta.2

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.
Files changed (35) hide show
  1. package/dist/components/PropertyIdCopyTooltipContent.d.ts +3 -0
  2. package/dist/form/PropertyFieldBinding.d.ts +1 -1
  3. package/dist/hooks/useProjectLog.d.ts +4 -0
  4. package/dist/index.es.js +2308 -2240
  5. package/dist/index.es.js.map +1 -1
  6. package/dist/index.umd.js +5 -5
  7. package/dist/index.umd.js.map +1 -1
  8. package/dist/util/index.d.ts +1 -1
  9. package/dist/util/useDebouncedCallback.d.ts +1 -0
  10. package/package.json +7 -7
  11. package/src/components/ArrayContainer.tsx +3 -9
  12. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +17 -14
  13. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +10 -1
  14. package/src/components/EntityCollectionView/EntityCollectionView.tsx +6 -5
  15. package/src/components/PropertyIdCopyTooltipContent.tsx +28 -0
  16. package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +0 -1
  17. package/src/components/SelectableTable/SelectableTable.tsx +2 -2
  18. package/src/components/VirtualTable/fields/VirtualTableInput.tsx +2 -2
  19. package/src/components/VirtualTable/fields/VirtualTableNumberInput.tsx +2 -2
  20. package/src/core/Drawer.tsx +17 -15
  21. package/src/core/FireCMS.tsx +4 -1
  22. package/src/core/NavigationRoutes.tsx +10 -8
  23. package/src/core/Scaffold.tsx +5 -5
  24. package/src/core/field_configs.tsx +11 -11
  25. package/src/form/EntityForm.tsx +16 -4
  26. package/src/form/PropertyFieldBinding.tsx +3 -8
  27. package/src/form/field_bindings/MapFieldBinding.tsx +8 -6
  28. package/src/form/field_bindings/RepeatFieldBinding.tsx +4 -2
  29. package/src/hooks/useProjectLog.tsx +31 -0
  30. package/src/internal/EntityView.tsx +2 -2
  31. package/src/util/index.ts +1 -1
  32. package/src/util/{useDebounce.ts → useDebouncedCallback.ts} +1 -1
  33. package/dist/hooks/useVerifyLicense.d.ts +0 -0
  34. package/dist/util/useDebounce.d.ts +0 -1
  35. package/src/hooks/useVerifyLicense.tsx +0 -1
@@ -0,0 +1,31 @@
1
+ import { useEffect, useRef } from "react";
2
+ import { AuthController } from "../types";
3
+
4
+ export const DEFAULT_SERVER_DEV = "https://api-kdoe6pj3qq-ey.a.run.app";
5
+ export const DEFAULT_SERVER = "https://api-drplyi3b6q-ey.a.run.app";
6
+
7
+ async function makeRequest(authController: AuthController) {
8
+ const firebaseToken = await authController.getAuthToken();
9
+ return fetch(DEFAULT_SERVER + "/access_log",
10
+ {
11
+ // mode: "no-cors",
12
+ method: "POST",
13
+ headers: {
14
+ "Content-Type": "application/json",
15
+ Authorization: `Basic ${firebaseToken}`,
16
+ },
17
+ body: JSON.stringify({})
18
+ })
19
+ .then(async (res) => {
20
+ });
21
+ }
22
+
23
+ export function useProjectLog(authController: AuthController) {
24
+ const accessedUserRef = useRef<string | null>(null);
25
+ useEffect(() => {
26
+ if (authController.user && authController.user.uid !== accessedUserRef.current && !authController.initialLoading) {
27
+ makeRequest(authController);
28
+ accessedUserRef.current = authController.user.uid;
29
+ }
30
+ }, [authController]);
31
+ }
@@ -16,7 +16,7 @@ import {
16
16
  removeInitialAndTrailingSlashes,
17
17
  resolveDefaultSelectedView,
18
18
  resolveEntityView,
19
- useDebounce
19
+ useDebouncedCallback
20
20
  } from "../util";
21
21
 
22
22
  import {
@@ -79,7 +79,7 @@ export function EntityView<M extends Record<string, any>, UserType extends User>
79
79
  * We use this only when autoSave is enabled.
80
80
  */
81
81
  const [valuesToBeSaved, setValuesToBeSaved] = useState<EntityValues<M> | undefined>(undefined);
82
- useDebounce(valuesToBeSaved, () => {
82
+ useDebouncedCallback(valuesToBeSaved, () => {
83
83
  if (valuesToBeSaved)
84
84
  saveEntity({
85
85
  entityId: usedEntity?.id,
package/src/util/index.ts CHANGED
@@ -7,7 +7,7 @@ export * from "./objects";
7
7
  export * from "./paths";
8
8
  export * from "./regexp";
9
9
  export * from "./navigation_utils";
10
- export * from "./useDebounce";
10
+ export * from "./useDebouncedCallback";
11
11
  export * from "./property_utils";
12
12
  export * from "./resolutions";
13
13
  export * from "./permissions";
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
 
3
- export function useDebounce<T>(value: T, callback: () => void, immediate: boolean, timeoutMs = 300) {
3
+ export function useDebouncedCallback<T>(value: T, callback: () => void, immediate: boolean, timeoutMs = 300) {
4
4
 
5
5
  const pendingUpdate = React.useRef(false);
6
6
  const performUpdate = () => {
File without changes
@@ -1 +0,0 @@
1
- export declare function useDebounce<T>(value: T, callback: () => void, immediate: boolean, timeoutMs?: number): void;
@@ -1 +0,0 @@
1
- // export