@rebasepro/plugin-insights 0.2.1 → 0.2.4
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/common/src/collections/default-collections.d.ts +12 -0
- package/dist/common/src/collections/index.d.ts +1 -0
- package/dist/common/src/data/query_builder.d.ts +51 -0
- package/dist/common/src/index.d.ts +1 -0
- package/dist/common/src/util/permissions.d.ts +1 -0
- package/dist/core/src/components/LoginView/LoginView.d.ts +17 -1
- package/dist/core/src/components/common/types.d.ts +10 -7
- package/dist/core/src/components/common/useDebouncedData.d.ts +1 -1
- package/dist/core/src/core/RebaseProps.d.ts +13 -2
- package/dist/core/src/core/RebaseRouter.d.ts +1 -1
- package/dist/core/src/hooks/index.d.ts +0 -1
- package/dist/core/src/util/entity_cache.d.ts +0 -5
- package/dist/core/src/util/index.d.ts +0 -2
- package/dist/core/src/util/useStorageUploadController.d.ts +2 -2
- package/dist/formex/src/utils.d.ts +2 -2
- package/dist/index.es.js +1 -0
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -0
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/controllers/auth.d.ts +2 -24
- package/dist/types/src/controllers/client.d.ts +0 -3
- package/dist/types/src/controllers/collection_registry.d.ts +1 -1
- package/dist/types/src/controllers/data.d.ts +21 -0
- package/dist/types/src/controllers/data_driver.d.ts +18 -0
- package/dist/types/src/controllers/registry.d.ts +5 -4
- package/dist/types/src/rebase_context.d.ts +1 -1
- package/dist/types/src/types/auth_adapter.d.ts +2 -4
- package/dist/types/src/types/collections.d.ts +0 -4
- package/dist/types/src/types/component_ref.d.ts +1 -1
- package/dist/types/src/types/cron.d.ts +1 -1
- package/dist/types/src/types/entity_views.d.ts +1 -0
- package/dist/types/src/types/export_import.d.ts +1 -1
- package/dist/types/src/types/formex.d.ts +2 -2
- package/dist/types/src/types/properties.d.ts +2 -2
- package/dist/types/src/types/translations.d.ts +28 -12
- package/dist/types/src/types/user_management_delegate.d.ts +6 -4
- package/dist/types/src/users/roles.d.ts +0 -8
- package/dist/ui/src/components/Button.d.ts +2 -2
- package/dist/ui/src/components/ErrorBoundary.d.ts +25 -3
- package/dist/ui/src/components/VirtualTable/VirtualTable.d.ts +1 -1
- package/dist/ui/src/components/VirtualTable/VirtualTableCell.d.ts +6 -6
- package/dist/ui/src/components/VirtualTable/VirtualTableHeader.d.ts +8 -8
- package/dist/ui/src/components/VirtualTable/VirtualTableHeaderRow.d.ts +1 -1
- package/dist/ui/src/components/VirtualTable/VirtualTableProps.d.ts +11 -11
- package/dist/ui/src/components/VirtualTable/VirtualTableRow.d.ts +1 -1
- package/dist/ui/src/components/VirtualTable/types.d.ts +9 -9
- package/dist/ui/src/hooks/useDebounceCallback.d.ts +1 -1
- package/dist/ui/src/util/debounce.d.ts +1 -1
- package/package.json +9 -3
- package/src/engine/InsightsCache.test.ts +56 -0
- package/src/engine/useInsightsData.ts +1 -0
- package/dist/core/src/hooks/useValidateAuthenticator.d.ts +0 -21
- package/dist/core/src/util/icon_synonyms.d.ts +0 -1
- package/dist/core/src/util/useTraceUpdate.d.ts +0 -2
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, 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,IAAvBA;AAAAA,IAHZC,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,OA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Q4D,SAASmB,WAAW,GAAG;AAC7D,YAAIC,KAAKvB,WAAW,EAAG;AACvB,cAAMyB,qBAAqBF;AAG3BT,cAAMG,KAAK;AAAA,UACPC,MAAM;AAAA,UACNC,WAAWA,CAACC,UAAmC;AAC3C,kBAAMxH,OAAOwH,MAAMxH;AACnB,kBAAMC,iBAAiBD,MAAM8H,MAAM,GAAG,EAAEC,OAAOxI,OAAO,EAAEyI,IAAAA,KAAS;AACjE,gBAAI/H,mBAAmBqG,KAAM,QAAO;AACpC,mBACI5H,2BAAAA,IAAC,0BAAA,EACG,GAAI8I,OACJ,UAAUK,oBAAmB;AAAA,UAGzC;AAAA,UACAJ,OAAO;AAAA,QAAA,CACV;AAGDP,cAAMG,KAAK;AAAA,UACPC,MAAM;AAAA,UACNC,WAAWA,CAACC,UAAmC;AAC3C,kBAAMS,WAAWT,MAAMlB;AACvB,gBAAI2B,aAAa3B,KAAM,QAAO;AAC9B,mBACI5H,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;;;;;;;;;;;"}
|
|
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 cache.invalidate(cacheKey);\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,IAAvBA;AAAAA,IAHZC,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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ageSource } from "./storage";
|
|
2
1
|
import { Role, User } from "../users";
|
|
3
|
-
import { RebaseData } from "./data";
|
|
4
2
|
/**
|
|
5
3
|
* Capabilities advertised by an auth provider.
|
|
6
4
|
* UI components use this to show/hide features dynamically
|
|
@@ -89,6 +87,8 @@ export interface AuthControllerExtended<USER extends User = User, ExtraData = un
|
|
|
89
87
|
code: string;
|
|
90
88
|
redirectUri: string;
|
|
91
89
|
}) => Promise<void>;
|
|
90
|
+
/** Generic OAuth login — works with any provider. Posts payload to /auth/{providerId}. */
|
|
91
|
+
oauthLogin?: (providerId: string, payload: Record<string, unknown>) => Promise<void>;
|
|
92
92
|
/** Register a new user */
|
|
93
93
|
register?(email: string, password: string, displayName?: string): Promise<void>;
|
|
94
94
|
/** Skip login (for anonymous access if enabled) */
|
|
@@ -102,25 +102,3 @@ export interface AuthControllerExtended<USER extends User = User, ExtraData = un
|
|
|
102
102
|
/** Update user profile */
|
|
103
103
|
updateProfile?(displayName?: string, photoURL?: string): Promise<USER>;
|
|
104
104
|
}
|
|
105
|
-
/**
|
|
106
|
-
* Implement this function to allow access to specific users.
|
|
107
|
-
* @group Hooks and utilities
|
|
108
|
-
*/
|
|
109
|
-
export type Authenticator<USER extends User = User> = (props: {
|
|
110
|
-
/**
|
|
111
|
-
* Logged-in user or null
|
|
112
|
-
*/
|
|
113
|
-
user: USER | null;
|
|
114
|
-
/**
|
|
115
|
-
* AuthController
|
|
116
|
-
*/
|
|
117
|
-
authController: AuthController<USER>;
|
|
118
|
-
/**
|
|
119
|
-
* Unified data access API
|
|
120
|
-
*/
|
|
121
|
-
data: RebaseData;
|
|
122
|
-
/**
|
|
123
|
-
* Used storage implementation
|
|
124
|
-
*/
|
|
125
|
-
storageSource: StorageSource;
|
|
126
|
-
}) => boolean | Promise<boolean>;
|
|
@@ -65,7 +65,6 @@ export interface AdminRole {
|
|
|
65
65
|
name: string;
|
|
66
66
|
isAdmin: boolean;
|
|
67
67
|
defaultPermissions: Record<string, unknown> | null;
|
|
68
|
-
config: Record<string, unknown> | null;
|
|
69
68
|
}
|
|
70
69
|
/**
|
|
71
70
|
* Client-side Admin API interface.
|
|
@@ -123,7 +122,6 @@ export interface AdminAPI {
|
|
|
123
122
|
name: string;
|
|
124
123
|
isAdmin?: boolean;
|
|
125
124
|
defaultPermissions?: Record<string, unknown>;
|
|
126
|
-
config?: Record<string, unknown>;
|
|
127
125
|
}): Promise<{
|
|
128
126
|
role: AdminRole;
|
|
129
127
|
}>;
|
|
@@ -131,7 +129,6 @@ export interface AdminAPI {
|
|
|
131
129
|
name?: string;
|
|
132
130
|
isAdmin?: boolean;
|
|
133
131
|
defaultPermissions?: Record<string, unknown>;
|
|
134
|
-
config?: Record<string, unknown>;
|
|
135
132
|
}): Promise<{
|
|
136
133
|
role: AdminRole;
|
|
137
134
|
}>;
|
|
@@ -4,7 +4,7 @@ import type { EntityReference } from "../types/entities";
|
|
|
4
4
|
* Controller that provides access to the registered entity collections.
|
|
5
5
|
* @group Models
|
|
6
6
|
*/
|
|
7
|
-
export type CollectionRegistryController<DB = Record<string, unknown>, EC extends EntityCollection = EntityCollection
|
|
7
|
+
export type CollectionRegistryController<DB = Record<string, unknown>, EC extends EntityCollection = EntityCollection> = {
|
|
8
8
|
/**
|
|
9
9
|
* List of the mapped collections in the CMS.
|
|
10
10
|
* Each entry relates to a collection in the root database.
|
|
@@ -76,6 +76,21 @@ export interface FindResponse<M extends Record<string, unknown> = Record<string,
|
|
|
76
76
|
hasMore: boolean;
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
|
+
export type FilterOperator = WhereFilterOpShort;
|
|
80
|
+
/**
|
|
81
|
+
* Fluent Query Builder Interface supported on both client and server accessors.
|
|
82
|
+
* @group Data
|
|
83
|
+
*/
|
|
84
|
+
export interface QueryBuilderInterface<M extends Record<string, unknown> = Record<string, unknown>> {
|
|
85
|
+
where(column: keyof M & string, operator: FilterOperator, value: unknown): this;
|
|
86
|
+
orderBy(column: keyof M & string, ascending?: "asc" | "desc"): this;
|
|
87
|
+
limit(count: number): this;
|
|
88
|
+
offset(count: number): this;
|
|
89
|
+
search(searchString: string): this;
|
|
90
|
+
include(...relations: string[]): this;
|
|
91
|
+
find(): Promise<FindResponse<M>>;
|
|
92
|
+
listen(onUpdate: (data: FindResponse<M>) => void, onError?: (error: Error) => void): () => void;
|
|
93
|
+
}
|
|
79
94
|
/**
|
|
80
95
|
* A single collection's CRUD accessor.
|
|
81
96
|
*
|
|
@@ -124,6 +139,12 @@ export interface CollectionAccessor<M extends Record<string, unknown> = Record<s
|
|
|
124
139
|
* Count the number of records matching the given filter.
|
|
125
140
|
*/
|
|
126
141
|
count?(params?: FindParams): Promise<number>;
|
|
142
|
+
where(column: keyof M & string, operator: FilterOperator, value: unknown): QueryBuilderInterface<M>;
|
|
143
|
+
orderBy(column: keyof M & string, ascending?: "asc" | "desc"): QueryBuilderInterface<M>;
|
|
144
|
+
limit(count: number): QueryBuilderInterface<M>;
|
|
145
|
+
offset(count: number): QueryBuilderInterface<M>;
|
|
146
|
+
search(searchString: string): QueryBuilderInterface<M>;
|
|
147
|
+
include(...relations: string[]): QueryBuilderInterface<M>;
|
|
127
148
|
}
|
|
128
149
|
/**
|
|
129
150
|
* The unified data access object.
|
|
@@ -17,6 +17,21 @@ export type ListenEntityProps<M extends Record<string, unknown> = Record<string,
|
|
|
17
17
|
onUpdate: (entity: Entity<M> | null) => void;
|
|
18
18
|
onError?: (error: Error) => void;
|
|
19
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Configuration for vector similarity search queries.
|
|
22
|
+
* Vector search applies an ORDER BY distance expression and optionally
|
|
23
|
+
* filters results by a distance threshold.
|
|
24
|
+
*/
|
|
25
|
+
export interface VectorSearchParams {
|
|
26
|
+
/** Property name containing the vector column */
|
|
27
|
+
property: string;
|
|
28
|
+
/** Query vector to compare against */
|
|
29
|
+
vector: number[];
|
|
30
|
+
/** Distance function (default: "cosine") */
|
|
31
|
+
distance?: "cosine" | "l2" | "inner_product";
|
|
32
|
+
/** Only return results within this distance threshold */
|
|
33
|
+
threshold?: number;
|
|
34
|
+
}
|
|
20
35
|
/**
|
|
21
36
|
* @internal
|
|
22
37
|
*/
|
|
@@ -30,6 +45,8 @@ export interface FetchCollectionProps<M extends Record<string, unknown> = Record
|
|
|
30
45
|
orderBy?: string;
|
|
31
46
|
searchString?: string;
|
|
32
47
|
order?: "desc" | "asc";
|
|
48
|
+
/** Vector similarity search configuration */
|
|
49
|
+
vectorSearch?: VectorSearchParams;
|
|
33
50
|
}
|
|
34
51
|
/**
|
|
35
52
|
* @internal
|
|
@@ -187,6 +204,7 @@ export interface RestFetchService {
|
|
|
187
204
|
startAfter?: Record<string, unknown>;
|
|
188
205
|
searchString?: string;
|
|
189
206
|
databaseId?: string;
|
|
207
|
+
vectorSearch?: VectorSearchParams;
|
|
190
208
|
}, include?: string[]): Promise<Record<string, unknown>[]>;
|
|
191
209
|
/**
|
|
192
210
|
* Fetch a single flattened entity with optional relation includes.
|
|
@@ -4,6 +4,7 @@ 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
6
|
import type { AppView, NavigationGroupMapping } from "./navigation";
|
|
7
|
+
import type { RebasePlugin } from "../types/plugins";
|
|
7
8
|
/**
|
|
8
9
|
* Options to enable the built-in collection editor.
|
|
9
10
|
* When provided to `<RebaseCMS>`, the editor is auto-wired as a native feature.
|
|
@@ -19,12 +20,12 @@ export interface CollectionEditorOptions {
|
|
|
19
20
|
/** Suggested base paths shown when creating new collections. */
|
|
20
21
|
pathSuggestions?: string[];
|
|
21
22
|
}
|
|
22
|
-
export interface RebaseCMSConfig<EC extends EntityCollection =
|
|
23
|
+
export interface RebaseCMSConfig<EC extends EntityCollection = EntityCollection> {
|
|
23
24
|
collections?: EC[] | EntityCollectionsBuilder<EC>;
|
|
24
25
|
homePage?: ReactNode;
|
|
25
|
-
entityViews?: EntityCustomView
|
|
26
|
+
entityViews?: EntityCustomView[];
|
|
26
27
|
entityActions?: EntityAction[];
|
|
27
|
-
plugins?:
|
|
28
|
+
plugins?: RebasePlugin[];
|
|
28
29
|
/**
|
|
29
30
|
* Centralized configuration for how collections and views are grouped
|
|
30
31
|
* in the navigation sidebar and home page.
|
|
@@ -42,7 +43,7 @@ export interface RebaseCMSConfig<EC extends EntityCollection = any> {
|
|
|
42
43
|
collectionEditor?: boolean | CollectionEditorOptions;
|
|
43
44
|
}
|
|
44
45
|
export interface RebaseStudioConfig {
|
|
45
|
-
tools?: ("sql" | "js" | "rls" | "schema" | "storage" | "cron" | "schema-visualizer" | "branches" | "api")[];
|
|
46
|
+
tools?: ("sql" | "js" | "rls" | "schema" | "storage" | "cron" | "schema-visualizer" | "branches" | "api" | "logs")[];
|
|
46
47
|
homePage?: ReactNode;
|
|
47
48
|
devViews?: AppView[];
|
|
48
49
|
}
|
|
@@ -28,7 +28,7 @@ export type RebaseCallContext<USER extends User = User> = {
|
|
|
28
28
|
* const { client } = props.context;
|
|
29
29
|
* const result = await client.functions.invoke('extract-job', { url });
|
|
30
30
|
*/
|
|
31
|
-
client: RebaseClient
|
|
31
|
+
client: RebaseClient;
|
|
32
32
|
/**
|
|
33
33
|
* Unified data access — `context.data.products.create(...)`.
|
|
34
34
|
* Access any collection as a dynamic property.
|
|
@@ -133,7 +133,7 @@ export interface AuthUserData {
|
|
|
133
133
|
displayName?: string | null;
|
|
134
134
|
photoUrl?: string | null;
|
|
135
135
|
emailVerified?: boolean;
|
|
136
|
-
metadata?: Record<string,
|
|
136
|
+
metadata?: Record<string, unknown>;
|
|
137
137
|
createdAt?: Date;
|
|
138
138
|
updatedAt?: Date;
|
|
139
139
|
}
|
|
@@ -146,7 +146,7 @@ export interface AuthCreateUserData {
|
|
|
146
146
|
password?: string;
|
|
147
147
|
displayName?: string;
|
|
148
148
|
photoUrl?: string;
|
|
149
|
-
metadata?: Record<string,
|
|
149
|
+
metadata?: Record<string, unknown>;
|
|
150
150
|
}
|
|
151
151
|
/**
|
|
152
152
|
* Role data exposed by the auth adapter.
|
|
@@ -168,7 +168,6 @@ export interface AuthRoleData {
|
|
|
168
168
|
edit?: boolean;
|
|
169
169
|
delete?: boolean;
|
|
170
170
|
}> | null;
|
|
171
|
-
config?: Record<string, unknown> | null;
|
|
172
171
|
}
|
|
173
172
|
/**
|
|
174
173
|
* Data for creating a role.
|
|
@@ -180,7 +179,6 @@ export interface AuthCreateRoleData {
|
|
|
180
179
|
isAdmin?: boolean;
|
|
181
180
|
defaultPermissions?: AuthRoleData["defaultPermissions"];
|
|
182
181
|
collectionPermissions?: AuthRoleData["collectionPermissions"];
|
|
183
|
-
config?: AuthRoleData["config"];
|
|
184
182
|
}
|
|
185
183
|
/**
|
|
186
184
|
* User management operations for the admin panel.
|
|
@@ -589,10 +589,6 @@ export interface FilterPreset<Key extends string = string> {
|
|
|
589
589
|
*/
|
|
590
590
|
sort?: [Key, "asc" | "desc"];
|
|
591
591
|
}
|
|
592
|
-
/**
|
|
593
|
-
* @deprecated Use {@link FilterPreset} instead.
|
|
594
|
-
*/
|
|
595
|
-
export type QuickFilter<Key extends string = string> = FilterPreset<Key>;
|
|
596
592
|
/**
|
|
597
593
|
* Used to indicate valid filter combinations (e.g. created in Firestore)
|
|
598
594
|
* If the user selects a specific filter/sort combination, the CMS checks if it's
|
|
@@ -37,7 +37,7 @@ export interface LazyComponentRef<P = unknown> {
|
|
|
37
37
|
*
|
|
38
38
|
* @group Types
|
|
39
39
|
*/
|
|
40
|
-
export type ComponentRef<P =
|
|
40
|
+
export type ComponentRef<P = any> = React.ComponentType<P> | LazyComponentRef<P> | (() => Promise<{
|
|
41
41
|
default: React.ComponentType<P>;
|
|
42
42
|
}>) | string;
|
|
43
43
|
/**
|
|
@@ -44,7 +44,7 @@ export interface CronJobContext {
|
|
|
44
44
|
/** A simple logger scoped to this job run. */
|
|
45
45
|
log: (...args: unknown[]) => void;
|
|
46
46
|
/** The RebaseClient instance to interact with the database. */
|
|
47
|
-
client: RebaseClient
|
|
47
|
+
client: RebaseClient;
|
|
48
48
|
}
|
|
49
49
|
export type CronJobRunState = "idle" | "running" | "success" | "error" | "disabled";
|
|
50
50
|
/**
|
|
@@ -50,6 +50,7 @@ export interface FormContext<M extends Record<string, unknown> = Record<string,
|
|
|
50
50
|
export type EntityCustomView<M extends Record<string, unknown> = Record<string, unknown>> = {
|
|
51
51
|
key: string;
|
|
52
52
|
name: string;
|
|
53
|
+
icon?: string | React.ReactNode;
|
|
53
54
|
tabComponent?: React.ReactNode;
|
|
54
55
|
includeActions?: boolean | "bottom";
|
|
55
56
|
Builder?: ComponentRef<EntityCustomViewParams<M>>;
|
|
@@ -15,7 +15,7 @@ export interface ExportConfig<USER extends User = User> {
|
|
|
15
15
|
export interface ExportMappingFunction<USER extends User = User> {
|
|
16
16
|
key: string;
|
|
17
17
|
builder: ({ entity, context }: {
|
|
18
|
-
entity: Entity
|
|
18
|
+
entity: Entity;
|
|
19
19
|
context: RebaseContext<USER>;
|
|
20
20
|
}) => Promise<string> | string;
|
|
21
21
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { FormEvent } from "react";
|
|
2
|
-
export type FormexController<T =
|
|
2
|
+
export type FormexController<T = unknown> = {
|
|
3
3
|
values: T;
|
|
4
4
|
initialValues: T;
|
|
5
5
|
setValues: (values: T) => void;
|
|
@@ -32,7 +32,7 @@ export type FormexController<T = any> = {
|
|
|
32
32
|
canUndo: boolean;
|
|
33
33
|
canRedo: boolean;
|
|
34
34
|
};
|
|
35
|
-
export type FormexResetProps<T =
|
|
35
|
+
export type FormexResetProps<T = unknown> = {
|
|
36
36
|
values?: T;
|
|
37
37
|
submitCount?: number;
|
|
38
38
|
errors?: Record<string, string>;
|
|
@@ -104,8 +104,8 @@ export interface BaseUIConfig<CustomProps = unknown> {
|
|
|
104
104
|
disabled?: boolean | PropertyDisabledConfig;
|
|
105
105
|
widthPercentage?: number;
|
|
106
106
|
customProps?: CustomProps;
|
|
107
|
-
Field?: ComponentRef
|
|
108
|
-
Preview?: ComponentRef
|
|
107
|
+
Field?: ComponentRef;
|
|
108
|
+
Preview?: ComponentRef;
|
|
109
109
|
}
|
|
110
110
|
export interface BaseProperty<CustomProps = unknown> {
|
|
111
111
|
ui?: BaseUIConfig<CustomProps>;
|