@rebasepro/plugin-insights 0.0.1-canary.ca2cb6e → 0.0.1-canary.cbdd980

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 (47) hide show
  1. package/dist/core/src/components/BootstrapAdminBanner.d.ts +4 -0
  2. package/dist/core/src/components/LoginView/LoginView.d.ts +22 -0
  3. package/dist/core/src/components/common/useDataTableController.d.ts +3 -3
  4. package/dist/core/src/components/index.d.ts +1 -0
  5. package/dist/core/src/hooks/data/useRelationSelector.d.ts +2 -2
  6. package/dist/core/src/hooks/index.d.ts +1 -0
  7. package/dist/core/src/hooks/useCollapsedGroups.d.ts +16 -1
  8. package/dist/core/src/hooks/useResolvedComponent.d.ts +47 -0
  9. package/dist/index.es.js +314 -214
  10. package/dist/index.es.js.map +1 -1
  11. package/dist/index.umd.js +314 -214
  12. package/dist/index.umd.js.map +1 -1
  13. package/dist/plugin-insights/src/components/CollectionInsightsInline.d.ts +3 -2
  14. package/dist/plugin-insights/src/components/InsightWidget.d.ts +4 -1
  15. package/dist/plugin-insights/src/components/InsightWidgetSkeleton.d.ts +6 -0
  16. package/dist/plugin-insights/src/engine/useInsightsData.d.ts +2 -2
  17. package/dist/plugin-insights/src/types/engine.d.ts +10 -1
  18. package/dist/types/src/controllers/auth.d.ts +8 -2
  19. package/dist/types/src/controllers/client.d.ts +13 -0
  20. package/dist/types/src/controllers/collection_registry.d.ts +2 -1
  21. package/dist/types/src/controllers/data_driver.d.ts +36 -1
  22. package/dist/types/src/controllers/navigation.d.ts +18 -6
  23. package/dist/types/src/controllers/registry.d.ts +9 -1
  24. package/dist/types/src/controllers/side_entity_controller.d.ts +7 -0
  25. package/dist/types/src/rebase_context.d.ts +17 -0
  26. package/dist/types/src/types/backend_hooks.d.ts +187 -0
  27. package/dist/types/src/types/collections.d.ts +31 -11
  28. package/dist/types/src/types/component_ref.d.ts +47 -0
  29. package/dist/types/src/types/cron.d.ts +1 -1
  30. package/dist/types/src/types/entity_views.d.ts +6 -7
  31. package/dist/types/src/types/formex.d.ts +40 -0
  32. package/dist/types/src/types/index.d.ts +3 -0
  33. package/dist/types/src/types/plugins.d.ts +6 -3
  34. package/dist/types/src/types/properties.d.ts +72 -88
  35. package/dist/types/src/types/slots.d.ts +20 -10
  36. package/dist/types/src/types/translations.d.ts +6 -0
  37. package/dist/ui/src/components/FileUpload.d.ts +1 -1
  38. package/dist/ui/src/components/SearchBar.d.ts +5 -1
  39. package/dist/ui/src/styles.d.ts +2 -2
  40. package/package.json +3 -3
  41. package/src/components/CollectionInsightsInline.tsx +10 -2
  42. package/src/components/HomeCardInsightSlot.tsx +5 -1
  43. package/src/components/InsightWidget.tsx +5 -1
  44. package/src/components/InsightWidgetSkeleton.tsx +116 -34
  45. package/src/engine/useInsightsData.ts +5 -5
  46. package/src/types/engine.ts +11 -1
  47. package/src/useInsightsPlugin.tsx +1 -1
@@ -0,0 +1,4 @@
1
+ export interface BootstrapAdminBannerProps {
2
+ className?: string;
3
+ }
4
+ export declare function BootstrapAdminBanner({ className }: BootstrapAdminBannerProps): import("react/jsx-runtime").JSX.Element | null;
@@ -1,4 +1,26 @@
1
1
  import { ReactNode } from "react";
2
+ /** Google Identity Services SDK — injected by the GIS <script> tag. */
3
+ declare global {
4
+ interface Window {
5
+ google?: {
6
+ accounts: {
7
+ oauth2: {
8
+ initCodeClient(config: {
9
+ client_id: string;
10
+ scope: string;
11
+ ux_mode: "popup" | "redirect";
12
+ callback: (response: {
13
+ code?: string;
14
+ error?: string;
15
+ }) => void;
16
+ }): {
17
+ requestCode(): void;
18
+ };
19
+ };
20
+ };
21
+ };
22
+ }
23
+ }
2
24
  import { AuthControllerExtended } from "@rebasepro/types";
3
25
  /**
4
26
  * Props for the generic LoginView.
@@ -20,7 +20,7 @@ export type DataTableControllerProps<M extends Record<string, any> = any> = {
20
20
  /**
21
21
  * Force filter to be applied to the table.
22
22
  */
23
- forceFilter?: FilterValues<string>;
23
+ fixedFilter?: FilterValues<string>;
24
24
  scrollRestoration?: ScrollRestorationController;
25
25
  /**
26
26
  * When set to true the filters and sort will be updated in the URL
@@ -39,7 +39,7 @@ export type DataTableControllerProps<M extends Record<string, any> = any> = {
39
39
  * @param scrollRestoration
40
40
  * @param entitiesDisplayedFirst
41
41
  * @param lastDeleteTimestamp
42
- * @param forceFilterFromProps
42
+ * @param fixedFilterFromProps
43
43
  * @param updateUrl
44
44
  */
45
- export declare function useDataTableController<M extends Record<string, any> = any, USER extends User = User>({ path, collection, scrollRestoration, entitiesDisplayedFirst, lastDeleteTimestamp: _lastDeleteTimestamp, forceFilter: forceFilterFromProps, updateUrl }: DataTableControllerProps<M>): EntityTableController<M>;
45
+ export declare function useDataTableController<M extends Record<string, any> = any, USER extends User = User>({ path, collection, scrollRestoration, entitiesDisplayedFirst, lastDeleteTimestamp: _lastDeleteTimestamp, fixedFilter: fixedFilterFromProps, updateUrl }: DataTableControllerProps<M>): EntityTableController<M>;
@@ -14,3 +14,4 @@ export * from "./UserSelectPopover";
14
14
  export * from "./UserDisplay";
15
15
  export * from "./LoginView";
16
16
  export * from "./RebaseAuth";
17
+ export * from "./BootstrapAdminBanner";
@@ -19,7 +19,7 @@ export interface UseRelationSelectorProps<M extends Record<string, any> = any> {
19
19
  /**
20
20
  * Force filter to be applied to the relation search
21
21
  */
22
- forceFilter?: FilterValues<string>;
22
+ fixedFilter?: FilterValues<string>;
23
23
  /**
24
24
  * Page size for pagination
25
25
  */
@@ -49,4 +49,4 @@ export interface RelationSelectorController {
49
49
  /**
50
50
  * Hook to manage relation selection with data fetching from Rebase data source
51
51
  */
52
- export declare function useRelationSelector<M extends Record<string, any> = any>({ path, collection, forceFilter, pageSize, getLabelFromEntity, getDescriptionFromEntity, descriptionProperty }: UseRelationSelectorProps<M>): RelationSelectorController;
52
+ export declare function useRelationSelector<M extends Record<string, any> = any>({ path, collection, fixedFilter, pageSize, getLabelFromEntity, getDescriptionFromEntity, descriptionProperty }: UseRelationSelectorProps<M>): RelationSelectorController;
@@ -35,3 +35,4 @@ export * from "./useTranslation";
35
35
  export * from "./useRebaseClient";
36
36
  export * from "./useAnalyticsController";
37
37
  export * from "./useUserConfigurationPersistence";
38
+ export * from "./useResolvedComponent";
@@ -3,10 +3,25 @@
3
3
  * with localStorage persistence. Automatically cleans up stale group entries
4
4
  * when groups are removed from the navigation.
5
5
  *
6
+ * Groups that have never been toggled by the user fall back to
7
+ * `defaults[groupName]` (driven by `collapsedByDefault` in config).
8
+ *
6
9
  * @param groupNames - Array of group names to track
7
10
  * @param namespace - Namespace for localStorage key (e.g., "home", "drawer") to allow independent state
11
+ * @param defaults - Optional map of group name → collapsed boolean from config
8
12
  */
9
- export declare function useCollapsedGroups(groupNames: string[], namespace?: string): {
13
+ export declare function useCollapsedGroups(groupNames: string[], namespace?: string, defaults?: Record<string, boolean>): {
10
14
  isGroupCollapsed: (name: string) => boolean;
11
15
  toggleGroupCollapsed: (name: string) => void;
12
16
  };
17
+ /**
18
+ * Build a defaults map from navigationGroupMappings for a given namespace.
19
+ * Returns a Record<groupName, collapsed> that can be passed to useCollapsedGroups.
20
+ */
21
+ export declare function buildCollapsedDefaults(mappings: Array<{
22
+ name: string;
23
+ collapsedByDefault?: boolean | {
24
+ drawer?: boolean;
25
+ home?: boolean;
26
+ };
27
+ }> | undefined, namespace: "drawer" | "home"): Record<string, boolean>;
@@ -0,0 +1,47 @@
1
+ import React from "react";
2
+ import type { ComponentRef } from "@rebasepro/types";
3
+ /**
4
+ * Resolves a `ComponentRef` into a renderable `React.ComponentType`.
5
+ *
6
+ * This hook handles all three forms of `ComponentRef`:
7
+ *
8
+ * 1. **`LazyComponentRef`** (produced by the Vite plugin from string paths):
9
+ * Wraps the lazy loader with `React.lazy()` for automatic code-splitting.
10
+ *
11
+ * 2. **`() => Promise<{ default: ComponentType }>`** (manual lazy import):
12
+ * Also wraps with `React.lazy()`. Distinguished from regular components
13
+ * by checking that the function has no parameters and is not a known
14
+ * React internal (no `$$typeof`).
15
+ *
16
+ * 3. **Direct `React.ComponentType`**:
17
+ * Returned as-is.
18
+ *
19
+ * If the ref is `undefined` or a raw string (which should never happen at
20
+ * runtime in the browser since the Vite plugin transforms strings), returns `undefined`.
21
+ *
22
+ * The returned component is stable across re-renders as long as the `ref`
23
+ * is referentially stable.
24
+ *
25
+ * **Usage:** Wrap the rendered component in `<Suspense>` to handle the
26
+ * loading state of lazy components.
27
+ *
28
+ * @example
29
+ * ```tsx
30
+ * const ResolvedField = useResolvedComponent(property.ui?.Field);
31
+ * if (!ResolvedField) return null;
32
+ * return (
33
+ * <Suspense fallback={<CircularProgress />}>
34
+ * <ResolvedField {...fieldProps} />
35
+ * </Suspense>
36
+ * );
37
+ * ```
38
+ */
39
+ export declare function useResolvedComponent<P = unknown>(ref: ComponentRef<P> | undefined): React.ComponentType<P> | undefined;
40
+ /**
41
+ * Pure function version of the resolver, for use outside React components.
42
+ * Same resolution logic as `useResolvedComponent`.
43
+ *
44
+ * Results are cached per reference identity — calling this multiple times
45
+ * with the same `ref` object returns the same `React.ComponentType`.
46
+ */
47
+ export declare function resolveComponentRef<P = unknown>(ref: ComponentRef<P> | undefined): React.ComponentType<P> | undefined;