@rebasepro/plugin-insights 0.0.1-canary.eae7889 → 0.1.0
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/dist/core/src/components/BootstrapAdminBanner.d.ts +4 -0
- package/dist/core/src/components/LoginView/LoginView.d.ts +22 -0
- package/dist/core/src/components/common/useDataTableController.d.ts +3 -3
- package/dist/core/src/components/index.d.ts +1 -0
- package/dist/core/src/hooks/data/useRelationSelector.d.ts +2 -2
- package/dist/core/src/hooks/index.d.ts +1 -0
- package/dist/core/src/hooks/useCollapsedGroups.d.ts +16 -1
- package/dist/core/src/hooks/useResolvedComponent.d.ts +47 -0
- package/dist/index.es.js +314 -214
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +314 -214
- package/dist/index.umd.js.map +1 -1
- package/dist/plugin-insights/src/components/CollectionInsightsInline.d.ts +3 -2
- package/dist/plugin-insights/src/components/InsightWidget.d.ts +4 -1
- package/dist/plugin-insights/src/components/InsightWidgetSkeleton.d.ts +6 -0
- package/dist/plugin-insights/src/engine/useInsightsData.d.ts +2 -2
- package/dist/plugin-insights/src/types/engine.d.ts +10 -1
- package/dist/types/src/controllers/auth.d.ts +8 -2
- package/dist/types/src/controllers/client.d.ts +13 -0
- package/dist/types/src/controllers/collection_registry.d.ts +2 -1
- package/dist/types/src/controllers/data_driver.d.ts +36 -1
- package/dist/types/src/controllers/navigation.d.ts +18 -6
- package/dist/types/src/controllers/registry.d.ts +9 -1
- package/dist/types/src/controllers/side_entity_controller.d.ts +7 -0
- package/dist/types/src/rebase_context.d.ts +17 -0
- package/dist/types/src/types/backend_hooks.d.ts +187 -0
- package/dist/types/src/types/collections.d.ts +31 -11
- package/dist/types/src/types/component_ref.d.ts +47 -0
- package/dist/types/src/types/cron.d.ts +1 -1
- package/dist/types/src/types/entity_views.d.ts +6 -7
- package/dist/types/src/types/formex.d.ts +40 -0
- package/dist/types/src/types/index.d.ts +3 -0
- package/dist/types/src/types/plugins.d.ts +6 -3
- package/dist/types/src/types/properties.d.ts +72 -88
- package/dist/types/src/types/slots.d.ts +20 -10
- package/dist/types/src/types/translations.d.ts +6 -0
- package/dist/ui/src/components/FileUpload.d.ts +1 -1
- package/dist/ui/src/components/SearchBar.d.ts +5 -1
- package/dist/ui/src/styles.d.ts +2 -2
- package/package.json +3 -3
- package/src/components/CollectionInsightsInline.tsx +10 -2
- package/src/components/HomeCardInsightSlot.tsx +5 -1
- package/src/components/InsightWidget.tsx +5 -1
- package/src/components/InsightWidgetSkeleton.tsx +116 -34
- package/src/engine/useInsightsData.ts +5 -5
- package/src/types/engine.ts +11 -1
- package/src/useInsightsPlugin.tsx +1 -1
package/dist/index.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../src/engine/InsightsCache.ts","../src/engine/InsightsProvider.tsx","../src/engine/useInsightsData.ts","../src/components/InsightsScorecardView.tsx","../src/components/InsightWidgetSkeleton.tsx","../src/components/InsightWidget.tsx","../src/components/HomeCardInsightSlot.tsx","../src/components/HomeInsightsSlot.tsx","../src/components/CollectionInsightsInline.tsx","../src/useInsightsPlugin.tsx"],"sourcesContent":["import type { InsightDataResult } from \"../types\";\n\ninterface CacheEntry {\n data: InsightDataResult;\n timestamp: number;\n}\n\n/**\n * In-memory cache for insight query results.\n * Supports TTL-based expiry and inflight request deduplication\n * to prevent redundant network requests when multiple widgets\n * share the same query.\n */\nexport class InsightsCache {\n private cache = new Map<string, CacheEntry>();\n private inflight = new Map<string, Promise<InsightDataResult>>();\n\n constructor(private ttl: number = 60_000) {}\n\n get(key: string): InsightDataResult | null {\n const entry = this.cache.get(key);\n if (!entry) return null;\n if (Date.now() - entry.timestamp > this.ttl) {\n this.cache.delete(key);\n return null;\n }\n return entry.data;\n }\n\n set(key: string, data: InsightDataResult): void {\n this.cache.set(key, { data, timestamp: Date.now() });\n this.inflight.delete(key);\n }\n\n getInflight(key: string): Promise<InsightDataResult> | null {\n return this.inflight.get(key) ?? null;\n }\n\n setInflight(key: string, promise: Promise<InsightDataResult>): void {\n this.inflight.set(key, promise);\n }\n\n invalidate(key?: string): void {\n if (key) {\n this.cache.delete(key);\n this.inflight.delete(key);\n } else {\n this.cache.clear();\n this.inflight.clear();\n }\n }\n}\n","import React, { createContext, useContext, useMemo, type PropsWithChildren } from \"react\";\nimport { InsightsCache } from \"./InsightsCache\";\n\ninterface InsightsContextValue {\n cache: InsightsCache;\n}\n\nconst InsightsContext = createContext<InsightsContextValue | null>(null);\n\n/**\n * Root-level provider for the insights data engine.\n * Injected automatically by the plugin via `providers: [{ scope: \"root\" }]`.\n *\n * Manages a single `InsightsCache` instance shared by all insight widgets\n * for TTL-based caching and inflight request deduplication.\n */\nexport function InsightsProvider({\n cacheTTL,\n children\n}: PropsWithChildren<{ cacheTTL?: number }>) {\n const cache = useMemo(() => new InsightsCache(cacheTTL), [cacheTTL]);\n const value = useMemo(() => ({ cache }), [cache]);\n\n return (\n <InsightsContext.Provider value={value}>\n {children}\n </InsightsContext.Provider>\n );\n}\n\n/**\n * Access the insights cache (for advanced usage).\n * Returns null when called outside of an `InsightsProvider`\n * (e.g. during auth-loading phase before plugin providers mount).\n */\nexport function useInsightsEngine(): InsightsContextValue | null {\n return useContext(InsightsContext);\n}\n","import { useEffect, useState } from \"react\";\nimport type { InsightDefinition, InsightDataResult } from \"../types\";\nimport { useInsightsEngine } from \"./InsightsProvider\";\nimport { useAuthController } from \"@rebasepro/core\";\n\n/**\n * Hook that fetches and caches data for a single insight definition.\n *\n * Calls the definition's own `data()` callback and manages:\n * - TTL-based caching via InsightsCache\n * - Inflight request deduplication (multiple mounts of the same widget)\n * - Loading and error state management\n *\n * @param definition - The insight to fetch data for\n * @param collectionSlug - Optional collection context for cache key scoping\n */\nexport function useInsightsData(\n definition: InsightDefinition,\n collectionSlug?: string\n): {\n data: InsightDataResult | null;\n loading: boolean;\n error: Error | null;\n} {\n const engine = useInsightsEngine();\n const cache = engine?.cache ?? null;\n const { initialLoading, authLoading, user, loginSkipped } = useAuthController();\n const authReady = !initialLoading && !authLoading && (Boolean(user) || loginSkipped);\n const [data, setData] = useState<InsightDataResult | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const cacheKey = `${definition.id}:${collectionSlug ?? \"global\"}`;\n\n useEffect(() => {\n // Keep showing skeleton until both auth and engine are ready\n if (!authReady || !cache) {\n return;\n }\n\n let cancelled = false;\n\n // 1. Check cache\n const cached = cache.get(cacheKey);\n if (cached) {\n setData(cached);\n setLoading(false);\n return;\n }\n\n // 2. Check inflight — deduplicate concurrent requests for the same widget\n const inflight = cache.getInflight(cacheKey);\n if (inflight) {\n setLoading(true);\n inflight\n .then((result) => {\n if (!cancelled) {\n setData(result);\n }\n })\n .catch((err) => {\n if (!cancelled) setError(err instanceof Error ? err : new Error(String(err)));\n })\n .finally(() => {\n if (!cancelled) setLoading(false);\n });\n return;\n }\n\n // 3. Fresh fetch — invoke the definition's own data callback\n setLoading(true);\n setError(null);\n\n const promise = definition.data();\n\n cache.setInflight(cacheKey, promise);\n\n promise\n .then((result) => {\n cache.set(cacheKey, result);\n if (!cancelled) {\n setData(result);\n }\n })\n .catch((err) => {\n if (!cancelled) {\n setError(err instanceof Error ? err : new Error(String(err)));\n }\n })\n .finally(() => {\n if (!cancelled) setLoading(false);\n });\n\n return () => {\n cancelled = true;\n };\n }, [definition.id, definition.data, collectionSlug, cacheKey, cache, authReady]);\n\n return { data, loading, error };\n}\n","import React, { useRef, useState } from \"react\";\nimport { getIcon } from \"@rebasepro/core\";\nimport { cls, defaultBorderMixin } from \"@rebasepro/ui\";\nimport type { DataRow, ScorecardConfig, ScorecardFormat } from \"../types\";\n\nfunction formatNumber(value: number, format?: ScorecardFormat): string {\n if (value === null || value === undefined) return \"N/A\";\n\n const options: Intl.NumberFormatOptions = {\n style: format?.style ?? \"decimal\",\n notation: format?.notation ?? \"standard\",\n maximumFractionDigits: format?.decimals ?? 1,\n minimumFractionDigits: format?.decimals ?? 1,\n };\n\n if (format?.style === \"currency\") {\n options.currency = format.currency ?? \"USD\";\n }\n\n let formatted = new Intl.NumberFormat(\"en-US\", options).format(value);\n\n if (format?.showSign && value > 0) {\n formatted = \"+\" + formatted;\n }\n\n return formatted;\n}\n\n/**\n * Scorecard widget for the Rebase design system.\n *\n * Renders a single KPI metric with optional comparison value and icon.\n * Uses Tailwind `dark:` classes — no JS dark mode detection.\n * Icons are resolved via `getIcon` from `@rebasepro/core`.\n */\nexport function InsightsScorecardView({\n config,\n data,\n title,\n compact = false,\n embedded = false,\n}: {\n config: ScorecardConfig;\n data: DataRow;\n title: string;\n compact?: boolean;\n /** When true, skip own border/bg since the parent card provides them. */\n embedded?: boolean;\n}) {\n const containerRef = useRef<HTMLDivElement>(null);\n const [containerWidth, setContainerWidth] = useState<number | null>(null);\n\n React.useLayoutEffect(() => {\n if (!containerRef.current) return;\n // Read initial width synchronously before paint\n setContainerWidth(containerRef.current.offsetWidth);\n const observer = new ResizeObserver((entries) => {\n for (const entry of entries) {\n setContainerWidth(entry.contentRect.width);\n }\n });\n observer.observe(containerRef.current);\n return () => observer.disconnect();\n }, []);\n\n const mainValue = data[config.value.field];\n const formattedValue = typeof mainValue === \"number\"\n ? formatNumber(mainValue, config.value.format)\n : String(mainValue ?? \"N/A\");\n\n // Comparison rendering\n let comparisonElement: React.ReactNode = null;\n if (config.comparison) {\n const comparisonValue = data[config.comparison.field];\n if (typeof comparisonValue === \"number\") {\n const formattedComparison = formatNumber(comparisonValue, config.comparison.format);\n const isPositive = comparisonValue > 0;\n const isNegative = comparisonValue < 0;\n\n let colorClass = \"text-surface-500 dark:text-surface-400\";\n if (config.comparison.intent === \"increase_is_good\") {\n if (isPositive) colorClass = \"text-emerald-500\";\n if (isNegative) colorClass = \"text-red-500\";\n } else if (config.comparison.intent === \"decrease_is_good\") {\n if (isPositive) colorClass = \"text-red-500\";\n if (isNegative) colorClass = \"text-emerald-500\";\n }\n\n comparisonElement = (\n <span className={`font-medium ${compact ? \"text-[10px]\" : \"text-xs\"} ${colorClass}`}>\n {formattedComparison}\n </span>\n );\n }\n }\n\n const isSmall = compact || (containerWidth !== null && containerWidth < 200);\n\n // Resolve icon via getIcon (Lucide-based resolution)\n const iconElement = config.icon\n ? getIcon(config.icon, \"text-surface-400 dark:text-surface-500\", undefined, isSmall ? 14 : 18)\n : null;\n\n // ── Compact card-inline layout ──────────────────────────────────────\n if (compact) {\n return (\n <div className={cls(\"flex flex-col gap-0.5 px-2.5 py-2 rounded-md bg-transparent border min-w-0\", defaultBorderMixin)}>\n <span className=\"text-[10px] uppercase tracking-wider text-surface-400 dark:text-surface-500 truncate\">\n {title}\n </span>\n <div className=\"flex items-baseline gap-1.5\">\n <span className=\"text-sm font-semibold tabular-nums text-surface-800 dark:text-surface-100\">\n {formattedValue}\n </span>\n {comparisonElement}\n </div>\n </div>\n );\n }\n\n // ── Standard scorecard layout ───────────────────────────────────────\n const baseClass = embedded\n ? `flex flex-col min-w-0 h-full ${isSmall ? \"px-3.5 py-3\" : \"px-5 py-4\"}`\n : cls(\"rounded-lg flex flex-col min-w-0 bg-transparent border\", defaultBorderMixin, isSmall ? \"px-3.5 py-3\" : \"px-5 py-4\");\n\n return (\n <div ref={containerRef} className={baseClass} style={embedded ? undefined : { minHeight: isSmall ? 68 : 92 }}>\n {/* Title row */}\n <div className={`flex items-center justify-between ${isSmall ? \"mb-1\" : \"mb-2\"}`}>\n <div className=\"flex flex-col min-w-0\">\n <span className={`font-medium leading-snug truncate text-surface-500 dark:text-surface-400 ${isSmall ? \"text-[11px]\" : \"text-xs\"}`}>\n {title}\n </span>\n {config.dateRange && !isSmall && (\n <span className=\"text-[10px] text-surface-400 dark:text-surface-500 truncate mt-0.5\">\n {config.dateRange}\n </span>\n )}\n </div>\n {iconElement && (\n <span className=\"ml-2 shrink-0\">{iconElement}</span>\n )}\n </div>\n\n {/* Main value */}\n <div className={`font-semibold leading-tight tracking-tight break-all text-surface-800 dark:text-surface-100 ${isSmall ? \"text-lg\" : (containerWidth !== null && containerWidth < 300) ? \"text-xl\" : \"text-2xl\"}`}>\n {formattedValue}\n </div>\n\n {/* Comparison */}\n {comparisonElement && (\n <div className={isSmall ? \"mt-0.5\" : \"mt-1\"}>\n {comparisonElement}\n </div>\n )}\n </div>\n );\n}\n\nInsightsScorecardView.displayName = \"InsightsScorecardView\";\n","import React from \"react\";\nimport { cls, defaultBorderMixin } from \"@rebasepro/ui\";\nimport type { ScorecardConfig } from \"../types\";\n\n/**\n * Skeleton loader for scorecard insight widgets — displays animated\n * shimmer placeholders that exactly match the final rendered layout\n * of InsightsScorecardView for a given config, preventing layout shift.\n *\n * The skeleton receives the scorecard config so it can conditionally\n * render placeholder lines for comparison, dateRange, and icon —\n * only when the loaded view will also render them.\n */\nexport function InsightWidgetSkeleton({\n config,\n compact = false,\n embedded = false,\n}: {\n /** Scorecard config — used to match optional elements (comparison, dateRange, icon). */\n config: ScorecardConfig;\n compact?: boolean;\n /** When true, skip own border since the parent card provides it. */\n embedded?: boolean;\n}) {\n const hasComparison = Boolean(config.comparison);\n const hasIcon = Boolean(config.icon);\n const hasDateRange = Boolean(config.dateRange);\n\n // ── Compact scorecard skeleton ──────────────────────────────────────\n // Matches InsightsScorecardView compact layout:\n // container: flex flex-col gap-0.5 px-2.5 py-2 rounded-md border\n // title: text-[10px] uppercase → line-height ~14px\n // value row: text-sm font-semibold → line-height ~20px\n // + optional comparison text-[10px] inside value row\n if (compact) {\n return (\n <div\n className={cls(\n \"animate-pulse\",\n embedded\n ? \"h-full px-2.5 py-2\"\n : \"flex flex-col gap-0.5 rounded-md bg-transparent border min-w-0 px-2.5 py-2\",\n !embedded && defaultBorderMixin\n )}\n >\n {/* Title line */}\n <div className=\"bg-surface-200 dark:bg-surface-700 rounded-sm\"\n style={{ height: 14, width: 48 }}\n />\n {/* Value + optional comparison row */}\n <div className=\"flex items-baseline gap-1.5\">\n <div className=\"bg-surface-200 dark:bg-surface-700 rounded-sm\"\n style={{ height: 20, width: 40 }}\n />\n {hasComparison && (\n <div className=\"bg-surface-200/60 dark:bg-surface-700/60 rounded-sm\"\n style={{ height: 14, width: 28 }}\n />\n )}\n </div>\n </div>\n );\n }\n\n // ── Standard scorecard skeleton ─────────────────────────────────────\n // Matches InsightsScorecardView standard layout (isSmall = false):\n // container: rounded-lg px-5 py-4 border, minHeight 92\n // title row: flex justify-between mb-2\n // title: text-xs → line-height ~16px\n // dateRange: text-[10px] mt-0.5 → ~14px (optional)\n // icon: 18×18 ml-2 (optional)\n // value: text-2xl → line-height ~32px\n // comparison: text-xs mt-1 → ~16px (optional)\n return (\n <div\n className={cls(\n \"animate-pulse\",\n embedded\n ? \"h-full px-5 py-4\"\n : \"rounded-lg bg-transparent border px-5 py-4\",\n !embedded && defaultBorderMixin\n )}\n style={embedded ? undefined : { minHeight: 92 }}\n >\n {/* Title row */}\n <div className=\"flex items-center justify-between mb-2\">\n <div className=\"flex flex-col min-w-0\">\n {/* Title */}\n <div className=\"bg-surface-200 dark:bg-surface-700 rounded\"\n style={{ height: 16, width: \"60%\" }}\n />\n {/* DateRange (only if config has it) */}\n {hasDateRange && (\n <div className=\"bg-surface-200/60 dark:bg-surface-700/60 rounded mt-0.5\"\n style={{ height: 14, width: \"40%\" }}\n />\n )}\n </div>\n {/* Icon placeholder (only if config has it) */}\n {hasIcon && (\n <div className=\"bg-surface-200 dark:bg-surface-700 rounded ml-2 shrink-0\"\n style={{ height: 18, width: 18 }}\n />\n )}\n </div>\n\n {/* Main value */}\n <div className=\"bg-surface-200 dark:bg-surface-700 rounded\"\n style={{ height: 32, width: \"40%\" }}\n />\n\n {/* Comparison (only if config has it) */}\n {hasComparison && (\n <div className=\"bg-surface-200/60 dark:bg-surface-700/60 rounded mt-1\"\n style={{ height: 16, width: \"25%\" }}\n />\n )}\n </div>\n );\n}\n\nInsightWidgetSkeleton.displayName = \"InsightWidgetSkeleton\";\n","import React from \"react\";\nimport type { InsightDefinition, DataRow } from \"../types\";\nimport { useInsightsData } from \"../engine/useInsightsData\";\nimport { InsightsScorecardView } from \"./InsightsScorecardView\";\nimport { InsightWidgetSkeleton } from \"./InsightWidgetSkeleton\";\n\n/**\n * Single insight widget orchestrator.\n *\n * Fetches data via the engine, renders the scorecard visualization,\n * and manages loading/error states.\n *\n * All theme-awareness is handled via Tailwind `dark:` classes.\n */\nexport function InsightWidget({\n definition,\n collectionSlug,\n compact = false,\n embedded = false,\n}: {\n definition: InsightDefinition;\n collectionSlug?: string;\n compact?: boolean;\n /** When true, inner views skip their own borders since the parent card provides them. */\n embedded?: boolean;\n}) {\n const { data, loading, error } = useInsightsData(definition, collectionSlug);\n\n if (loading) {\n return <InsightWidgetSkeleton config={definition.scorecard} compact={compact} embedded={embedded} />;\n }\n\n if (error) {\n return (\n <div\n className={`text-red-500/70 dark:text-red-400/70 text-[0.8125rem] ${embedded ? \"px-5 py-4 h-full\" : `rounded-lg bg-red-500/5 dark:bg-red-400/5 border border-red-500/10 dark:border-red-400/10 ${compact ? \"px-3.5 py-3\" : \"px-5 py-4\"}`}`}\n >\n <div className=\"font-semibold mb-1\">{definition.title}</div>\n <div>{error.message}</div>\n </div>\n );\n }\n\n if (!data || data.rows.length === 0) {\n return (\n <div\n className={`text-surface-400 dark:text-surface-500 text-[0.8125rem] ${embedded ? \"px-5 py-4 h-full\" : `rounded-lg bg-surface-100 dark:bg-surface-800 border border-surface-200 dark:border-surface-700 ${compact ? \"px-3.5 py-3\" : \"px-5 py-4\"}`}`}\n >\n {definition.title} — No data\n </div>\n );\n }\n\n return (\n <InsightsScorecardView\n config={definition.scorecard}\n data={data.rows[0] as DataRow}\n title={definition.title}\n compact={compact}\n embedded={embedded}\n />\n );\n}\n\nInsightWidget.displayName = \"InsightWidget\";\n","import React from \"react\";\nimport type { InsightDefinition } from \"../types\";\nimport { InsightWidget } from \"./InsightWidget\";\n\n/**\n * Renders compact insight widgets inline within a home page collection card.\n * Injected via the `home.card.insight` slot.\n *\n * Uses a horizontal flex layout so multiple cards sit side by side.\n */\nexport function HomeCardInsightSlot({\n slug,\n insights,\n}: {\n slug: string;\n collection: unknown;\n context: unknown;\n insights: InsightDefinition[];\n}) {\n if (!insights || insights.length === 0) return null;\n\n return (\n <div className=\"flex flex-wrap items-center gap-1.5 mt-2\" style={{ minHeight: 46 }}>\n {insights.map((def) => (\n <InsightWidget\n key={def.id}\n definition={def}\n collectionSlug={slug}\n compact={true}\n />\n ))}\n </div>\n );\n}\n\nHomeCardInsightSlot.displayName = \"HomeCardInsightSlot\";\n","import React from \"react\";\nimport type { InsightDefinition } from \"../types\";\nimport { InsightWidget } from \"./InsightWidget\";\n\n/**\n * Scorecard insights panel rendered at the top of the home page.\n * Injected via the `home.children.start` slot.\n *\n * Renders scorecards in a responsive grid (up to 4 columns).\n */\nexport function HomeInsightsSlot({\n insights,\n}: {\n insights: InsightDefinition[];\n}) {\n if (!insights || insights.length === 0) return null;\n\n return (\n <div\n className=\"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 pb-6\"\n style={{ minHeight: 92 }}\n >\n {insights.map((def) => (\n <InsightWidget key={def.id} definition={def} />\n ))}\n </div>\n );\n}\n\nHomeInsightsSlot.displayName = \"HomeInsightsSlot\";\n","import React from \"react\";\nimport type { InsightDefinition } from \"../types\";\nimport { InsightWidget } from \"./InsightWidget\";\n\n/**\n * Renders scorecard insight widgets inline within a collection's list view,\n * positioned below the title and above the main data list.\n *\n * Injected via the `collection.insights` slot.\n */\nexport function CollectionInsightsInline({\n insights,\n}: {\n path: string;\n collection: unknown;\n parentCollectionIds: string[];\n insights: InsightDefinition[];\n}) {\n if (!insights || insights.length === 0) return null;\n\n return (\n <div className=\"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 pb-4\">\n {insights.map((def) => (\n <InsightWidget key={def.id} definition={def} />\n ))}\n </div>\n );\n}\n\nCollectionInsightsInline.displayName = \"CollectionInsightsInline\";\n","import React from \"react\";\nimport type { RebasePlugin, SlotContribution } from \"@rebasepro/types\";\nimport type { InsightsPluginConfig } from \"./types\";\nimport { InsightsProvider } from \"./engine/InsightsProvider\";\nimport { HomeCardInsightSlot } from \"./components/HomeCardInsightSlot\";\nimport { HomeInsightsSlot } from \"./components/HomeInsightsSlot\";\nimport { CollectionInsightsInline } from \"./components/CollectionInsightsInline\";\n\n/**\n * Creates the Insights plugin for Rebase.\n *\n * This plugin injects scorecard widgets into key UI locations:\n * - **Home page header**: KPI overview via `home.children.start` slot\n * - **Collection list view**: Scorecards inline (below title, above list) via `collection.insights` slot\n * - **Home page cards**: Compact scorecard metrics auto-extracted from collection insights via `home.card.insight` slot\n *\n * Collection-level insights (`collections.<slug>`) are the single source of truth:\n * scorecards render in the collection list view and are automatically extracted\n * to show as compact widgets on the corresponding home page card.\n *\n * Each insight owns its own `data()` callback — use the Rebase client SDK,\n * call a custom function, or hit any external API. Full flexibility, zero new endpoints.\n *\n * @example\n * ```typescript\n * import { useInsightsPlugin } from \"@rebasepro/plugin-insights\";\n *\n * const insightsPlugin = useInsightsPlugin({\n * cacheTTL: 120_000,\n * insights: {\n * home: [\n * { id: \"revenue\", title: \"Revenue\", data: async () => ..., scorecard: { ... } },\n * ],\n * collections: {\n * orders: [\n * { id: \"total\", title: \"Total Orders\", data: async () => ..., scorecard: { ... } },\n * ],\n * },\n * },\n * });\n * ```\n */\nexport function useInsightsPlugin(config: InsightsPluginConfig): RebasePlugin {\n const { insights, cacheTTL } = config;\n const slots: SlotContribution[] = [];\n\n // ── Home page insights ────────────────────────────────────────────\n if (insights.home && insights.home.length > 0) {\n const homeInsights = insights.home;\n slots.push({\n slot: \"home.children.start\" as const,\n Component: (props: Record<string, unknown>) => (\n <HomeInsightsSlot\n {...props}\n insights={homeInsights}\n />\n ),\n order: 10,\n });\n }\n\n // ── Per-collection insights ───────────────────────────────────────\n // A single `collections.<slug>` definition serves two slots:\n // 1. collection.insights → inline scorecards in the list view\n // 2. home.card.insight → compact scorecards on the home card\n if (insights.collections) {\n for (const [slug, defs] of Object.entries(insights.collections)) {\n if (defs.length === 0) continue;\n const collectionInsights = defs;\n\n // 1. Inline in collection list view\n slots.push({\n slot: \"collection.insights\" as const,\n Component: (props: Record<string, unknown>) => {\n const path = props.path as string;\n const collectionSlug = path?.split(\"/\").filter(Boolean).pop() ?? \"\";\n if (collectionSlug !== slug) return null;\n return (\n <CollectionInsightsInline\n {...props as { path: string; collection: unknown; parentCollectionIds: string[] }}\n insights={collectionInsights}\n />\n );\n },\n order: 10,\n });\n\n // 2. Auto-extract scorecards for home page card\n slots.push({\n slot: \"home.card.insight\" as const,\n Component: (props: Record<string, unknown>) => {\n const cardSlug = props.slug as string;\n if (cardSlug !== slug) return null;\n return (\n <HomeCardInsightSlot\n {...props as { slug: string; collection: unknown; context: unknown }}\n insights={collectionInsights}\n />\n );\n },\n order: 10,\n });\n }\n }\n\n return {\n key: \"plugin-insights\",\n slots,\n providers: [\n {\n scope: \"root\" as const,\n Component: InsightsProvider as React.ComponentType<React.PropsWithChildren<Record<string, unknown>>>,\n props: { cacheTTL },\n },\n ],\n };\n}\n"],"names":["InsightsCache","constructor","ttl","cache","Map","inflight","get","key","entry","Date","now","timestamp","delete","data","set","getInflight","setInflight","promise","invalidate","clear","InsightsContext","createContext","InsightsProvider","t0","$","_c","cacheTTL","children","t1","t2","t3","t4","value","t5","jsx","useInsightsEngine","useContext","useInsightsData","definition","collectionSlug","engine","initialLoading","authLoading","user","loginSkipped","useAuthController","authReady","Boolean","setData","useState","loading","setLoading","error","setError","cacheKey","id","cancelled","cached","then","result","catch","err","Error","String","finally","result_0","err_0","useEffect","formatNumber","format","undefined","options","style","notation","maximumFractionDigits","decimals","minimumFractionDigits","currency","formatted","Intl","NumberFormat","showSign","InsightsScorecardView","config","title","compact","embedded","containerRef","useRef","containerWidth","setContainerWidth","Symbol","for","current","offsetWidth","observer","ResizeObserver","entries","contentRect","width","observe","disconnect","React","useLayoutEffect","mainValue","field","formattedValue","comparisonElement","comparison","comparisonValue","t6","formattedComparison","isPositive","isNegative","colorClass","intent","t7","t8","isSmall","icon","getIcon","iconElement","cls","defaultBorderMixin","t9","t10","jsxs","t11","baseClass","minHeight","t12","dateRange","t13","t14","t15","t16","t17","t18","t19","displayName","InsightWidgetSkeleton","hasComparison","hasIcon","hasDateRange","height","InsightWidget","scorecard","message","rows","length","HomeCardInsightSlot","slug","insights","def","map","HomeInsightsSlot","_temp","CollectionInsightsInline","useInsightsPlugin","slots","home","homeInsights","push","slot","Component","props","order","collections","defs","Object","collectionInsights","path","split","filter","pop","cardSlug","providers","scope"],"mappings":";;;;EAaO,MAAMA,cAAc;AAAA,IAIvBC,YAAoBC,MAAc,KAAQ;AAAtBA,WAAAA,MAAAA;AAAAA,IAAuB;AAAA,IAHnCC,4BAAYC,IAAAA;AAAAA,IACZC,+BAAeD,IAAAA;AAAAA,IAIvBE,IAAIC,KAAuC;AACvC,YAAMC,QAAQ,KAAKL,MAAMG,IAAIC,GAAG;AAChC,UAAI,CAACC,MAAO,QAAO;AACnB,UAAIC,KAAKC,IAAAA,IAAQF,MAAMG,YAAY,KAAKT,KAAK;AACzC,aAAKC,MAAMS,OAAOL,GAAG;AACrB,eAAO;AAAA,MACX;AACA,aAAOC,MAAMK;AAAAA,IACjB;AAAA,IAEAC,IAAIP,KAAaM,MAA+B;AAC5C,WAAKV,MAAMW,IAAIP,KAAK;AAAA,QAAEM;AAAAA,QAAMF,WAAWF,KAAKC,IAAAA;AAAAA,MAAI,CAAG;AACnD,WAAKL,SAASO,OAAOL,GAAG;AAAA,IAC5B;AAAA,IAEAQ,YAAYR,KAAgD;AACxD,aAAO,KAAKF,SAASC,IAAIC,GAAG,KAAK;AAAA,IACrC;AAAA,IAEAS,YAAYT,KAAaU,SAA2C;AAChE,WAAKZ,SAASS,IAAIP,KAAKU,OAAO;AAAA,IAClC;AAAA,IAEAC,WAAWX,KAAoB;AAC3B,UAAIA,KAAK;AACL,aAAKJ,MAAMS,OAAOL,GAAG;AACrB,aAAKF,SAASO,OAAOL,GAAG;AAAA,M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;AAAAA,MACAiB,WAAW,CACP;AAAA,QACIC,OAAO;AAAA,QACPb,WAAW9I;AAAAA,QACX+I,OAAO;AAAA,UAAE3I;AAAAA,QAAAA;AAAAA,MAAS,CACrB;AAAA,IAAA;AAAA,EAGb;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":["../src/engine/InsightsCache.ts","../src/engine/InsightsProvider.tsx","../src/engine/useInsightsData.ts","../src/components/InsightsScorecardView.tsx","../src/components/InsightWidgetSkeleton.tsx","../src/components/InsightWidget.tsx","../src/components/HomeCardInsightSlot.tsx","../src/components/HomeInsightsSlot.tsx","../src/components/CollectionInsightsInline.tsx","../src/useInsightsPlugin.tsx"],"sourcesContent":["import type { InsightDataResult } from \"../types\";\n\ninterface CacheEntry {\n data: InsightDataResult;\n timestamp: number;\n}\n\n/**\n * In-memory cache for insight query results.\n * Supports TTL-based expiry and inflight request deduplication\n * to prevent redundant network requests when multiple widgets\n * share the same query.\n */\nexport class InsightsCache {\n private cache = new Map<string, CacheEntry>();\n private inflight = new Map<string, Promise<InsightDataResult>>();\n\n constructor(private ttl: number = 60_000) {}\n\n get(key: string): InsightDataResult | null {\n const entry = this.cache.get(key);\n if (!entry) return null;\n if (Date.now() - entry.timestamp > this.ttl) {\n this.cache.delete(key);\n return null;\n }\n return entry.data;\n }\n\n set(key: string, data: InsightDataResult): void {\n this.cache.set(key, { data, timestamp: Date.now() });\n this.inflight.delete(key);\n }\n\n getInflight(key: string): Promise<InsightDataResult> | null {\n return this.inflight.get(key) ?? null;\n }\n\n setInflight(key: string, promise: Promise<InsightDataResult>): void {\n this.inflight.set(key, promise);\n }\n\n invalidate(key?: string): void {\n if (key) {\n this.cache.delete(key);\n this.inflight.delete(key);\n } else {\n this.cache.clear();\n this.inflight.clear();\n }\n }\n}\n","import React, { createContext, useContext, useMemo, type PropsWithChildren } from \"react\";\nimport { InsightsCache } from \"./InsightsCache\";\n\ninterface InsightsContextValue {\n cache: InsightsCache;\n}\n\nconst InsightsContext = createContext<InsightsContextValue | null>(null);\n\n/**\n * Root-level provider for the insights data engine.\n * Injected automatically by the plugin via `providers: [{ scope: \"root\" }]`.\n *\n * Manages a single `InsightsCache` instance shared by all insight widgets\n * for TTL-based caching and inflight request deduplication.\n */\nexport function InsightsProvider({\n cacheTTL,\n children\n}: PropsWithChildren<{ cacheTTL?: number }>) {\n const cache = useMemo(() => new InsightsCache(cacheTTL), [cacheTTL]);\n const value = useMemo(() => ({ cache }), [cache]);\n\n return (\n <InsightsContext.Provider value={value}>\n {children}\n </InsightsContext.Provider>\n );\n}\n\n/**\n * Access the insights cache (for advanced usage).\n * Returns null when called outside of an `InsightsProvider`\n * (e.g. during auth-loading phase before plugin providers mount).\n */\nexport function useInsightsEngine(): InsightsContextValue | null {\n return useContext(InsightsContext);\n}\n","import { useEffect, useState } from \"react\";\nimport type { InsightDefinition, InsightDataResult, InsightContext } from \"../types\";\nimport { useInsightsEngine } from \"./InsightsProvider\";\nimport { useAuthController } from \"@rebasepro/core\";\n\n/**\n * Hook that fetches and caches data for a single insight definition.\n *\n * Calls the definition's own `data()` callback and manages:\n * - TTL-based caching via InsightsCache\n * - Inflight request deduplication (multiple mounts of the same widget)\n * - Loading and error state management\n *\n * @param definition - The insight to fetch data for\n * @param collectionSlug - Optional collection context for cache key scoping\n */\nexport function useInsightsData(\n definition: InsightDefinition,\n context: InsightContext\n): {\n data: InsightDataResult | null;\n loading: boolean;\n error: Error | null;\n} {\n const engine = useInsightsEngine();\n const cache = engine?.cache ?? null;\n const { initialLoading, authLoading, user, loginSkipped } = useAuthController();\n const authReady = !initialLoading && !authLoading && (Boolean(user) || loginSkipped);\n const [data, setData] = useState<InsightDataResult | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const cacheKey = `${definition.id}:${context.path ?? context.collectionSlug ?? \"global\"}`;\n\n useEffect(() => {\n // Keep showing skeleton until both auth and engine are ready\n if (!authReady || !cache) {\n return;\n }\n\n let cancelled = false;\n\n // 1. Check cache\n const cached = cache.get(cacheKey);\n if (cached) {\n setData(cached);\n setLoading(false);\n return;\n }\n\n // 2. Check inflight — deduplicate concurrent requests for the same widget\n const inflight = cache.getInflight(cacheKey);\n if (inflight) {\n setLoading(true);\n inflight\n .then((result) => {\n if (!cancelled) {\n setData(result);\n }\n })\n .catch((err) => {\n if (!cancelled) setError(err instanceof Error ? err : new Error(String(err)));\n })\n .finally(() => {\n if (!cancelled) setLoading(false);\n });\n return;\n }\n\n // 3. Fresh fetch — invoke the definition's own data callback\n setLoading(true);\n setError(null);\n\n const promise = definition.data(context);\n\n cache.setInflight(cacheKey, promise);\n\n promise\n .then((result) => {\n cache.set(cacheKey, result);\n if (!cancelled) {\n setData(result);\n }\n })\n .catch((err) => {\n if (!cancelled) {\n setError(err instanceof Error ? err : new Error(String(err)));\n }\n })\n .finally(() => {\n if (!cancelled) setLoading(false);\n });\n\n return () => {\n cancelled = true;\n };\n }, [definition.id, definition.data, context.path, context.collectionSlug, cacheKey, cache, authReady]);\n\n return { data, loading, error };\n}\n","import React, { useRef, useState } from \"react\";\nimport { getIcon } from \"@rebasepro/core\";\nimport { cls, defaultBorderMixin } from \"@rebasepro/ui\";\nimport type { DataRow, ScorecardConfig, ScorecardFormat } from \"../types\";\n\nfunction formatNumber(value: number, format?: ScorecardFormat): string {\n if (value === null || value === undefined) return \"N/A\";\n\n const options: Intl.NumberFormatOptions = {\n style: format?.style ?? \"decimal\",\n notation: format?.notation ?? \"standard\",\n maximumFractionDigits: format?.decimals ?? 1,\n minimumFractionDigits: format?.decimals ?? 1,\n };\n\n if (format?.style === \"currency\") {\n options.currency = format.currency ?? \"USD\";\n }\n\n let formatted = new Intl.NumberFormat(\"en-US\", options).format(value);\n\n if (format?.showSign && value > 0) {\n formatted = \"+\" + formatted;\n }\n\n return formatted;\n}\n\n/**\n * Scorecard widget for the Rebase design system.\n *\n * Renders a single KPI metric with optional comparison value and icon.\n * Uses Tailwind `dark:` classes — no JS dark mode detection.\n * Icons are resolved via `getIcon` from `@rebasepro/core`.\n */\nexport function InsightsScorecardView({\n config,\n data,\n title,\n compact = false,\n embedded = false,\n}: {\n config: ScorecardConfig;\n data: DataRow;\n title: string;\n compact?: boolean;\n /** When true, skip own border/bg since the parent card provides them. */\n embedded?: boolean;\n}) {\n const containerRef = useRef<HTMLDivElement>(null);\n const [containerWidth, setContainerWidth] = useState<number | null>(null);\n\n React.useLayoutEffect(() => {\n if (!containerRef.current) return;\n // Read initial width synchronously before paint\n setContainerWidth(containerRef.current.offsetWidth);\n const observer = new ResizeObserver((entries) => {\n for (const entry of entries) {\n setContainerWidth(entry.contentRect.width);\n }\n });\n observer.observe(containerRef.current);\n return () => observer.disconnect();\n }, []);\n\n const mainValue = data[config.value.field];\n const formattedValue = typeof mainValue === \"number\"\n ? formatNumber(mainValue, config.value.format)\n : String(mainValue ?? \"N/A\");\n\n // Comparison rendering\n let comparisonElement: React.ReactNode = null;\n if (config.comparison) {\n const comparisonValue = data[config.comparison.field];\n if (typeof comparisonValue === \"number\") {\n const formattedComparison = formatNumber(comparisonValue, config.comparison.format);\n const isPositive = comparisonValue > 0;\n const isNegative = comparisonValue < 0;\n\n let colorClass = \"text-surface-500 dark:text-surface-400\";\n if (config.comparison.intent === \"increase_is_good\") {\n if (isPositive) colorClass = \"text-emerald-500\";\n if (isNegative) colorClass = \"text-red-500\";\n } else if (config.comparison.intent === \"decrease_is_good\") {\n if (isPositive) colorClass = \"text-red-500\";\n if (isNegative) colorClass = \"text-emerald-500\";\n }\n\n comparisonElement = (\n <span className={`font-medium ${compact ? \"text-[10px]\" : \"text-xs\"} ${colorClass}`}>\n {formattedComparison}\n </span>\n );\n }\n }\n\n const isSmall = compact || (containerWidth !== null && containerWidth < 200);\n\n // Resolve icon via getIcon (Lucide-based resolution)\n const iconElement = config.icon\n ? getIcon(config.icon, \"text-surface-400 dark:text-surface-500\", undefined, isSmall ? 14 : 18)\n : null;\n\n // ── Compact card-inline layout ──────────────────────────────────────\n if (compact) {\n return (\n <div className={cls(\"flex flex-col gap-0.5 px-2.5 py-2 rounded-md bg-transparent border min-w-0\", defaultBorderMixin)}>\n <span className=\"text-[10px] uppercase tracking-wider text-surface-400 dark:text-surface-500 truncate\">\n {title}\n </span>\n <div className=\"flex items-baseline gap-1.5\">\n <span className=\"text-sm font-semibold tabular-nums text-surface-800 dark:text-surface-100\">\n {formattedValue}\n </span>\n {comparisonElement}\n </div>\n </div>\n );\n }\n\n // ── Standard scorecard layout ───────────────────────────────────────\n const baseClass = embedded\n ? `flex flex-col min-w-0 h-full ${isSmall ? \"px-3.5 py-3\" : \"px-5 py-4\"}`\n : cls(\"rounded-lg flex flex-col min-w-0 bg-transparent border\", defaultBorderMixin, isSmall ? \"px-3.5 py-3\" : \"px-5 py-4\");\n\n return (\n <div ref={containerRef} className={baseClass} style={embedded ? undefined : { minHeight: isSmall ? 68 : 92 }}>\n {/* Title row */}\n <div className={`flex items-center justify-between ${isSmall ? \"mb-1\" : \"mb-2\"}`}>\n <div className=\"flex flex-col min-w-0\">\n <span className={`font-medium leading-snug truncate text-surface-500 dark:text-surface-400 ${isSmall ? \"text-[11px]\" : \"text-xs\"}`}>\n {title}\n </span>\n {config.dateRange && !isSmall && (\n <span className=\"text-[10px] text-surface-400 dark:text-surface-500 truncate mt-0.5\">\n {config.dateRange}\n </span>\n )}\n </div>\n {iconElement && (\n <span className=\"ml-2 shrink-0\">{iconElement}</span>\n )}\n </div>\n\n {/* Main value */}\n <div className={`font-semibold leading-tight tracking-tight break-all text-surface-800 dark:text-surface-100 ${isSmall ? \"text-lg\" : (containerWidth !== null && containerWidth < 300) ? \"text-xl\" : \"text-2xl\"}`}>\n {formattedValue}\n </div>\n\n {/* Comparison */}\n {comparisonElement && (\n <div className={isSmall ? \"mt-0.5\" : \"mt-1\"}>\n {comparisonElement}\n </div>\n )}\n </div>\n );\n}\n\nInsightsScorecardView.displayName = \"InsightsScorecardView\";\n","import React, { useRef, useState } from \"react\";\nimport { cls, defaultBorderMixin } from \"@rebasepro/ui\";\nimport type { ScorecardConfig } from \"../types\";\n\n/**\n * Skeleton loader for scorecard insight widgets — displays animated\n * shimmer placeholders that exactly match the final rendered layout\n * of InsightsScorecardView for a given config, preventing layout shift.\n *\n * The skeleton receives the scorecard config so it can conditionally\n * render placeholder lines for comparison, dateRange, and icon —\n * only when the loaded view will also render them.\n *\n * The standard skeleton mirrors InsightsScorecardView's responsive\n * container-width breakpoints (ResizeObserver → isSmall / isMedium)\n * and uses placeholder heights that exactly match the **computed**\n * Tailwind line-heights (accounting for `leading-*` overrides).\n * This guarantees a pixel-perfect skeleton → loaded transition.\n */\nexport function InsightWidgetSkeleton({\n config,\n compact = false,\n embedded = false,\n}: {\n /** Scorecard config — used to match optional elements (comparison, dateRange, icon). */\n config: ScorecardConfig;\n compact?: boolean;\n /** When true, skip own border since the parent card provides it. */\n embedded?: boolean;\n}) {\n const hasComparison = Boolean(config.comparison);\n const hasIcon = Boolean(config.icon);\n const hasDateRange = Boolean(config.dateRange);\n\n // ── Compact scorecard skeleton ──────────────────────────────────────\n // Matches InsightsScorecardView compact layout:\n // container: flex flex-col gap-0.5 px-2.5 py-2 rounded-md border\n // title: text-[10px] uppercase → line-height ~14px\n // value row: text-sm font-semibold → line-height 20px\n // + optional comparison text-[10px] inside value row\n if (compact) {\n return (\n <div\n className={cls(\n \"animate-pulse\",\n embedded\n ? \"h-full px-2.5 py-2\"\n : \"flex flex-col gap-0.5 rounded-md bg-transparent border min-w-0 px-2.5 py-2\",\n !embedded && defaultBorderMixin\n )}\n >\n {/* Title line */}\n <div className=\"bg-surface-200 dark:bg-surface-700 rounded-sm\"\n style={{ height: 14, width: 48 }}\n />\n {/* Value + optional comparison row */}\n <div className=\"flex items-baseline gap-1.5\">\n <div className=\"bg-surface-200 dark:bg-surface-700 rounded-sm\"\n style={{ height: 20, width: 40 }}\n />\n {hasComparison && (\n <div className=\"bg-surface-200/60 dark:bg-surface-700/60 rounded-sm\"\n style={{ height: 14, width: 28 }}\n />\n )}\n </div>\n </div>\n );\n }\n\n // ── Standard scorecard skeleton ─────────────────────────────────────\n return <StandardSkeleton\n hasComparison={hasComparison}\n hasIcon={hasIcon}\n hasDateRange={hasDateRange}\n embedded={embedded}\n />;\n}\n\n// ── Tailwind line-height reference ──────────────────────────────────────\n// All heights below are the **computed** CSS line-heights, accounting\n// for `leading-*` overrides that InsightsScorecardView applies.\n//\n// Title:\n// text-xs (12px) + leading-snug (1.375) → 12 × 1.375 = 16.5px\n// text-[11px] + leading-snug (1.375) → 11 × 1.375 = 15.125px\n//\n// DateRange:\n// text-[10px] with no explicit LH → normal ≈ 14px (browser)\n//\n// Value:\n// text-2xl (24px) + leading-tight (1.25) → 24 × 1.25 = 30px\n// text-xl (20px) + leading-tight (1.25) → 20 × 1.25 = 25px\n// text-lg (18px) + leading-tight (1.25) → 18 × 1.25 = 22.5px\n//\n// Comparison:\n// text-xs (12px) → built-in LH 1rem = 16px\n\n/**\n * Inner component for the standard scorecard skeleton.\n *\n * Mirrors InsightsScorecardView's layout by:\n * 1. Using the same ResizeObserver + containerWidth pattern for\n * responsive breakpoints (isSmall < 200px, isMedium < 300px).\n * 2. Using placeholder heights derived from the exact computed\n * Tailwind line-heights that InsightsScorecardView renders.\n * 3. Matching all container classes, margins, paddings, and flex\n * layout properties identically.\n */\nfunction StandardSkeleton({\n hasComparison,\n hasIcon,\n hasDateRange,\n embedded,\n}: {\n hasComparison: boolean;\n hasIcon: boolean;\n hasDateRange: boolean;\n embedded: boolean;\n}) {\n const containerRef = useRef<HTMLDivElement>(null);\n const [containerWidth, setContainerWidth] = useState<number | null>(null);\n\n React.useLayoutEffect(() => {\n if (!containerRef.current) return;\n setContainerWidth(containerRef.current.offsetWidth);\n const observer = new ResizeObserver((entries) => {\n for (const entry of entries) {\n setContainerWidth(entry.contentRect.width);\n }\n });\n observer.observe(containerRef.current);\n return () => observer.disconnect();\n }, []);\n\n // Mirror InsightsScorecardView's responsive breakpoints exactly\n const isSmall = containerWidth !== null && containerWidth < 200;\n\n // Computed line-heights for each breakpoint\n // Title: text-xs + leading-snug = 16.5px, text-[11px] + leading-snug = 15.125px\n const titleHeight = isSmall ? 15 : 16.5;\n // Value: leading-tight (×1.25) applied on top of font-size\n const valueHeight = isSmall\n ? 22.5 // text-lg: 18 × 1.25\n : (containerWidth !== null && containerWidth < 300)\n ? 25 // text-xl: 20 × 1.25\n : 30; // text-2xl: 24 × 1.25\n // Comparison: text-xs = 12px / 16px line-height (no leading override)\n const comparisonHeight = 16;\n // Icon: 14px when small, 18px otherwise\n const iconSize = isSmall ? 14 : 18;\n\n const baseClass = embedded\n ? `flex flex-col min-w-0 h-full ${isSmall ? \"px-3.5 py-3\" : \"px-5 py-4\"}`\n : cls(\"rounded-lg flex flex-col min-w-0 bg-transparent border\", defaultBorderMixin, isSmall ? \"px-3.5 py-3\" : \"px-5 py-4\");\n\n return (\n <div\n ref={containerRef}\n className={cls(\"animate-pulse\", baseClass)}\n style={embedded ? undefined : { minHeight: isSmall ? 68 : 92 }}\n >\n {/* Title row — identical flex structure to InsightsScorecardView */}\n <div className={`flex items-center justify-between ${isSmall ? \"mb-1\" : \"mb-2\"}`}>\n <div className=\"flex flex-col min-w-0\">\n {/* Title placeholder */}\n <div className=\"bg-surface-200 dark:bg-surface-700 rounded\"\n style={{ height: titleHeight, width: \"60%\" }}\n />\n {/* DateRange — hidden when isSmall, same as real view (line 134) */}\n {hasDateRange && !isSmall && (\n <div className=\"bg-surface-200/60 dark:bg-surface-700/60 rounded mt-0.5\"\n style={{ height: 14, width: \"40%\" }}\n />\n )}\n </div>\n {/* Icon placeholder — same wrapper as real view */}\n {hasIcon && (\n <span className=\"ml-2 shrink-0\">\n <div className=\"bg-surface-200 dark:bg-surface-700 rounded\"\n style={{ height: iconSize, width: iconSize }}\n />\n </span>\n )}\n </div>\n\n {/* Main value placeholder */}\n <div className=\"bg-surface-200 dark:bg-surface-700 rounded\"\n style={{ height: valueHeight, width: \"40%\" }}\n />\n\n {/* Comparison placeholder */}\n {hasComparison && (\n <div className={isSmall ? \"mt-0.5\" : \"mt-1\"}>\n <div className=\"bg-surface-200/60 dark:bg-surface-700/60 rounded\"\n style={{ height: comparisonHeight, width: \"25%\" }}\n />\n </div>\n )}\n </div>\n );\n}\n\nInsightWidgetSkeleton.displayName = \"InsightWidgetSkeleton\";\n","import React from \"react\";\nimport type { InsightDefinition, DataRow } from \"../types\";\nimport { useInsightsData } from \"../engine/useInsightsData\";\nimport { InsightsScorecardView } from \"./InsightsScorecardView\";\nimport { InsightWidgetSkeleton } from \"./InsightWidgetSkeleton\";\n\n/**\n * Single insight widget orchestrator.\n *\n * Fetches data via the engine, renders the scorecard visualization,\n * and manages loading/error states.\n *\n * All theme-awareness is handled via Tailwind `dark:` classes.\n */\nexport function InsightWidget({\n definition,\n collectionSlug,\n path,\n parentCollectionSlugs, parentEntityIds,\n compact = false,\n embedded = false,\n}: {\n definition: InsightDefinition;\n collectionSlug?: string;\n path?: string;\n parentCollectionSlugs?: string[], parentEntityIds?: string[];\n compact?: boolean;\n /** When true, inner views skip their own borders since the parent card provides them. */\n embedded?: boolean;\n}) {\n const { data, loading, error } = useInsightsData(definition, { path, collectionSlug, parentCollectionSlugs });\n\n if (loading) {\n return <InsightWidgetSkeleton config={definition.scorecard} compact={compact} embedded={embedded} />;\n }\n\n if (error) {\n return (\n <div\n className={`text-red-500/70 dark:text-red-400/70 text-[0.8125rem] ${embedded ? \"px-5 py-4 h-full\" : `rounded-lg bg-red-500/5 dark:bg-red-400/5 border border-red-500/10 dark:border-red-400/10 ${compact ? \"px-3.5 py-3\" : \"px-5 py-4\"}`}`}\n >\n <div className=\"font-semibold mb-1\">{definition.title}</div>\n <div>{error.message}</div>\n </div>\n );\n }\n\n if (!data || data.rows.length === 0) {\n return (\n <div\n className={`text-surface-400 dark:text-surface-500 text-[0.8125rem] ${embedded ? \"px-5 py-4 h-full\" : `rounded-lg bg-surface-100 dark:bg-surface-800 border border-surface-200 dark:border-surface-700 ${compact ? \"px-3.5 py-3\" : \"px-5 py-4\"}`}`}\n >\n {definition.title} — No data\n </div>\n );\n }\n\n return (\n <InsightsScorecardView\n config={definition.scorecard}\n data={data.rows[0] as DataRow}\n title={definition.title}\n compact={compact}\n embedded={embedded}\n />\n );\n}\n\nInsightWidget.displayName = \"InsightWidget\";\n","import React from \"react\";\nimport type { InsightDefinition } from \"../types\";\nimport { InsightWidget } from \"./InsightWidget\";\n\n/**\n * Renders compact insight widgets inline within a home page collection card.\n * Injected via the `home.card.insight` slot.\n *\n * Uses a horizontal flex layout so multiple cards sit side by side.\n */\nexport function HomeCardInsightSlot({\n slug,\n insights,\n}: {\n slug: string;\n collection: unknown;\n context: unknown;\n insights: InsightDefinition[];\n}) {\n if (!insights || insights.length === 0) return null;\n\n // Each compact card row is ~42px; estimate 2 cards per row for wrapping\n const estimatedRows = Math.ceil(insights.length / 2);\n const minHeight = estimatedRows * 42 + (estimatedRows - 1) * 6; // 6px = gap-1.5\n\n return (\n <div className=\"flex flex-wrap items-center gap-1.5 mt-2\" style={{ minHeight }}>\n {insights.map((def) => (\n <InsightWidget\n key={def.id}\n definition={def}\n collectionSlug={slug}\n compact={true}\n />\n ))}\n </div>\n );\n}\n\nHomeCardInsightSlot.displayName = \"HomeCardInsightSlot\";\n","import React from \"react\";\nimport type { InsightDefinition } from \"../types\";\nimport { InsightWidget } from \"./InsightWidget\";\n\n/**\n * Scorecard insights panel rendered at the top of the home page.\n * Injected via the `home.children.start` slot.\n *\n * Renders scorecards in a responsive grid (up to 4 columns).\n */\nexport function HomeInsightsSlot({\n insights,\n}: {\n insights: InsightDefinition[];\n}) {\n if (!insights || insights.length === 0) return null;\n\n return (\n <div\n className=\"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 pb-6\"\n style={{ minHeight: 92 }}\n >\n {insights.map((def) => (\n <InsightWidget key={def.id} definition={def} />\n ))}\n </div>\n );\n}\n\nHomeInsightsSlot.displayName = \"HomeInsightsSlot\";\n","import React from \"react\";\nimport type { InsightDefinition } from \"../types\";\nimport { InsightWidget } from \"./InsightWidget\";\n\n/**\n * Renders scorecard insight widgets inline within a collection's list view,\n * positioned below the title and above the main data list.\n *\n * Injected via the `collection.insights` slot.\n */\nexport function CollectionInsightsInline({\n insights,\n path,\n parentCollectionSlugs,\n parentEntityIds\n}: {\n path: string;\n collection: unknown;\n parentCollectionSlugs: string[], parentEntityIds: string[];\n insights: InsightDefinition[];\n}) {\n if (!insights || insights.length === 0) return null;\n\n return (\n <div className=\"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 pb-4\">\n {insights.map((def) => (\n <InsightWidget \n key={def.id} \n definition={def} \n path={path}\n parentCollectionSlugs={parentCollectionSlugs} parentEntityIds={parentEntityIds}\n />\n ))}\n </div>\n );\n}\n\nCollectionInsightsInline.displayName = \"CollectionInsightsInline\";\n","import React from \"react\";\nimport type { RebasePlugin, SlotContribution } from \"@rebasepro/types\";\nimport type { InsightsPluginConfig } from \"./types\";\nimport { InsightsProvider } from \"./engine/InsightsProvider\";\nimport { HomeCardInsightSlot } from \"./components/HomeCardInsightSlot\";\nimport { HomeInsightsSlot } from \"./components/HomeInsightsSlot\";\nimport { CollectionInsightsInline } from \"./components/CollectionInsightsInline\";\n\n/**\n * Creates the Insights plugin for Rebase.\n *\n * This plugin injects scorecard widgets into key UI locations:\n * - **Home page header**: KPI overview via `home.children.start` slot\n * - **Collection list view**: Scorecards inline (below title, above list) via `collection.insights` slot\n * - **Home page cards**: Compact scorecard metrics auto-extracted from collection insights via `home.card.insight` slot\n *\n * Collection-level insights (`collections.<slug>`) are the single source of truth:\n * scorecards render in the collection list view and are automatically extracted\n * to show as compact widgets on the corresponding home page card.\n *\n * Each insight owns its own `data()` callback — use the Rebase client SDK,\n * call a custom function, or hit any external API. Full flexibility, zero new endpoints.\n *\n * @example\n * ```typescript\n * import { useInsightsPlugin } from \"@rebasepro/plugin-insights\";\n *\n * const insightsPlugin = useInsightsPlugin({\n * cacheTTL: 120_000,\n * insights: {\n * home: [\n * { id: \"revenue\", title: \"Revenue\", data: async () => ..., scorecard: { ... } },\n * ],\n * collections: {\n * orders: [\n * { id: \"total\", title: \"Total Orders\", data: async () => ..., scorecard: { ... } },\n * ],\n * },\n * },\n * });\n * ```\n */\nexport function useInsightsPlugin(config: InsightsPluginConfig): RebasePlugin {\n const { insights, cacheTTL } = config;\n const slots: SlotContribution[] = [];\n\n // ── Home page insights ────────────────────────────────────────────\n if (insights.home && insights.home.length > 0) {\n const homeInsights = insights.home;\n slots.push({\n slot: \"home.children.start\" as const,\n Component: (props: Record<string, unknown>) => (\n <HomeInsightsSlot\n {...props}\n insights={homeInsights}\n />\n ),\n order: 10,\n });\n }\n\n // ── Per-collection insights ───────────────────────────────────────\n // A single `collections.<slug>` definition serves two slots:\n // 1. collection.insights → inline scorecards in the list view\n // 2. home.card.insight → compact scorecards on the home card\n if (insights.collections) {\n for (const [slug, defs] of Object.entries(insights.collections)) {\n if (defs.length === 0) continue;\n const collectionInsights = defs;\n\n // 1. Inline in collection list view\n slots.push({\n slot: \"collection.insights\" as const,\n Component: (props: Record<string, unknown>) => {\n const path = props.path as string;\n const collectionSlug = path?.split(\"/\").filter(Boolean).pop() ?? \"\";\n if (collectionSlug !== slug) return null;\n return (\n <CollectionInsightsInline\n {...props as { path: string; collection: unknown; parentCollectionSlugs: string[], parentEntityIds: string[] }}\n insights={collectionInsights}\n />\n );\n },\n order: 10,\n });\n\n // 2. Auto-extract scorecards for home page card\n slots.push({\n slot: \"home.card.insight\" as const,\n Component: (props: Record<string, unknown>) => {\n const cardSlug = props.slug as string;\n if (cardSlug !== slug) return null;\n return (\n <HomeCardInsightSlot\n {...props as { slug: string; collection: unknown; context: unknown }}\n insights={collectionInsights}\n />\n );\n },\n order: 10,\n });\n }\n }\n\n return {\n key: \"plugin-insights\",\n slots,\n providers: [\n {\n scope: \"root\" as const,\n Component: InsightsProvider as React.ComponentType<React.PropsWithChildren<Record<string, unknown>>>,\n props: { cacheTTL },\n },\n ],\n };\n}\n"],"names":["InsightsCache","constructor","ttl","cache","Map","inflight","get","key","entry","Date","now","timestamp","delete","data","set","getInflight","setInflight","promise","invalidate","clear","InsightsContext","createContext","InsightsProvider","t0","$","_c","cacheTTL","children","t1","t2","t3","t4","value","t5","jsx","useInsightsEngine","useContext","useInsightsData","definition","context","engine","initialLoading","authLoading","user","loginSkipped","useAuthController","authReady","Boolean","setData","useState","loading","setLoading","error","setError","cacheKey","id","path","collectionSlug","cancelled","cached","then","result","catch","err","Error","String","finally","result_0","err_0","useEffect","formatNumber","format","undefined","options","style","notation","maximumFractionDigits","decimals","minimumFractionDigits","currency","formatted","Intl","NumberFormat","showSign","InsightsScorecardView","config","title","compact","embedded","containerRef","useRef","containerWidth","setContainerWidth","Symbol","for","current","offsetWidth","observer","ResizeObserver","entries","contentRect","width","observe","disconnect","React","useLayoutEffect","mainValue","field","formattedValue","comparisonElement","comparison","comparisonValue","t6","formattedComparison","isPositive","isNegative","colorClass","intent","t7","t8","isSmall","icon","getIcon","iconElement","cls","defaultBorderMixin","t9","t10","jsxs","t11","baseClass","minHeight","t12","dateRange","t13","t14","t15","t16","t17","t18","t19","displayName","InsightWidgetSkeleton","hasComparison","hasIcon","hasDateRange","height","StandardSkeleton","titleHeight","valueHeight","iconSize","InsightWidget","parentCollectionSlugs","scorecard","message","rows","length","HomeCardInsightSlot","slug","insights","estimatedRows","Math","ceil","def","map","HomeInsightsSlot","_temp","CollectionInsightsInline","parentEntityIds","useInsightsPlugin","slots","home","homeInsights","push","slot","Component","props","order","collections","defs","Object","collectionInsights","split","filter","pop","cardSlug","providers","scope"],"mappings":";;;;EAaO,MAAMA,cAAc;AAAA,IAIvBC,YAAoBC,MAAc,KAAQ;AAAtBA,WAAAA,MAAAA;AAAAA,IAAuB;AAAA,IAHnCC,4BAAYC,IAAAA;AAAAA,IACZC,+BAAeD,IAAAA;AAAAA,IAIvBE,IAAIC,KAAuC;AACvC,YAAMC,QAAQ,KAAKL,MAAMG,IAAIC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BACI5H,2BAAAA,IAAC,qBAAA,EACG,GAAI8I,OACJ,UAAUK,oBAAmB;AAAA,UAGzC;AAAA,UACAJ,OAAO;AAAA,QAAA,CACV;AAAA,MACL;AAAA,IACJ;AAEA,WAAO;AAAA,MACH1K,KAAK;AAAA,MACLmK;AAAAA,MACAgB,WAAW,CACP;AAAA,QACIC,OAAO;AAAA,QACPZ,WAAWzJ;AAAAA,QACX0J,OAAO;AAAA,UAAEtJ;AAAAA,QAAAA;AAAAA,MAAS,CACrB;AAAA,IAAA;AAAA,EAGb;;;;;;;;;;;"}
|
|
@@ -5,10 +5,11 @@ import type { InsightDefinition } from "../types";
|
|
|
5
5
|
*
|
|
6
6
|
* Injected via the `collection.insights` slot.
|
|
7
7
|
*/
|
|
8
|
-
export declare function CollectionInsightsInline({ insights, }: {
|
|
8
|
+
export declare function CollectionInsightsInline({ insights, path, parentCollectionSlugs, parentEntityIds }: {
|
|
9
9
|
path: string;
|
|
10
10
|
collection: unknown;
|
|
11
|
-
|
|
11
|
+
parentCollectionSlugs: string[];
|
|
12
|
+
parentEntityIds: string[];
|
|
12
13
|
insights: InsightDefinition[];
|
|
13
14
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
14
15
|
export declare namespace CollectionInsightsInline {
|
|
@@ -7,9 +7,12 @@ import type { InsightDefinition } from "../types";
|
|
|
7
7
|
*
|
|
8
8
|
* All theme-awareness is handled via Tailwind `dark:` classes.
|
|
9
9
|
*/
|
|
10
|
-
export declare function InsightWidget({ definition, collectionSlug, compact, embedded, }: {
|
|
10
|
+
export declare function InsightWidget({ definition, collectionSlug, path, parentCollectionSlugs, parentEntityIds, compact, embedded, }: {
|
|
11
11
|
definition: InsightDefinition;
|
|
12
12
|
collectionSlug?: string;
|
|
13
|
+
path?: string;
|
|
14
|
+
parentCollectionSlugs?: string[];
|
|
15
|
+
parentEntityIds?: string[];
|
|
13
16
|
compact?: boolean;
|
|
14
17
|
/** When true, inner views skip their own borders since the parent card provides them. */
|
|
15
18
|
embedded?: boolean;
|
|
@@ -7,6 +7,12 @@ import type { ScorecardConfig } from "../types";
|
|
|
7
7
|
* The skeleton receives the scorecard config so it can conditionally
|
|
8
8
|
* render placeholder lines for comparison, dateRange, and icon —
|
|
9
9
|
* only when the loaded view will also render them.
|
|
10
|
+
*
|
|
11
|
+
* The standard skeleton mirrors InsightsScorecardView's responsive
|
|
12
|
+
* container-width breakpoints (ResizeObserver → isSmall / isMedium)
|
|
13
|
+
* and uses placeholder heights that exactly match the **computed**
|
|
14
|
+
* Tailwind line-heights (accounting for `leading-*` overrides).
|
|
15
|
+
* This guarantees a pixel-perfect skeleton → loaded transition.
|
|
10
16
|
*/
|
|
11
17
|
export declare function InsightWidgetSkeleton({ config, compact, embedded, }: {
|
|
12
18
|
/** Scorecard config — used to match optional elements (comparison, dateRange, icon). */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InsightDefinition, InsightDataResult } from "../types";
|
|
1
|
+
import type { InsightDefinition, InsightDataResult, InsightContext } from "../types";
|
|
2
2
|
/**
|
|
3
3
|
* Hook that fetches and caches data for a single insight definition.
|
|
4
4
|
*
|
|
@@ -10,7 +10,7 @@ import type { InsightDefinition, InsightDataResult } from "../types";
|
|
|
10
10
|
* @param definition - The insight to fetch data for
|
|
11
11
|
* @param collectionSlug - Optional collection context for cache key scoping
|
|
12
12
|
*/
|
|
13
|
-
export declare function useInsightsData(definition: InsightDefinition,
|
|
13
|
+
export declare function useInsightsData(definition: InsightDefinition, context: InsightContext): {
|
|
14
14
|
data: InsightDataResult | null;
|
|
15
15
|
loading: boolean;
|
|
16
16
|
error: Error | null;
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import type { DataRow, ScorecardConfig } from "./widgets";
|
|
2
|
+
export interface InsightContext {
|
|
3
|
+
/** The resolved path of the collection (e.g., "products/123/orders" or "orders") */
|
|
4
|
+
path?: string;
|
|
5
|
+
parentCollectionSlugs?: string[];
|
|
6
|
+
/** The parent entity IDs if this is a subcollection (e.g., ["123"]) */
|
|
7
|
+
parentEntityIds?: string[];
|
|
8
|
+
/** The collection slug if this is an insight at the collection level */
|
|
9
|
+
collectionSlug?: string;
|
|
10
|
+
}
|
|
2
11
|
/**
|
|
3
12
|
* Result returned by an insight's data callback.
|
|
4
13
|
*/
|
|
@@ -42,7 +51,7 @@ export interface InsightDefinition {
|
|
|
42
51
|
* }
|
|
43
52
|
* ```
|
|
44
53
|
*/
|
|
45
|
-
data: () => Promise<InsightDataResult>;
|
|
54
|
+
data: (context: InsightContext) => Promise<InsightDataResult>;
|
|
46
55
|
/** Scorecard field mapping + formatting. */
|
|
47
56
|
scorecard: ScorecardConfig;
|
|
48
57
|
}
|
|
@@ -80,8 +80,14 @@ export type AuthController<USER extends User = User, ExtraData = unknown> = {
|
|
|
80
80
|
export interface AuthControllerExtended<USER extends User = User, ExtraData = unknown> extends AuthController<USER, ExtraData> {
|
|
81
81
|
/** Login with email and password */
|
|
82
82
|
emailPasswordLogin?(email: string, password: string): Promise<void>;
|
|
83
|
-
/** Login with a Google
|
|
84
|
-
googleLogin
|
|
83
|
+
/** Login with a Google token or authorization code */
|
|
84
|
+
googleLogin?: {
|
|
85
|
+
(token: string, tokenType?: "idToken" | "accessToken"): Promise<void>;
|
|
86
|
+
(payload: {
|
|
87
|
+
code: string;
|
|
88
|
+
redirectUri: string;
|
|
89
|
+
}): Promise<void>;
|
|
90
|
+
};
|
|
85
91
|
/** Register a new user */
|
|
86
92
|
register?(email: string, password: string, displayName?: string): Promise<void>;
|
|
87
93
|
/** Skip login (for anonymous access if enabled) */
|
|
@@ -167,4 +167,17 @@ export interface RebaseClient<DB = unknown> {
|
|
|
167
167
|
email?: EmailService;
|
|
168
168
|
/** Admin API for user and role management */
|
|
169
169
|
admin?: AdminAPI;
|
|
170
|
+
/**
|
|
171
|
+
* The base HTTP URL of the backend server.
|
|
172
|
+
* Exposed by the SDK client (`@rebasepro/client`) and used to auto-derive
|
|
173
|
+
* the `ApiConfigProvider` URL.
|
|
174
|
+
*/
|
|
175
|
+
baseUrl?: string;
|
|
176
|
+
/**
|
|
177
|
+
* WebSocket client for realtime subscriptions and admin capabilities.
|
|
178
|
+
* Exposed by the SDK client (`@rebasepro/client`). The shape is intentionally
|
|
179
|
+
* left as `unknown` in the base interface — callers should narrow via feature
|
|
180
|
+
* detection (e.g. `typeof ws.executeSql === "function"`).
|
|
181
|
+
*/
|
|
182
|
+
ws?: unknown;
|
|
170
183
|
}
|
|
@@ -36,7 +36,8 @@ export type CollectionRegistryController<DB = Record<string, unknown>, EC extend
|
|
|
36
36
|
* Retrieve all the related parent collection ids for a given path
|
|
37
37
|
* @param path
|
|
38
38
|
*/
|
|
39
|
-
|
|
39
|
+
getParentCollectionSlugs: (path: string) => string[];
|
|
40
|
+
getParentEntityIds: (path: string) => string[];
|
|
40
41
|
/**
|
|
41
42
|
* Resolve paths from a list of ids
|
|
42
43
|
* @param ids
|
|
@@ -144,12 +144,19 @@ export interface DataDriver {
|
|
|
144
144
|
path: string;
|
|
145
145
|
databaseId?: string;
|
|
146
146
|
collection: EntityCollection;
|
|
147
|
-
|
|
147
|
+
parentCollectionSlugs?: string[];
|
|
148
|
+
parentEntityIds?: string[];
|
|
148
149
|
}) => Promise<boolean>;
|
|
149
150
|
/**
|
|
150
151
|
* Flag to indicate if the driver has requested the initialization of the text search index
|
|
151
152
|
*/
|
|
152
153
|
needsInitTextSearch?: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Optional REST-optimised fetch service. When present, the REST API
|
|
156
|
+
* generator uses these methods instead of the generic `fetchEntity` /
|
|
157
|
+
* `fetchCollection` pipeline, enabling include-aware eager-loading.
|
|
158
|
+
*/
|
|
159
|
+
restFetchService?: RestFetchService;
|
|
153
160
|
/**
|
|
154
161
|
* Return the admin capabilities of this driver.
|
|
155
162
|
* @see SQLAdmin
|
|
@@ -158,3 +165,31 @@ export interface DataDriver {
|
|
|
158
165
|
*/
|
|
159
166
|
admin?: import("../types/backend").DatabaseAdmin;
|
|
160
167
|
}
|
|
168
|
+
/**
|
|
169
|
+
* REST-optimised fetch service exposed by drivers that support
|
|
170
|
+
* eager-loading of relations via `include`.
|
|
171
|
+
*
|
|
172
|
+
* The methods return flattened rows (`{ id, ...columns }`) rather
|
|
173
|
+
* than the `Entity<M>` wrapper used by the generic DataDriver API.
|
|
174
|
+
*
|
|
175
|
+
* @group DataDriver
|
|
176
|
+
*/
|
|
177
|
+
export interface RestFetchService {
|
|
178
|
+
/**
|
|
179
|
+
* Fetch a collection of flattened entities with optional relation includes.
|
|
180
|
+
*/
|
|
181
|
+
fetchCollectionForRest(collectionPath: string, options?: {
|
|
182
|
+
filter?: FilterValues<string>;
|
|
183
|
+
orderBy?: string;
|
|
184
|
+
order?: "desc" | "asc";
|
|
185
|
+
limit?: number;
|
|
186
|
+
offset?: number;
|
|
187
|
+
startAfter?: Record<string, unknown>;
|
|
188
|
+
searchString?: string;
|
|
189
|
+
databaseId?: string;
|
|
190
|
+
}, include?: string[]): Promise<Record<string, unknown>[]>;
|
|
191
|
+
/**
|
|
192
|
+
* Fetch a single flattened entity with optional relation includes.
|
|
193
|
+
*/
|
|
194
|
+
fetchEntityForRest(collectionPath: string, entityId: string | number, include?: string[], databaseId?: string): Promise<Record<string, unknown> | null>;
|
|
195
|
+
}
|
|
@@ -144,17 +144,18 @@ export interface AppView {
|
|
|
144
144
|
* It will still be accessible if you reach the specified path
|
|
145
145
|
*/
|
|
146
146
|
hideFromNavigation?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Navigation group for this view.
|
|
149
|
+
* Views sharing the same group name will be visually grouped
|
|
150
|
+
* together in the drawer and home page. If not set, the view
|
|
151
|
+
* falls into the default "Views" group.
|
|
152
|
+
*/
|
|
153
|
+
group?: string;
|
|
147
154
|
/**
|
|
148
155
|
* Component to be rendered. This can be any React component, and can use
|
|
149
156
|
* any of the provided hooks
|
|
150
157
|
*/
|
|
151
158
|
view: React.ReactNode;
|
|
152
|
-
/**
|
|
153
|
-
* Optional field used to group top level navigation entries under a
|
|
154
|
-
* navigation view.
|
|
155
|
-
* This prop is ignored for admin views.
|
|
156
|
-
*/
|
|
157
|
-
group?: string;
|
|
158
159
|
/**
|
|
159
160
|
* If true, a wildcard route (slug/*) is automatically registered
|
|
160
161
|
* alongside the base route, enabling nested navigation within this view.
|
|
@@ -193,6 +194,17 @@ export interface NavigationGroupMapping {
|
|
|
193
194
|
* List of collection ids or view paths that belong to this group.
|
|
194
195
|
*/
|
|
195
196
|
entries: string[];
|
|
197
|
+
/**
|
|
198
|
+
* Configure which groups start collapsed.
|
|
199
|
+
* Set to `true` to collapse in both drawer and home page,
|
|
200
|
+
* or use an object to control each independently.
|
|
201
|
+
*
|
|
202
|
+
* @defaultValue false (expanded)
|
|
203
|
+
*/
|
|
204
|
+
collapsedByDefault?: boolean | {
|
|
205
|
+
drawer?: boolean;
|
|
206
|
+
home?: boolean;
|
|
207
|
+
};
|
|
196
208
|
}
|
|
197
209
|
export interface NavigationEntry {
|
|
198
210
|
id: string;
|
|
@@ -3,7 +3,7 @@ import type { EntityCollection } from "../types/collections";
|
|
|
3
3
|
import type { EntityCollectionsBuilder } from "../types/builders";
|
|
4
4
|
import type { EntityCustomView } from "../types/entity_views";
|
|
5
5
|
import type { EntityAction } from "../types/entity_actions";
|
|
6
|
-
import type { AppView } from "./navigation";
|
|
6
|
+
import type { AppView, NavigationGroupMapping } from "./navigation";
|
|
7
7
|
/**
|
|
8
8
|
* Options to enable the built-in collection editor.
|
|
9
9
|
* When provided to `<RebaseCMS>`, the editor is auto-wired as a native feature.
|
|
@@ -25,6 +25,14 @@ export interface RebaseCMSConfig<EC extends EntityCollection = any> {
|
|
|
25
25
|
entityViews?: EntityCustomView<any>[];
|
|
26
26
|
entityActions?: EntityAction[];
|
|
27
27
|
plugins?: any[];
|
|
28
|
+
/**
|
|
29
|
+
* Centralized configuration for how collections and views are grouped
|
|
30
|
+
* in the navigation sidebar and home page.
|
|
31
|
+
* Each mapping defines a named group and the collection/view slugs
|
|
32
|
+
* that belong to it. The array order determines group display order.
|
|
33
|
+
* Entry order within each group determines card order.
|
|
34
|
+
*/
|
|
35
|
+
navigationGroupMappings?: NavigationGroupMapping[];
|
|
28
36
|
/**
|
|
29
37
|
* Enable the built-in visual collection/schema editor.
|
|
30
38
|
* Pass `true` for zero-config, or an options object for fine-grained control.
|
|
@@ -62,6 +62,13 @@ export interface EntitySidePanelProps<M extends Record<string, unknown> = Record
|
|
|
62
62
|
* Allow the user to open the entity fullscreen
|
|
63
63
|
*/
|
|
64
64
|
allowFullScreen?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Pre-populate the form with these values when creating a new entity.
|
|
67
|
+
* Only applied when `entityId` is not set (i.e. the form is in "new" mode).
|
|
68
|
+
* Useful for actions that fetch data from an external source (e.g. a URL)
|
|
69
|
+
* and want to pre-fill the document before the user saves.
|
|
70
|
+
*/
|
|
71
|
+
defaultValues?: Partial<M>;
|
|
65
72
|
}
|
|
66
73
|
/**
|
|
67
74
|
* Controller to open the side dialog displaying entity forms
|
|
@@ -3,6 +3,7 @@ import type { AuthController } from "./controllers/auth";
|
|
|
3
3
|
import type { StorageSource } from "./controllers/storage";
|
|
4
4
|
import type { UserConfigurationPersistence } from "./controllers/local_config_persistence";
|
|
5
5
|
import type { DatabaseAdmin } from "./types/backend";
|
|
6
|
+
import type { RebaseClient } from "./controllers/client";
|
|
6
7
|
import type { RebaseData } from "./controllers/data";
|
|
7
8
|
import type { User } from "./users";
|
|
8
9
|
import type { UserManagementDelegate } from "./types/user_management_delegate";
|
|
@@ -12,6 +13,22 @@ import type { UserManagementDelegate } from "./types/user_management_delegate";
|
|
|
12
13
|
* @group Hooks and utilities
|
|
13
14
|
*/
|
|
14
15
|
export type RebaseCallContext<USER extends User = User> = {
|
|
16
|
+
/**
|
|
17
|
+
* The Rebase client instance.
|
|
18
|
+
* Available in all entity callbacks (beforeSave, afterSave, afterRead,
|
|
19
|
+
* beforeDelete, afterDelete) and in CollectionActionsProps via context.
|
|
20
|
+
* Use it to call backend functions, access data, storage, etc.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // In a beforeSave callback:
|
|
24
|
+
* const result = await context.client.functions.invoke('my-function', { ... });
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* // In a CollectionAction component:
|
|
28
|
+
* const { client } = props.context;
|
|
29
|
+
* const result = await client.functions.invoke('extract-job', { url });
|
|
30
|
+
*/
|
|
31
|
+
client: RebaseClient<any>;
|
|
15
32
|
/**
|
|
16
33
|
* Unified data access — `context.data.products.create(...)`.
|
|
17
34
|
* Access any collection as a dynamic property.
|