@ekanos/sdk 0.26.0 → 0.28.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/README.md CHANGED
@@ -175,7 +175,7 @@ structurally un-settable rather than merely absent from the type. You cannot
175
175
  declare a `productId`, a `kind`, a trust tier, a `credentialModel`, or per-tool
176
176
  `effect`/`sensitivity` — the closest you get is [`proposes`](#proposes). Widget
177
177
  fields the platform populates at runtime (`productId`, `widgetConfigId`,
178
- `workspaceId`, `collapsed`, `isPinned`, `health`, `integrationMetadata`) are
178
+ `workspaceId`, `isPinned`, `health`, `integrationMetadata`) are
179
179
  rejected the same way.
180
180
 
181
181
  ## The capability context (`ctx`)
@@ -583,7 +583,6 @@ components: {
583
583
  name: 'Acme Payments',
584
584
  component: AcmePaymentsSummaryWidget,
585
585
  widgetState: 'active', // 'active' | 'inactive' | 'disabled'
586
- isCollapsible: true,
587
586
  isPinnable: false,
588
587
  aiFooterEnabled: true, // renders the "Ask about this" footer
589
588
  layouts: {
@@ -21,13 +21,13 @@ export function BaseMarketplaceTile(props) {
21
21
  const displayTitle = name || 'Unknown Product';
22
22
  const displaySummary = summary;
23
23
  const displayBrandName = brandName || displayTitle;
24
- const cardContent = (_jsxs(Card, { className: cn('group bg-card hover:bg-muted/40 relative flex h-full w-full cursor-pointer flex-col overflow-hidden border-0 pt-3 pb-2 shadow-sm transition-colors duration-(--duration-colour)', className), children: [_jsxs(CardHeader, { className: "flex flex-col items-center pt-6 pb-3 text-center", children: [_jsx("div", { className: "mb-3", children: logoPath ? (_jsxs("div", { className: "flex h-16 w-16 items-center justify-center", children: [_jsx("img", { src: logoPath, alt: `${displayBrandName} logo`, width: 64, height: 64, className: "max-h-full max-w-full object-contain", onError: (e) => {
24
+ const cardContent = (_jsxs(Card, { interactive: true, className: cn('group relative flex h-full w-full cursor-pointer flex-col overflow-hidden pt-3 pb-2', className), children: [_jsxs(CardHeader, { className: "flex flex-col items-center pt-6 pb-3 text-center", children: [_jsx("div", { className: "mb-3", children: logoPath ? (_jsxs("div", { className: "flex h-16 w-16 items-center justify-center", children: [_jsx("img", { src: logoPath, alt: `${displayBrandName} logo`, width: 64, height: 64, className: "max-h-full max-w-full object-contain", onError: (e) => {
25
25
  const target = e.target;
26
26
  target.style.display = 'none';
27
27
  if (target.nextSibling) {
28
28
  target.nextSibling.style.display = 'flex';
29
29
  }
30
- } }), _jsx("div", { className: "bg-border ring-border font-heading font-heading-semibold hidden h-full w-full items-center justify-center rounded-lg text-2xl tracking-tight ring-1", children: displayBrandName.charAt(0).toUpperCase() })] })) : (_jsx("div", { className: "bg-border ring-border font-heading font-heading-semibold flex h-16 w-16 items-center justify-center rounded-lg border-2 text-2xl tracking-tight ring-1", children: displayBrandName.charAt(0).toUpperCase() })) }), _jsx(CardTitle, { className: "font-heading font-heading-semibold line-clamp-2 text-xl", children: displayTitle }), _jsx(If, { condition: categories.length > 0, children: _jsxs("div", { className: "mt-2 flex flex-wrap justify-center gap-1", children: [categories.slice(0, 2).map((cat) => (_jsx(CategoryChip, { productColor: productColor, children: cat.name }, cat.id))), _jsx(If, { condition: categories.length > 2, children: _jsxs(CategoryChip, { productColor: productColor, children: ["+", categories.length - 2] }) })] }) })] }), _jsx(CardContent, { className: "flex-1 pb-8 text-center", children: _jsx(If, { condition: displaySummary, children: _jsx(CardDescription, { className: "text-muted-foreground line-clamp-2 text-base leading-relaxed", children: displaySummary }) }) }), _jsx(If, { condition: displayBrandName !== displayTitle, children: _jsx("p", { className: "text-muted-foreground/70 absolute right-3 bottom-3 text-sm", children: displayBrandName }) }), _jsx(If, { condition: !!ctaLink, children: _jsx("div", { className: "text-muted-foreground group-hover:text-foreground absolute bottom-3 left-3 transition-colors", "aria-hidden": "true", children: _jsx(Icon, { name: "arrow-square-out", className: "h-4 w-4" }) }) })] }));
30
+ } }), _jsx("div", { className: "bg-border ring-border font-heading font-heading-semibold hidden h-full w-full items-center justify-center rounded-lg text-2xl tracking-tight ring-1", children: displayBrandName.charAt(0).toUpperCase() })] })) : (_jsx("div", { className: "bg-border ring-border font-heading font-heading-semibold flex h-16 w-16 items-center justify-center rounded-lg border-2 text-2xl tracking-tight ring-1", children: displayBrandName.charAt(0).toUpperCase() })) }), _jsx(CardTitle, { className: "font-heading font-heading-semibold line-clamp-2 text-xl", children: displayTitle }), _jsx(If, { condition: categories.length > 0, children: _jsxs("div", { className: "mt-2 flex flex-wrap justify-center gap-1", children: [categories.slice(0, 2).map((cat) => (_jsx(CategoryChip, { productColor: productColor, children: cat.name }, cat.id))), _jsx(If, { condition: categories.length > 2, children: _jsxs(CategoryChip, { productColor: productColor, children: ["+", categories.length - 2] }) })] }) })] }), _jsx(CardContent, { className: "flex-1 pb-8 text-center", children: _jsx(If, { condition: displaySummary, children: _jsx(CardDescription, { className: "text-muted-foreground line-clamp-2 text-base leading-relaxed", children: displaySummary }) }) }), _jsx(If, { condition: displayBrandName !== displayTitle, children: _jsx("p", { className: "text-muted-foreground absolute right-3 bottom-3 text-sm", children: displayBrandName }) }), _jsx(If, { condition: !!ctaLink, children: _jsx("div", { className: "text-muted-foreground group-hover:text-foreground absolute bottom-3 left-3 transition-colors", "aria-hidden": "true", children: _jsx(Icon, { name: "arrow-square-out", className: "h-4 w-4" }) }) })] }));
31
31
  // External link: opens in new tab
32
32
  if (ctaLink) {
33
33
  return (_jsx("a", { href: ctaLink, target: "_blank", rel: "noopener noreferrer", className: "block h-full", "aria-label": `${displayTitle} (opens in new tab)`, children: cardContent }));
@@ -1 +1 @@
1
- {"version":3,"file":"base-marketplace-tile.js","sourceRoot":"","sources":["../../src/components/base-marketplace-tile.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAIb,yEAAyE;AACzE,8EAA8E;AAC9E,4EAA4E;AAC5E,+EAA+E;AAC/E,+EAA+E;AAC/E,8EAA8E;AAC9E,8EAA8E;AAC9E,6EAA6E;AAC7E,4EAA4E;AAC5E,+EAA+E;AAC/E,+EAA+E;AAC/E,OAAO,IAAI,M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AC,SAAS,EAAC,SAAS,GAAG,GAChD,GACH,IACA,CACR,CAAC;IAEF,kCAAkC;IAClC,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CACL,YACE,IAAI,EAAE,OAAO,EACb,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,EACzB,SAAS,EAAC,cAAc,gBACZ,GAAG,YAAY,qBAAqB,YAE/C,WAAW,GACV,CACL,CAAC;IACJ,CAAC;IAED,mCAAmC;IACnC,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,CACL,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAC,cAAc,YACvC,WAAW,GACP,CACR,CAAC;IACJ,CAAC;IAED,8DAA8D;IAC9D,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;;;;GAKG;AACH,SAAS,YAAY,CAAC,EACpB,YAAY,EACZ,QAAQ,GAIT;IACC,OAAO,CACL,eACE,SAAS,EAAE,EAAE,CACX,uKAAuK,EACvK,YAAY,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,cAAc,CAC1D,EACD,KAAK,EACH,YAAY;YACV,CAAC,CAAE,EAAE,iBAAiB,EAAE,YAAY,EAAoB;YACxD,CAAC,CAAC,SAAS,YAGd,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport type { CSSProperties, ReactNode } from 'react';\n\n// `next/link.js`, not `next/link`. `next` ships no `exports` map, so the\n// extensionless subpath only resolves under a bundler — Node's own ESM loader\n// throws ERR_MODULE_NOT_FOUND, and any partner running vitest or plain Node\n// against the published tarball loses this whole module. The `.js` form is not\n// a bypass of Next's resolution: `create-compiler-aliases.js` keys its aliases\n// on the RESOLVED FILE PATH (`<next>/link.js`, with the comment \"Handle fully\n// specified imports like `next/image.js`\"), so an App Router build still gets\n// `next/dist/client/app-dir/link`, exactly as `next/link` would. Next's dist\n// also ends with `Object.assign(exports.default, exports); module.exports =\n// exports.default`, so Node's CJS-default interop and a bundler's `__esModule`\n// interop land on the same component object. Do not \"tidy\" the extension away.\nimport Link from 'next/link.js';\n\nimport {\n Card,\n CardContent,\n CardDescription,\n CardHeader,\n CardTitle,\n} from '@ekanos/ui/card';\nimport { Icon } from '@ekanos/ui/icon';\nimport { If } from '@ekanos/ui/if';\nimport { cn } from '@ekanos/ui/utils';\n\nimport type { MarketplaceTileProps } from '../types/integration';\n\n// Type for product category\nexport interface ProductCategory {\n id: string;\n name: string;\n slug: string;\n description?: string;\n}\n\nexport type BaseMarketplaceTileProps = MarketplaceTileProps & {\n /** The display name of the product */\n name: string;\n /** Full description of the product (used for detail pages) */\n description: string;\n /** URL-friendly identifier for the product */\n slug: string;\n /** Short summary text displayed on the tile (1-2 sentences) */\n summary?: string;\n /** Name of the company/brand that provides this product */\n brandName?: string;\n /** Path to the product logo image */\n logoPath?: string;\n /** Text for the call-to-action button */\n ctaText?: string;\n /** External URL for the CTA (opens in new tab when set) */\n ctaLink?: string;\n\n /** Array of categories this product belongs to */\n categories?: ProductCategory[];\n\n /** Hex color from product schema for tile theming */\n productColor?: string;\n /** Additional CSS classes to apply to the tile */\n className?: string;\n\n /** Internal navigation URL for the integration detail page */\n href?: string;\n};\n\nexport function BaseMarketplaceTile(props: BaseMarketplaceTileProps) {\n const {\n name,\n summary,\n brandName,\n logoPath,\n categories = [],\n productColor,\n className,\n href,\n ctaLink,\n } = props;\n\n const displayTitle = name || 'Unknown Product';\n const displaySummary = summary;\n const displayBrandName = brandName || displayTitle;\n\n const cardContent = (\n <Card\n className={cn(\n 'group bg-card hover:bg-muted/40 relative flex h-full w-full cursor-pointer flex-col overflow-hidden border-0 pt-3 pb-2 shadow-sm transition-colors duration-(--duration-colour)',\n className,\n )}\n >\n {/* Header: Centered Logo, Title, Categories */}\n <CardHeader className=\"flex flex-col items-center pt-6 pb-3 text-center\">\n {/* Logo */}\n <div className=\"mb-3\">\n {logoPath ? (\n <div className=\"flex h-16 w-16 items-center justify-center\">\n {/* eslint-disable-next-line @next/next/no-img-element */}\n <img\n src={logoPath}\n alt={`${displayBrandName} logo`}\n width={64}\n height={64}\n className=\"max-h-full max-w-full object-contain\"\n onError={(e) => {\n const target = e.target as HTMLImageElement;\n target.style.display = 'none';\n if (target.nextSibling) {\n (target.nextSibling as HTMLElement).style.display = 'flex';\n }\n }}\n />\n <div className=\"bg-border ring-border font-heading font-heading-semibold hidden h-full w-full items-center justify-center rounded-lg text-2xl tracking-tight ring-1\">\n {displayBrandName.charAt(0).toUpperCase()}\n </div>\n </div>\n ) : (\n <div className=\"bg-border ring-border font-heading font-heading-semibold flex h-16 w-16 items-center justify-center rounded-lg border-2 text-2xl tracking-tight ring-1\">\n {displayBrandName.charAt(0).toUpperCase()}\n </div>\n )}\n </div>\n\n {/* Title */}\n <CardTitle className=\"font-heading font-heading-semibold line-clamp-2 text-xl\">\n {displayTitle}\n </CardTitle>\n\n {/* Category Badges - Under Title */}\n <If condition={categories.length > 0}>\n <div className=\"mt-2 flex flex-wrap justify-center gap-1\">\n {categories.slice(0, 2).map((cat) => (\n <CategoryChip key={cat.id} productColor={productColor}>\n {cat.name}\n </CategoryChip>\n ))}\n <If condition={categories.length > 2}>\n <CategoryChip productColor={productColor}>\n +{categories.length - 2}\n </CategoryChip>\n </If>\n </div>\n </If>\n </CardHeader>\n\n {/* Content: Summary */}\n <CardContent className=\"flex-1 pb-8 text-center\">\n <If condition={displaySummary}>\n <CardDescription className=\"text-muted-foreground line-clamp-2 text-base leading-relaxed\">\n {displaySummary}\n </CardDescription>\n </If>\n </CardContent>\n\n {/* Brand Name - Bottom Right */}\n <If condition={displayBrandName !== displayTitle}>\n <p className=\"text-muted-foreground/70 absolute right-3 bottom-3 text-sm\">\n {displayBrandName}\n </p>\n </If>\n\n {/* External Link Indicator */}\n <If condition={!!ctaLink}>\n <div\n className=\"text-muted-foreground group-hover:text-foreground absolute bottom-3 left-3 transition-colors\"\n aria-hidden=\"true\"\n >\n <Icon name=\"arrow-square-out\" className=\"h-4 w-4\" />\n </div>\n </If>\n </Card>\n );\n\n // External link: opens in new tab\n if (ctaLink) {\n return (\n <a\n href={ctaLink}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"block h-full\"\n aria-label={`${displayTitle} (opens in new tab)`}\n >\n {cardContent}\n </a>\n );\n }\n\n // Internal link: uses Next.js Link\n if (href) {\n return (\n <Link href={href} className=\"block h-full\">\n {cardContent}\n </Link>\n );\n }\n\n // Fallback: render without Link (for backwards compatibility)\n return cardContent;\n}\n\n/**\n * A category chip, tinted with the product's own colour when it has one. The\n * colour is a partner's product colour from the product schema, not a theme\n * token — a data colour, so it is a chip rather than a `Badge` (a Badge owns\n * its colour). The tint is that colour at 40% alpha.\n */\nfunction CategoryChip({\n productColor,\n children,\n}: {\n productColor?: string;\n children: ReactNode;\n}) {\n return (\n <span\n className={cn(\n 'text-secondary-foreground inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full px-2 py-0.5 text-xs font-medium whitespace-nowrap',\n productColor ? 'bg-(--product-color)/40' : 'bg-secondary',\n )}\n style={\n productColor\n ? ({ '--product-color': productColor } as CSSProperties)\n : undefined\n }\n >\n {children}\n </span>\n );\n}\n"]}
1
+ {"version":3,"file":"base-marketplace-tile.js","sourceRoot":"","sources":["../../src/components/base-marketplace-tile.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAIb,yEAAyE;AACzE,8EAA8E;AAC9E,4EAA4E;AAC5E,+EAA+E;AAC/E,+EAA+E;AAC/E,8EAA8E;AAC9E,8EAA8E;AAC9E,6EAA6E;AAC7E,4EAA4E;AAC5E,+EAA+E;AAC/E,+EAA+E;AAC/E,OAAO,IAAI,MAAM,cAAc,CAAC;AAEhC,OAAO,EACL,IAAI,EACJ,WAAW,EACX,eAAe,EACf,UAAU,EACV,SAAS,GACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,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,SAAS,EAAC,cAAc,gBACZ,GAAG,YAAY,qBAAqB,YAE/C,WAAW,GACV,CACL,CAAC;IACJ,CAAC;IAED,mCAAmC;IACnC,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,CACL,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAC,cAAc,YACvC,WAAW,GACP,CACR,CAAC;IACJ,CAAC;IAED,8DAA8D;IAC9D,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;;;;GAKG;AACH,SAAS,YAAY,CAAC,EACpB,YAAY,EACZ,QAAQ,GAIT;IACC,OAAO,CACL,eACE,SAAS,EAAE,EAAE,CACX,uKAAuK,EACvK,YAAY,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,cAAc,CAC1D,EACD,KAAK,EACH,YAAY;YACV,CAAC,CAAE,EAAE,iBAAiB,EAAE,YAAY,EAAoB;YACxD,CAAC,CAAC,SAAS,YAGd,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport type { CSSProperties, ReactNode } from 'react';\n\n// `next/link.js`, not `next/link`. `next` ships no `exports` map, so the\n// extensionless subpath only resolves under a bundler — Node's own ESM loader\n// throws ERR_MODULE_NOT_FOUND, and any partner running vitest or plain Node\n// against the published tarball loses this whole module. The `.js` form is not\n// a bypass of Next's resolution: `create-compiler-aliases.js` keys its aliases\n// on the RESOLVED FILE PATH (`<next>/link.js`, with the comment \"Handle fully\n// specified imports like `next/image.js`\"), so an App Router build still gets\n// `next/dist/client/app-dir/link`, exactly as `next/link` would. Next's dist\n// also ends with `Object.assign(exports.default, exports); module.exports =\n// exports.default`, so Node's CJS-default interop and a bundler's `__esModule`\n// interop land on the same component object. Do not \"tidy\" the extension away.\nimport Link from 'next/link.js';\n\nimport {\n Card,\n CardContent,\n CardDescription,\n CardHeader,\n CardTitle,\n} from '@ekanos/ui/card';\nimport { Icon } from '@ekanos/ui/icon';\nimport { If } from '@ekanos/ui/if';\nimport { cn } from '@ekanos/ui/utils';\n\nimport type { MarketplaceTileProps } from '../types/integration';\n\n// Type for product category\nexport interface ProductCategory {\n id: string;\n name: string;\n slug: string;\n description?: string;\n}\n\nexport type BaseMarketplaceTileProps = MarketplaceTileProps & {\n /** The display name of the product */\n name: string;\n /** Full description of the product (used for detail pages) */\n description: string;\n /** URL-friendly identifier for the product */\n slug: string;\n /** Short summary text displayed on the tile (1-2 sentences) */\n summary?: string;\n /** Name of the company/brand that provides this product */\n brandName?: string;\n /** Path to the product logo image */\n logoPath?: string;\n /** Text for the call-to-action button */\n ctaText?: string;\n /** External URL for the CTA (opens in new tab when set) */\n ctaLink?: string;\n\n /** Array of categories this product belongs to */\n categories?: ProductCategory[];\n\n /** Hex color from product schema for tile theming */\n productColor?: string;\n /** Additional CSS classes to apply to the tile */\n className?: string;\n\n /** Internal navigation URL for the integration detail page */\n href?: string;\n};\n\nexport function BaseMarketplaceTile(props: BaseMarketplaceTileProps) {\n const {\n name,\n summary,\n brandName,\n logoPath,\n categories = [],\n productColor,\n className,\n href,\n ctaLink,\n } = props;\n\n const displayTitle = name || 'Unknown Product';\n const displaySummary = summary;\n const displayBrandName = brandName || displayTitle;\n\n const cardContent = (\n <Card\n interactive\n className={cn(\n 'group relative flex h-full w-full cursor-pointer flex-col overflow-hidden pt-3 pb-2',\n className,\n )}\n >\n {/* Header: Centered Logo, Title, Categories */}\n <CardHeader className=\"flex flex-col items-center pt-6 pb-3 text-center\">\n {/* Logo */}\n <div className=\"mb-3\">\n {logoPath ? (\n <div className=\"flex h-16 w-16 items-center justify-center\">\n {/* eslint-disable-next-line @next/next/no-img-element */}\n <img\n src={logoPath}\n alt={`${displayBrandName} logo`}\n width={64}\n height={64}\n className=\"max-h-full max-w-full object-contain\"\n onError={(e) => {\n const target = e.target as HTMLImageElement;\n target.style.display = 'none';\n if (target.nextSibling) {\n (target.nextSibling as HTMLElement).style.display = 'flex';\n }\n }}\n />\n <div className=\"bg-border ring-border font-heading font-heading-semibold hidden h-full w-full items-center justify-center rounded-lg text-2xl tracking-tight ring-1\">\n {displayBrandName.charAt(0).toUpperCase()}\n </div>\n </div>\n ) : (\n <div className=\"bg-border ring-border font-heading font-heading-semibold flex h-16 w-16 items-center justify-center rounded-lg border-2 text-2xl tracking-tight ring-1\">\n {displayBrandName.charAt(0).toUpperCase()}\n </div>\n )}\n </div>\n\n {/* Title */}\n <CardTitle className=\"font-heading font-heading-semibold line-clamp-2 text-xl\">\n {displayTitle}\n </CardTitle>\n\n {/* Category Badges - Under Title */}\n <If condition={categories.length > 0}>\n <div className=\"mt-2 flex flex-wrap justify-center gap-1\">\n {categories.slice(0, 2).map((cat) => (\n <CategoryChip key={cat.id} productColor={productColor}>\n {cat.name}\n </CategoryChip>\n ))}\n <If condition={categories.length > 2}>\n <CategoryChip productColor={productColor}>\n +{categories.length - 2}\n </CategoryChip>\n </If>\n </div>\n </If>\n </CardHeader>\n\n {/* Content: Summary */}\n <CardContent className=\"flex-1 pb-8 text-center\">\n <If condition={displaySummary}>\n <CardDescription className=\"text-muted-foreground line-clamp-2 text-base leading-relaxed\">\n {displaySummary}\n </CardDescription>\n </If>\n </CardContent>\n\n {/* Brand Name - Bottom Right */}\n <If condition={displayBrandName !== displayTitle}>\n <p className=\"text-muted-foreground absolute right-3 bottom-3 text-sm\">\n {displayBrandName}\n </p>\n </If>\n\n {/* External Link Indicator */}\n <If condition={!!ctaLink}>\n <div\n className=\"text-muted-foreground group-hover:text-foreground absolute bottom-3 left-3 transition-colors\"\n aria-hidden=\"true\"\n >\n <Icon name=\"arrow-square-out\" className=\"h-4 w-4\" />\n </div>\n </If>\n </Card>\n );\n\n // External link: opens in new tab\n if (ctaLink) {\n return (\n <a\n href={ctaLink}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"block h-full\"\n aria-label={`${displayTitle} (opens in new tab)`}\n >\n {cardContent}\n </a>\n );\n }\n\n // Internal link: uses Next.js Link\n if (href) {\n return (\n <Link href={href} className=\"block h-full\">\n {cardContent}\n </Link>\n );\n }\n\n // Fallback: render without Link (for backwards compatibility)\n return cardContent;\n}\n\n/**\n * A category chip, tinted with the product's own colour when it has one. The\n * colour is a partner's product colour from the product schema, not a theme\n * token — a data colour, so it is a chip rather than a `Badge` (a Badge owns\n * its colour). The tint is that colour at 40% alpha.\n */\nfunction CategoryChip({\n productColor,\n children,\n}: {\n productColor?: string;\n children: ReactNode;\n}) {\n return (\n <span\n className={cn(\n 'text-secondary-foreground inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full px-2 py-0.5 text-xs font-medium whitespace-nowrap',\n productColor ? 'bg-(--product-color)/40' : 'bg-secondary',\n )}\n style={\n productColor\n ? ({ '--product-color': productColor } as CSSProperties)\n : undefined\n }\n >\n {children}\n </span>\n );\n}\n"]}
@@ -3,13 +3,10 @@ import type { WidgetVerdict } from '../../types/widget-verdict.js';
3
3
  export type WidgetRenderState = 'active' | 'disabled' | 'loading' | 'error' | 'inactive';
4
4
  export interface WidgetState {
5
5
  state: WidgetRenderState;
6
- collapsed: boolean;
7
6
  pinned: boolean;
8
- pendingCollapse: boolean;
9
7
  pendingPin: boolean;
10
8
  }
11
9
  export interface WidgetActions {
12
- toggleCollapsed: () => void;
13
10
  togglePinned: () => void;
14
11
  }
15
12
  export interface WidgetHealth {
@@ -23,7 +20,6 @@ export interface WidgetMeta {
23
20
  subtitle?: string;
24
21
  description?: string;
25
22
  maxContentHeight?: string;
26
- isCollapsible: boolean;
27
23
  isPinnable: boolean;
28
24
  askContext?: WidgetAskContext;
29
25
  aiFooterEnabled: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"widget-context.js","sourceRoot":"","sources":["../../../src/components/widgets/widget-context.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AA2FtC,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAA4B,IAAI,CAAC,CAAC","sourcesContent":["'use client';\n\nimport { createContext } from 'react';\n\nimport type { WidgetAskContext } from '../../types/widget-ask-context';\nimport type { WidgetVerdict } from '../../types/widget-verdict';\n\nexport type WidgetRenderState =\n | 'active'\n | 'disabled'\n | 'loading'\n | 'error'\n | 'inactive';\n\nexport interface WidgetState {\n state: WidgetRenderState;\n collapsed: boolean;\n pinned: boolean;\n pendingCollapse: boolean;\n pendingPin: boolean;\n}\n\nexport interface WidgetActions {\n toggleCollapsed: () => void;\n togglePinned: () => void;\n}\n\nexport interface WidgetHealth {\n status: 'healthy' | 'degraded' | 'unhealthy' | 'unknown';\n lastSuccessAt?: string | null;\n errorMessage?: string | null;\n}\n\nexport interface WidgetMeta {\n widgetId: string;\n title?: string;\n subtitle?: string;\n description?: string;\n maxContentHeight?: string;\n isCollapsible: boolean;\n isPinnable: boolean;\n askContext?: WidgetAskContext;\n aiFooterEnabled: boolean;\n className?: string;\n /** Integration health for this widget's product, if known. */\n health?: WidgetHealth;\n /**\n * Where the widget's full surface lives, e.g. the workspace a pinned widget\n * came from. Set by the host only where following it leaves the current\n * page; the header menu shows \"Open in workspace\" when present.\n */\n openHref?: string;\n /**\n * Whose data the widget shows: the integration's name and bundled logo.\n * `Widget.Header` draws the logo left of the title (the design system's widget rules).\n */\n source?: WidgetSource;\n}\n\nexport interface WidgetSource {\n name: string;\n /** A logo URL; the header shows the name's first letter without one. */\n logoPath?: string;\n}\n\n/**\n * What the widget's own data layer reports through `Widget.DataState`. The\n * host cannot see a widget's queries, so every field is opt-in: the header\n * menu's Refresh, the error view's Try again, and the \"Updated …\" footer each\n * appear only when the widget supplies what they need.\n */\nexport interface WidgetData {\n /** Epoch milliseconds of the last successful load; absent when unknown. */\n updatedAt?: number;\n /** A reload is in flight while data is already on screen. */\n refreshing: boolean;\n /** Reloads the widget's data. */\n refresh?: () => void;\n /**\n * The widget's own conclusion about its data (the design system's widget rules): the\n * header shows it in place of the context line, and the \"Ask about this\"\n * snapshot carries it.\n */\n verdict?: WidgetVerdict;\n}\n\nexport interface WidgetContextValue {\n state: WidgetState;\n actions: WidgetActions;\n meta: WidgetMeta;\n data?: WidgetData;\n}\n\nexport const WidgetContext = createContext<WidgetContextValue | null>(null);\n"]}
1
+ {"version":3,"file":"widget-context.js","sourceRoot":"","sources":["../../../src/components/widgets/widget-context.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAuFtC,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAA4B,IAAI,CAAC,CAAC","sourcesContent":["'use client';\n\nimport { createContext } from 'react';\n\nimport type { WidgetAskContext } from '../../types/widget-ask-context';\nimport type { WidgetVerdict } from '../../types/widget-verdict';\n\nexport type WidgetRenderState =\n | 'active'\n | 'disabled'\n | 'loading'\n | 'error'\n | 'inactive';\n\nexport interface WidgetState {\n state: WidgetRenderState;\n pinned: boolean;\n pendingPin: boolean;\n}\n\nexport interface WidgetActions {\n togglePinned: () => void;\n}\n\nexport interface WidgetHealth {\n status: 'healthy' | 'degraded' | 'unhealthy' | 'unknown';\n lastSuccessAt?: string | null;\n errorMessage?: string | null;\n}\n\nexport interface WidgetMeta {\n widgetId: string;\n title?: string;\n subtitle?: string;\n description?: string;\n maxContentHeight?: string;\n isPinnable: boolean;\n askContext?: WidgetAskContext;\n aiFooterEnabled: boolean;\n className?: string;\n /** Integration health for this widget's product, if known. */\n health?: WidgetHealth;\n /**\n * Where the widget's full surface lives, e.g. the workspace a pinned widget\n * came from. Set by the host only where following it leaves the current\n * page; the header menu shows \"Open in workspace\" when present.\n */\n openHref?: string;\n /**\n * Whose data the widget shows: the integration's name and bundled logo.\n * `Widget.Header` draws the logo left of the title (the design system's widget rules).\n */\n source?: WidgetSource;\n}\n\nexport interface WidgetSource {\n name: string;\n /** A logo URL; the header shows the name's first letter without one. */\n logoPath?: string;\n}\n\n/**\n * What the widget's own data layer reports through `Widget.DataState`. The\n * host cannot see a widget's queries, so every field is opt-in: the header\n * menu's Refresh, the error view's Try again, and the \"Updated …\" footer each\n * appear only when the widget supplies what they need.\n */\nexport interface WidgetData {\n /** Epoch milliseconds of the last successful load; absent when unknown. */\n updatedAt?: number;\n /** A reload is in flight while data is already on screen. */\n refreshing: boolean;\n /** Reloads the widget's data. */\n refresh?: () => void;\n /**\n * The widget's own conclusion about its data (the design system's widget rules): the\n * header shows it in place of the context line, and the \"Ask about this\"\n * snapshot carries it.\n */\n verdict?: WidgetVerdict;\n}\n\nexport interface WidgetContextValue {\n state: WidgetState;\n actions: WidgetActions;\n meta: WidgetMeta;\n data?: WidgetData;\n}\n\nexport const WidgetContext = createContext<WidgetContextValue | null>(null);\n"]}
@@ -9,9 +9,7 @@ export interface WidgetPreviewProviderProps {
9
9
  className?: string;
10
10
  /** Defaults to `'active'` — the state you almost always want to look at. */
11
11
  state?: WidgetRenderState;
12
- isCollapsible?: boolean;
13
12
  isPinnable?: boolean;
14
- defaultCollapsed?: boolean;
15
13
  defaultPinned?: boolean;
16
14
  maxContentHeight?: string;
17
15
  askContext?: WidgetAskContext;
@@ -24,7 +22,7 @@ export interface WidgetPreviewProviderProps {
24
22
  /**
25
23
  * Renders a widget outside the Ekanos dashboard.
26
24
  *
27
- * `Widget.*` reads everything — render state, collapse/pin, title — from
25
+ * `Widget.*` reads everything — render state, pin, title — from
28
26
  * `WidgetContext`, which in production is filled by the host's
29
27
  * `DashboardWidgetProvider` (config hierarchy, persistence callbacks, health
30
28
  * resolution). None of that exists in a partner's own app, a Storybook story,
@@ -40,4 +38,4 @@ export interface WidgetPreviewProviderProps {
40
38
  * Flip `state` to walk every branch your widget renders (`'loading'`,
41
39
  * `'error'`, `'inactive'`, `'disabled'`) without faking a network condition.
42
40
  */
43
- export declare function WidgetPreviewProvider({ widgetId, title, subtitle, description, className, state, isCollapsible, isPinnable, defaultCollapsed, defaultPinned, maxContentHeight, askContext, aiFooterEnabled, health, source, children, }: WidgetPreviewProviderProps): import("react").JSX.Element;
41
+ export declare function WidgetPreviewProvider({ widgetId, title, subtitle, description, className, state, isPinnable, defaultPinned, maxContentHeight, askContext, aiFooterEnabled, health, source, children, }: WidgetPreviewProviderProps): import("react").JSX.Element;
@@ -5,7 +5,7 @@ import { WidgetContext, } from './widget-context.js';
5
5
  /**
6
6
  * Renders a widget outside the Ekanos dashboard.
7
7
  *
8
- * `Widget.*` reads everything — render state, collapse/pin, title — from
8
+ * `Widget.*` reads everything — render state, pin, title — from
9
9
  * `WidgetContext`, which in production is filled by the host's
10
10
  * `DashboardWidgetProvider` (config hierarchy, persistence callbacks, health
11
11
  * resolution). None of that exists in a partner's own app, a Storybook story,
@@ -21,20 +21,16 @@ import { WidgetContext, } from './widget-context.js';
21
21
  * Flip `state` to walk every branch your widget renders (`'loading'`,
22
22
  * `'error'`, `'inactive'`, `'disabled'`) without faking a network condition.
23
23
  */
24
- export function WidgetPreviewProvider({ widgetId, title, subtitle, description, className, state = 'active', isCollapsible = false, isPinnable = false, defaultCollapsed = false, defaultPinned = false, maxContentHeight, askContext, aiFooterEnabled = false, health, source, children, }) {
25
- const [collapsed, setCollapsed] = useState(defaultCollapsed);
24
+ export function WidgetPreviewProvider({ widgetId, title, subtitle, description, className, state = 'active', isPinnable = false, defaultPinned = false, maxContentHeight, askContext, aiFooterEnabled = false, health, source, children, }) {
26
25
  const [pinned, setPinned] = useState(defaultPinned);
27
- const toggleCollapsed = useCallback(() => setCollapsed((previous) => !previous), []);
28
26
  const togglePinned = useCallback(() => setPinned((previous) => !previous), []);
29
27
  const value = useMemo(() => ({
30
28
  state: {
31
29
  state,
32
- collapsed,
33
30
  pinned,
34
- pendingCollapse: false,
35
31
  pendingPin: false,
36
32
  },
37
- actions: { toggleCollapsed, togglePinned },
33
+ actions: { togglePinned },
38
34
  meta: {
39
35
  widgetId,
40
36
  title,
@@ -42,7 +38,6 @@ export function WidgetPreviewProvider({ widgetId, title, subtitle, description,
42
38
  description,
43
39
  className,
44
40
  maxContentHeight,
45
- isCollapsible,
46
41
  isPinnable,
47
42
  askContext,
48
43
  aiFooterEnabled,
@@ -53,10 +48,8 @@ export function WidgetPreviewProvider({ widgetId, title, subtitle, description,
53
48
  aiFooterEnabled,
54
49
  askContext,
55
50
  className,
56
- collapsed,
57
51
  description,
58
52
  health,
59
- isCollapsible,
60
53
  isPinnable,
61
54
  maxContentHeight,
62
55
  pinned,
@@ -64,7 +57,6 @@ export function WidgetPreviewProvider({ widgetId, title, subtitle, description,
64
57
  state,
65
58
  subtitle,
66
59
  title,
67
- toggleCollapsed,
68
60
  togglePinned,
69
61
  widgetId,
70
62
  ]);
@@ -1 +1 @@
1
- {"version":3,"file":"widget-preview-provider.js","sourceRoot":"","sources":["../../../src/components/widgets/widget-preview-provider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAkB,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGvE,OAAO,EACL,aAAa,GAKd,MAAM,kBAAkB,CAAC;AAuB1B;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,qBAAqB,CAAC,EACpC,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,WAAW,EACX,SAAS,EACT,KAAK,GAAG,QAAQ,EAChB,aAAa,GAAG,KAAK,EACrB,UAAU,GAAG,KAAK,EAClB,gBAAgB,GAAG,KAAK,EACxB,aAAa,GAAG,KAAK,EACrB,gBAAgB,EAChB,UAAU,EACV,eAAe,GAAG,KAAK,EACvB,MAAM,EACN,MAAM,EACN,QAAQ,GACmB;IAC3B,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAC7D,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;IAEpD,MAAM,eAAe,GAAG,WAAW,CACjC,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,EAC3C,EAAE,CACH,CAAC;IAEF,MAAM,YAAY,GAAG,WAAW,CAC9B,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,EACxC,EAAE,CACH,CAAC;IAEF,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,CAAC;QACL,KAAK,EAAE;YACL,KAAK;YACL,SAAS;YACT,MAAM;YACN,eAAe,EAAE,KAAK;YACtB,UAAU,EAAE,KAAK;SAClB;QACD,OAAO,EAAE,EAAE,eAAe,EAAE,YAAY,EAAE;QAC1C,IAAI,EAAE;YACJ,QAAQ;YACR,KAAK;YACL,QAAQ;YACR,WAAW;YACX,SAAS;YACT,gBAAgB;YAChB,aAAa;YACb,UAAU;YACV,UAAU;YACV,eAAe;YACf,MAAM;YACN,MAAM;SACP;KACF,CAAC,EACF;QACE,eAAe;QACf,UAAU;QACV,SAAS;QACT,SAAS;QACT,WAAW;QACX,MAAM;QACN,aAAa;QACb,UAAU;QACV,gBAAgB;QAChB,MAAM;QACN,MAAM;QACN,KAAK;QACL,QAAQ;QACR,KAAK;QACL,eAAe;QACf,YAAY;QACZ,QAAQ;KACT,CACF,CAAC;IAEF,OAAO,KAAC,aAAa,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAiB,CAAC;AACjE,CAAC","sourcesContent":["'use client';\n\nimport { type ReactNode, useCallback, useMemo, useState } from 'react';\n\nimport type { WidgetAskContext } from '../../types/widget-ask-context';\nimport {\n WidgetContext,\n type WidgetContextValue,\n type WidgetHealth,\n type WidgetRenderState,\n type WidgetSource,\n} from './widget-context';\n\nexport interface WidgetPreviewProviderProps {\n widgetId: string;\n title?: string;\n subtitle?: string;\n description?: string;\n className?: string;\n /** Defaults to `'active'` — the state you almost always want to look at. */\n state?: WidgetRenderState;\n isCollapsible?: boolean;\n isPinnable?: boolean;\n defaultCollapsed?: boolean;\n defaultPinned?: boolean;\n maxContentHeight?: string;\n askContext?: WidgetAskContext;\n aiFooterEnabled?: boolean;\n health?: WidgetHealth;\n /** Whose data the widget shows; the header draws its logo. */\n source?: WidgetSource;\n children: ReactNode;\n}\n\n/**\n * Renders a widget outside the Ekanos dashboard.\n *\n * `Widget.*` reads everything — render state, collapse/pin, title — from\n * `WidgetContext`, which in production is filled by the host's\n * `DashboardWidgetProvider` (config hierarchy, persistence callbacks, health\n * resolution). None of that exists in a partner's own app, a Storybook story,\n * or a component test, and without SOME provider every `Widget.*` throws. This\n * is that provider: same context value, local state only, nothing persisted.\n *\n * ```tsx\n * <WidgetPreviewProvider widgetId=\"my-widget\" title=\"My widget\">\n * <MyWidget accountId={accountId} productSlug=\"my-integration\" />\n * </WidgetPreviewProvider>\n * ```\n *\n * Flip `state` to walk every branch your widget renders (`'loading'`,\n * `'error'`, `'inactive'`, `'disabled'`) without faking a network condition.\n */\nexport function WidgetPreviewProvider({\n widgetId,\n title,\n subtitle,\n description,\n className,\n state = 'active',\n isCollapsible = false,\n isPinnable = false,\n defaultCollapsed = false,\n defaultPinned = false,\n maxContentHeight,\n askContext,\n aiFooterEnabled = false,\n health,\n source,\n children,\n}: WidgetPreviewProviderProps) {\n const [collapsed, setCollapsed] = useState(defaultCollapsed);\n const [pinned, setPinned] = useState(defaultPinned);\n\n const toggleCollapsed = useCallback(\n () => setCollapsed((previous) => !previous),\n [],\n );\n\n const togglePinned = useCallback(\n () => setPinned((previous) => !previous),\n [],\n );\n\n const value = useMemo<WidgetContextValue>(\n () => ({\n state: {\n state,\n collapsed,\n pinned,\n pendingCollapse: false,\n pendingPin: false,\n },\n actions: { toggleCollapsed, togglePinned },\n meta: {\n widgetId,\n title,\n subtitle,\n description,\n className,\n maxContentHeight,\n isCollapsible,\n isPinnable,\n askContext,\n aiFooterEnabled,\n health,\n source,\n },\n }),\n [\n aiFooterEnabled,\n askContext,\n className,\n collapsed,\n description,\n health,\n isCollapsible,\n isPinnable,\n maxContentHeight,\n pinned,\n source,\n state,\n subtitle,\n title,\n toggleCollapsed,\n togglePinned,\n widgetId,\n ],\n );\n\n return <WidgetContext value={value}>{children}</WidgetContext>;\n}\n"]}
1
+ {"version":3,"file":"widget-preview-provider.js","sourceRoot":"","sources":["../../../src/components/widgets/widget-preview-provider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAkB,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGvE,OAAO,EACL,aAAa,GAKd,MAAM,kBAAkB,CAAC;AAqB1B;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,qBAAqB,CAAC,EACpC,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,WAAW,EACX,SAAS,EACT,KAAK,GAAG,QAAQ,EAChB,UAAU,GAAG,KAAK,EAClB,aAAa,GAAG,KAAK,EACrB,gBAAgB,EAChB,UAAU,EACV,eAAe,GAAG,KAAK,EACvB,MAAM,EACN,MAAM,EACN,QAAQ,GACmB;IAC3B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;IAEpD,MAAM,YAAY,GAAG,WAAW,CAC9B,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,EACxC,EAAE,CACH,CAAC;IAEF,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,CAAC;QACL,KAAK,EAAE;YACL,KAAK;YACL,MAAM;YACN,UAAU,EAAE,KAAK;SAClB;QACD,OAAO,EAAE,EAAE,YAAY,EAAE;QACzB,IAAI,EAAE;YACJ,QAAQ;YACR,KAAK;YACL,QAAQ;YACR,WAAW;YACX,SAAS;YACT,gBAAgB;YAChB,UAAU;YACV,UAAU;YACV,eAAe;YACf,MAAM;YACN,MAAM;SACP;KACF,CAAC,EACF;QACE,eAAe;QACf,UAAU;QACV,SAAS;QACT,WAAW;QACX,MAAM;QACN,UAAU;QACV,gBAAgB;QAChB,MAAM;QACN,MAAM;QACN,KAAK;QACL,QAAQ;QACR,KAAK;QACL,YAAY;QACZ,QAAQ;KACT,CACF,CAAC;IAEF,OAAO,KAAC,aAAa,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAiB,CAAC;AACjE,CAAC","sourcesContent":["'use client';\n\nimport { type ReactNode, useCallback, useMemo, useState } from 'react';\n\nimport type { WidgetAskContext } from '../../types/widget-ask-context';\nimport {\n WidgetContext,\n type WidgetContextValue,\n type WidgetHealth,\n type WidgetRenderState,\n type WidgetSource,\n} from './widget-context';\n\nexport interface WidgetPreviewProviderProps {\n widgetId: string;\n title?: string;\n subtitle?: string;\n description?: string;\n className?: string;\n /** Defaults to `'active'` — the state you almost always want to look at. */\n state?: WidgetRenderState;\n isPinnable?: boolean;\n defaultPinned?: boolean;\n maxContentHeight?: string;\n askContext?: WidgetAskContext;\n aiFooterEnabled?: boolean;\n health?: WidgetHealth;\n /** Whose data the widget shows; the header draws its logo. */\n source?: WidgetSource;\n children: ReactNode;\n}\n\n/**\n * Renders a widget outside the Ekanos dashboard.\n *\n * `Widget.*` reads everything — render state, pin, title — from\n * `WidgetContext`, which in production is filled by the host's\n * `DashboardWidgetProvider` (config hierarchy, persistence callbacks, health\n * resolution). None of that exists in a partner's own app, a Storybook story,\n * or a component test, and without SOME provider every `Widget.*` throws. This\n * is that provider: same context value, local state only, nothing persisted.\n *\n * ```tsx\n * <WidgetPreviewProvider widgetId=\"my-widget\" title=\"My widget\">\n * <MyWidget accountId={accountId} productSlug=\"my-integration\" />\n * </WidgetPreviewProvider>\n * ```\n *\n * Flip `state` to walk every branch your widget renders (`'loading'`,\n * `'error'`, `'inactive'`, `'disabled'`) without faking a network condition.\n */\nexport function WidgetPreviewProvider({\n widgetId,\n title,\n subtitle,\n description,\n className,\n state = 'active',\n isPinnable = false,\n defaultPinned = false,\n maxContentHeight,\n askContext,\n aiFooterEnabled = false,\n health,\n source,\n children,\n}: WidgetPreviewProviderProps) {\n const [pinned, setPinned] = useState(defaultPinned);\n\n const togglePinned = useCallback(\n () => setPinned((previous) => !previous),\n [],\n );\n\n const value = useMemo<WidgetContextValue>(\n () => ({\n state: {\n state,\n pinned,\n pendingPin: false,\n },\n actions: { togglePinned },\n meta: {\n widgetId,\n title,\n subtitle,\n description,\n className,\n maxContentHeight,\n isPinnable,\n askContext,\n aiFooterEnabled,\n health,\n source,\n },\n }),\n [\n aiFooterEnabled,\n askContext,\n className,\n description,\n health,\n isPinnable,\n maxContentHeight,\n pinned,\n source,\n state,\n subtitle,\n title,\n togglePinned,\n widgetId,\n ],\n );\n\n return <WidgetContext value={value}>{children}</WidgetContext>;\n}\n"]}
@@ -19,7 +19,7 @@ function StateAction({ action, variant = 'default', }) {
19
19
  * icon, a title, one sentence and at most one action), inset by the card.
20
20
  */
21
21
  function StateNote({ icon, title, description, action, role, testId, }) {
22
- return (_jsx("div", { role: role, className: "px-card pb-card", "data-test": testId, children: _jsx(EmptyNote, { icon: icon, title: title, action: action, children: description }) }));
22
+ return (_jsx("div", { role: role, className: "px-card pb-card [--icon-glyph-size:20px] [&_[data-slot=empty-title]]:text-base", "data-test": testId, children: _jsx(EmptyNote, { icon: icon, title: title, action: action, children: description }) }));
23
23
  }
24
24
  /**
25
25
  * The empty state for a widget with nothing to show. Positive by default:
@@ -1 +1 @@
1
- {"version":3,"file":"widget-state-components.js","sourceRoot":"","sources":["../../../src/components/widgets/widget-state-components.tsx"],"names":[],"mappings":";AAEA,OAAO,IAAI,MAAM,cAAc,CAAC;AAEhC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAA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I,cAAc,CAAC,wBAEzC,EACF,KAAC,KAAK,IAAC,OAAO,EAAC,uBAAuB,EAAC,QAAQ,EAAC,WAAW,GAAG,IACvD,CACV,CAAC,CAAC,CAAC,IAAI,EAEV,MAAM,EAAC,cAAc,GACrB,CACH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO,CACL,cAAK,SAAS,EAAC,+CAA+C,YAC5D,KAAC,OAAO,KAAG,GACP,CACP,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mBAAmB;IACjC,OAAO,CACL,KAAC,SAAS,IACR,IAAI,EAAC,UAAU,EACf,KAAK,EACH,KAAC,KAAK,IAAC,OAAO,EAAC,0BAA0B,EAAC,QAAQ,EAAC,iBAAiB,GAAG,EAEzE,MAAM,EAAC,iBAAiB,GACxB,CACH,CAAC;AACJ,CAAC","sourcesContent":["import type { ReactNode } from 'react';\n\nimport Link from 'next/link.js';\n\nimport { Button } from '@ekanos/ui/button';\nimport { EmptyNote } from '@ekanos/ui/empty-note';\nimport { Icon } from '@ekanos/ui/icon';\nimport { Skeleton } from '@ekanos/ui/skeleton';\nimport { Spinner } from '@ekanos/ui/spinner';\nimport { Trans } from '@ekanos/ui/trans';\nimport { cn } from '@ekanos/ui/utils';\n\n/**\n * The one action a state view offers: \"Connect QuickBooks\", \"Ask an admin\",\n * \"Create a deal\". A link with `href`, otherwise a button running `onClick`.\n */\nexport interface WidgetStateAction {\n label: ReactNode;\n href?: string;\n /** Open `href` in a new tab. */\n external?: boolean;\n onClick?: () => void;\n}\n\n/** The body shape a loading skeleton stands in for. */\nexport type WidgetSkeletonVariant = 'rows' | 'stat' | 'chart' | 'schedule';\n\n/** Why an active integration still can't show this widget's data. */\nexport type WidgetInactiveReason =\n | 'not-connected'\n | 'no-access'\n | 'setup-needed';\n\nexport interface WidgetEmptyStateProps {\n /**\n * `positive` (the default) says nothing needs the owner: \"You're all caught\n * up\". `neutral` is for an empty list that isn't good news, like a search\n * with no results.\n */\n tone?: 'positive' | 'neutral';\n /**\n * A Phosphor icon name, e.g. `tray`. Defaults to the\n * tone's icon: a check for `positive`, a tray for `neutral`.\n */\n icon?: string;\n title?: ReactNode;\n description?: ReactNode;\n action?: WidgetStateAction;\n}\n\nexport interface WidgetInactiveStateProps {\n reason?: WidgetInactiveReason;\n /** The integration's name, for the default copy (\"Connect QuickBooks\"). */\n integrationName?: string;\n title?: ReactNode;\n /** One sentence on what connecting or access gives the owner. */\n description?: ReactNode;\n action?: WidgetStateAction;\n}\n\nfunction StateAction({\n action,\n variant = 'default',\n}: {\n action: WidgetStateAction;\n variant?: 'default' | 'outline';\n}) {\n if (action.href) {\n const link = action.external ? (\n <a href={action.href} target=\"_blank\" rel=\"noopener noreferrer\" />\n ) : (\n <Link href={action.href} />\n );\n\n return (\n <Button size=\"sm\" variant={variant} render={link} nativeButton={false}>\n {action.label}\n </Button>\n );\n }\n\n return (\n <Button size=\"sm\" variant={variant} type=\"button\" onClick={action.onClick}>\n {action.label}\n </Button>\n );\n}\n\n/**\n * The shared shape of every non-data state: the kit's inline empty note (an\n * icon, a title, one sentence and at most one action), inset by the card.\n */\nfunction StateNote({\n icon,\n title,\n description,\n action,\n role,\n testId,\n}: {\n icon: string;\n title: ReactNode;\n description?: ReactNode;\n action?: ReactNode;\n role?: 'alert' | 'status';\n testId: string;\n}) {\n return (\n <div role={role} className=\"px-card pb-card\" data-test={testId}>\n <EmptyNote icon={icon} title={title} action={action}>\n {description}\n </EmptyNote>\n </div>\n );\n}\n\n/**\n * The empty state for a widget with nothing to show. Positive by default:\n * an empty review queue is good news, so it reassures instead of apologizing.\n */\nexport function WidgetEmptyState({\n tone = 'positive',\n icon,\n title,\n description,\n action,\n}: WidgetEmptyStateProps) {\n const positive = tone === 'positive';\n\n return (\n <StateNote\n icon={icon ?? (positive ? 'check-circle' : 'tray')}\n title={\n title ??\n (positive ? (\n <Trans\n i18nKey=\"dashboard:widgetEmptyPositive\"\n defaults=\"You're all caught up\"\n />\n ) : (\n <Trans\n i18nKey=\"dashboard:widgetEmptyNeutral\"\n defaults=\"Nothing here yet\"\n />\n ))\n }\n description={description}\n action={action ? <StateAction action={action} variant=\"outline\" /> : null}\n role=\"status\"\n testId={`widget-empty-${tone}`}\n />\n );\n}\n\nconst INACTIVE_ICON: Record<WidgetInactiveReason, string> = {\n 'not-connected': 'plug',\n 'no-access': 'users-three',\n 'setup-needed': 'sliders-horizontal',\n};\n\n/**\n * Why the widget can't show data. `not-connected` offers one Connect button;\n * `no-access` is a calm note that points to an admin, never a lock screen;\n * `setup-needed` points to the integration's settings. Without a `reason` it\n * keeps the original one-line \"Widget inactive\".\n */\nexport function WidgetInactiveState({\n reason,\n integrationName,\n title,\n description,\n action,\n}: WidgetInactiveStateProps = {}) {\n if (!reason) {\n return (\n <StateNote\n icon=\"plug\"\n title={\n title ?? (\n <Trans\n i18nKey=\"dashboard:widgetInactive\"\n defaults=\"Widget inactive\"\n />\n )\n }\n testId=\"widget-inactive\"\n />\n );\n }\n\n const name = integrationName ?? 'this integration';\n\n const defaults: Record<\n WidgetInactiveReason,\n { title: ReactNode; description: ReactNode }\n > = {\n 'not-connected': {\n title: (\n <Trans\n i18nKey=\"dashboard:widgetNotConnectedTitle\"\n defaults=\"Connect {{name}}\"\n values={{ name }}\n />\n ),\n description: (\n <Trans\n i18nKey=\"dashboard:widgetNotConnectedBody\"\n defaults=\"Connect {{name}} and this card fills in with your own data.\"\n values={{ name }}\n />\n ),\n },\n 'no-access': {\n title: (\n <Trans\n i18nKey=\"dashboard:widgetNoAccessTitle\"\n defaults=\"Shared with admins for now\"\n />\n ),\n description: (\n <Trans\n i18nKey=\"dashboard:widgetNoAccessBody\"\n defaults=\"Your role doesn't include this data yet. Ask an admin if you need it.\"\n />\n ),\n },\n 'setup-needed': {\n title: (\n <Trans\n i18nKey=\"dashboard:widgetSetupNeededTitle\"\n defaults=\"Finish setting up {{name}}\"\n values={{ name }}\n />\n ),\n description: (\n <Trans\n i18nKey=\"dashboard:widgetSetupNeededBody\"\n defaults=\"One more step and this card starts showing data.\"\n />\n ),\n },\n };\n\n return (\n <StateNote\n icon={INACTIVE_ICON[reason]}\n title={title ?? defaults[reason].title}\n description={description ?? defaults[reason].description}\n action={\n action ? (\n <StateAction\n action={action}\n variant={reason === 'no-access' ? 'outline' : 'default'}\n />\n ) : null\n }\n testId={`widget-inactive-${reason}`}\n />\n );\n}\n\n/**\n * Loading, drawn as the body it stands in for so the card doesn't jump when\n * data lands. Rows suit lists and feeds, `stat` a headline figure, `chart` a\n * chart, `schedule` a day of events.\n */\nexport function WidgetLoadingSkeleton({\n variant = 'rows',\n}: {\n variant?: WidgetSkeletonVariant;\n}) {\n return (\n <div\n role=\"status\"\n aria-busy=\"true\"\n className=\"flex flex-1 flex-col\"\n data-test={`widget-skeleton-${variant}`}\n >\n <span className=\"sr-only\">\n <Trans i18nKey=\"dashboard:widgetLoading\" defaults=\"Loading...\" />\n </span>\n {variant === 'stat' ? (\n <div className=\"px-card pb-card space-y-2\">\n <Skeleton className=\"h-3 w-24\" />\n <Skeleton className=\"h-8 w-40\" />\n <Skeleton className=\"h-3 w-32\" />\n </div>\n ) : variant === 'chart' ? (\n <div className=\"px-card pb-card space-y-3\">\n <Skeleton className=\"h-8 w-40\" />\n <Skeleton className=\"h-60 w-full\" />\n </div>\n ) : (\n <div className=\"divide-y\">\n {[0, 1, 2].map((row) => (\n <div\n key={row}\n className={cn(\n 'px-card py-row',\n variant === 'schedule' ? 'flex items-start gap-3' : 'space-y-2',\n )}\n >\n {variant === 'schedule' ? (\n <>\n <Skeleton className=\"h-4 w-14 shrink-0\" />\n <div className=\"flex-1 space-y-2\">\n <Skeleton className=\"h-4 w-2/3\" />\n <Skeleton className=\"h-3 w-1/3\" />\n </div>\n </>\n ) : (\n <>\n <Skeleton className=\"h-4 w-2/3\" />\n <Skeleton className=\"h-3 w-1/2\" />\n </>\n )}\n </div>\n ))}\n </div>\n )}\n </div>\n );\n}\n\nexport function WidgetErrorState({\n title,\n description,\n onRetry,\n retrying = false,\n}: {\n title?: ReactNode;\n description?: ReactNode;\n onRetry?: () => void;\n retrying?: boolean;\n}) {\n return (\n <StateNote\n role=\"alert\"\n icon=\"warning-circle\"\n title={\n title ?? (\n <Trans\n i18nKey=\"dashboard:widgetErrorTitle\"\n defaults=\"Couldn't load this widget\"\n />\n )\n }\n description={\n description ??\n (onRetry ? (\n <Trans\n i18nKey=\"dashboard:widgetErrorBodyRetry\"\n defaults=\"Try again, or check back in a few minutes.\"\n />\n ) : (\n <Trans\n i18nKey=\"dashboard:widgetErrorBody\"\n defaults=\"Check back in a few minutes.\"\n />\n ))\n }\n action={\n onRetry ? (\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={onRetry}\n disabled={retrying}\n data-test=\"widget-error-retry\"\n >\n <Icon\n name=\"arrows-clockwise\"\n className={cn(retrying && 'animate-spin')}\n aria-hidden\n />\n <Trans i18nKey=\"dashboard:widgetRetry\" defaults=\"Try again\" />\n </Button>\n ) : null\n }\n testId=\"widget-error\"\n />\n );\n}\n\nexport function WidgetDataLoading() {\n return (\n <div className=\"flex flex-1 items-center justify-center py-12\">\n <Spinner />\n </div>\n );\n}\n\nexport function WidgetDisabledState() {\n return (\n <StateNote\n icon=\"prohibit\"\n title={\n <Trans i18nKey=\"dashboard:widgetDisabled\" defaults=\"Widget Disabled\" />\n }\n testId=\"widget-disabled\"\n />\n );\n}\n"]}
1
+ {"version":3,"file":"widget-state-components.js","sourceRoot":"","sources":["../../../src/components/widgets/widget-state-components.tsx"],"names":[],"mappings":";AAEA,OAAO,IAAI,MAAM,cAAc,CAAC;AAEhC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,OAAO,E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BAAoB,aAE9B,KAAC,IAAI,IACH,IAAI,EAAC,kBAAkB,EACvB,SAAS,EAAE,EAAE,CAAC,QAAQ,IAAI,cAAc,CAAC,wBAEzC,EACF,KAAC,KAAK,IAAC,OAAO,EAAC,uBAAuB,EAAC,QAAQ,EAAC,WAAW,GAAG,IACvD,CACV,CAAC,CAAC,CAAC,IAAI,EAEV,MAAM,EAAC,cAAc,GACrB,CACH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO,CACL,cAAK,SAAS,EAAC,+CAA+C,YAC5D,KAAC,OAAO,KAAG,GACP,CACP,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mBAAmB;IACjC,OAAO,CACL,KAAC,SAAS,IACR,IAAI,EAAC,UAAU,EACf,KAAK,EACH,KAAC,KAAK,IAAC,OAAO,EAAC,0BAA0B,EAAC,QAAQ,EAAC,iBAAiB,GAAG,EAEzE,MAAM,EAAC,iBAAiB,GACxB,CACH,CAAC;AACJ,CAAC","sourcesContent":["import type { ReactNode } from 'react';\n\nimport Link from 'next/link.js';\n\nimport { Button } from '@ekanos/ui/button';\nimport { EmptyNote } from '@ekanos/ui/empty-note';\nimport { Icon } from '@ekanos/ui/icon';\nimport { Skeleton } from '@ekanos/ui/skeleton';\nimport { Spinner } from '@ekanos/ui/spinner';\nimport { Trans } from '@ekanos/ui/trans';\nimport { cn } from '@ekanos/ui/utils';\n\n/**\n * The one action a state view offers: \"Connect QuickBooks\", \"Ask an admin\",\n * \"Create a deal\". A link with `href`, otherwise a button running `onClick`.\n */\nexport interface WidgetStateAction {\n label: ReactNode;\n href?: string;\n /** Open `href` in a new tab. */\n external?: boolean;\n onClick?: () => void;\n}\n\n/** The body shape a loading skeleton stands in for. */\nexport type WidgetSkeletonVariant = 'rows' | 'stat' | 'chart' | 'schedule';\n\n/** Why an active integration still can't show this widget's data. */\nexport type WidgetInactiveReason =\n | 'not-connected'\n | 'no-access'\n | 'setup-needed';\n\nexport interface WidgetEmptyStateProps {\n /**\n * `positive` (the default) says nothing needs the owner: \"You're all caught\n * up\". `neutral` is for an empty list that isn't good news, like a search\n * with no results.\n */\n tone?: 'positive' | 'neutral';\n /**\n * A Phosphor icon name, e.g. `tray`. Defaults to the\n * tone's icon: a check for `positive`, a tray for `neutral`.\n */\n icon?: string;\n title?: ReactNode;\n description?: ReactNode;\n action?: WidgetStateAction;\n}\n\nexport interface WidgetInactiveStateProps {\n reason?: WidgetInactiveReason;\n /** The integration's name, for the default copy (\"Connect QuickBooks\"). */\n integrationName?: string;\n title?: ReactNode;\n /** One sentence on what connecting or access gives the owner. */\n description?: ReactNode;\n action?: WidgetStateAction;\n}\n\nfunction StateAction({\n action,\n variant = 'default',\n}: {\n action: WidgetStateAction;\n variant?: 'default' | 'outline';\n}) {\n if (action.href) {\n const link = action.external ? (\n <a href={action.href} target=\"_blank\" rel=\"noopener noreferrer\" />\n ) : (\n <Link href={action.href} />\n );\n\n return (\n <Button size=\"sm\" variant={variant} render={link} nativeButton={false}>\n {action.label}\n </Button>\n );\n }\n\n return (\n <Button size=\"sm\" variant={variant} type=\"button\" onClick={action.onClick}>\n {action.label}\n </Button>\n );\n}\n\n/**\n * The shared shape of every non-data state: the kit's inline empty note (an\n * icon, a title, one sentence and at most one action), inset by the card.\n */\nfunction StateNote({\n icon,\n title,\n description,\n action,\n role,\n testId,\n}: {\n icon: string;\n title: ReactNode;\n description?: ReactNode;\n action?: ReactNode;\n role?: 'alert' | 'status';\n testId: string;\n}) {\n return (\n // A widget's empty line reads at body size, a step above the inline\n // note's default (owner, 2026-11-10).\n <div\n role={role}\n className=\"px-card pb-card [--icon-glyph-size:20px] [&_[data-slot=empty-title]]:text-base\"\n data-test={testId}\n >\n <EmptyNote icon={icon} title={title} action={action}>\n {description}\n </EmptyNote>\n </div>\n );\n}\n\n/**\n * The empty state for a widget with nothing to show. Positive by default:\n * an empty review queue is good news, so it reassures instead of apologizing.\n */\nexport function WidgetEmptyState({\n tone = 'positive',\n icon,\n title,\n description,\n action,\n}: WidgetEmptyStateProps) {\n const positive = tone === 'positive';\n\n return (\n <StateNote\n icon={icon ?? (positive ? 'check-circle' : 'tray')}\n title={\n title ??\n (positive ? (\n <Trans\n i18nKey=\"dashboard:widgetEmptyPositive\"\n defaults=\"You're all caught up\"\n />\n ) : (\n <Trans\n i18nKey=\"dashboard:widgetEmptyNeutral\"\n defaults=\"Nothing here yet\"\n />\n ))\n }\n description={description}\n action={action ? <StateAction action={action} variant=\"outline\" /> : null}\n role=\"status\"\n testId={`widget-empty-${tone}`}\n />\n );\n}\n\nconst INACTIVE_ICON: Record<WidgetInactiveReason, string> = {\n 'not-connected': 'plug',\n 'no-access': 'users-three',\n 'setup-needed': 'sliders-horizontal',\n};\n\n/**\n * Why the widget can't show data. `not-connected` offers one Connect button;\n * `no-access` is a calm note that points to an admin, never a lock screen;\n * `setup-needed` points to the integration's settings. Without a `reason` it\n * keeps the original one-line \"Widget inactive\".\n */\nexport function WidgetInactiveState({\n reason,\n integrationName,\n title,\n description,\n action,\n}: WidgetInactiveStateProps = {}) {\n if (!reason) {\n return (\n <StateNote\n icon=\"plug\"\n title={\n title ?? (\n <Trans\n i18nKey=\"dashboard:widgetInactive\"\n defaults=\"Widget inactive\"\n />\n )\n }\n testId=\"widget-inactive\"\n />\n );\n }\n\n const name = integrationName ?? 'this integration';\n\n const defaults: Record<\n WidgetInactiveReason,\n { title: ReactNode; description: ReactNode }\n > = {\n 'not-connected': {\n title: (\n <Trans\n i18nKey=\"dashboard:widgetNotConnectedTitle\"\n defaults=\"Connect {{name}}\"\n values={{ name }}\n />\n ),\n description: (\n <Trans\n i18nKey=\"dashboard:widgetNotConnectedBody\"\n defaults=\"Connect {{name}} and this card fills in with your own data.\"\n values={{ name }}\n />\n ),\n },\n 'no-access': {\n title: (\n <Trans\n i18nKey=\"dashboard:widgetNoAccessTitle\"\n defaults=\"Shared with admins for now\"\n />\n ),\n description: (\n <Trans\n i18nKey=\"dashboard:widgetNoAccessBody\"\n defaults=\"Your role doesn't include this data yet. Ask an admin if you need it.\"\n />\n ),\n },\n 'setup-needed': {\n title: (\n <Trans\n i18nKey=\"dashboard:widgetSetupNeededTitle\"\n defaults=\"Finish setting up {{name}}\"\n values={{ name }}\n />\n ),\n description: (\n <Trans\n i18nKey=\"dashboard:widgetSetupNeededBody\"\n defaults=\"One more step and this card starts showing data.\"\n />\n ),\n },\n };\n\n return (\n <StateNote\n icon={INACTIVE_ICON[reason]}\n title={title ?? defaults[reason].title}\n description={description ?? defaults[reason].description}\n action={\n action ? (\n <StateAction\n action={action}\n variant={reason === 'no-access' ? 'outline' : 'default'}\n />\n ) : null\n }\n testId={`widget-inactive-${reason}`}\n />\n );\n}\n\n/**\n * Loading, drawn as the body it stands in for so the card doesn't jump when\n * data lands. Rows suit lists and feeds, `stat` a headline figure, `chart` a\n * chart, `schedule` a day of events.\n */\nexport function WidgetLoadingSkeleton({\n variant = 'rows',\n}: {\n variant?: WidgetSkeletonVariant;\n}) {\n return (\n <div\n role=\"status\"\n aria-busy=\"true\"\n className=\"flex flex-1 flex-col\"\n data-test={`widget-skeleton-${variant}`}\n >\n <span className=\"sr-only\">\n <Trans i18nKey=\"dashboard:widgetLoading\" defaults=\"Loading...\" />\n </span>\n {variant === 'stat' ? (\n <div className=\"px-card pb-card space-y-2\">\n <Skeleton className=\"h-3 w-24\" />\n <Skeleton className=\"h-8 w-40\" />\n <Skeleton className=\"h-3 w-32\" />\n </div>\n ) : variant === 'chart' ? (\n <div className=\"px-card pb-card space-y-3\">\n <Skeleton className=\"h-8 w-40\" />\n <Skeleton className=\"h-60 w-full\" />\n </div>\n ) : (\n <div className=\"divide-y\">\n {[0, 1, 2].map((row) => (\n <div\n key={row}\n className={cn(\n 'px-card py-row',\n variant === 'schedule' ? 'flex items-start gap-3' : 'space-y-2',\n )}\n >\n {variant === 'schedule' ? (\n <>\n <Skeleton className=\"h-4 w-14 shrink-0\" />\n <div className=\"flex-1 space-y-2\">\n <Skeleton className=\"h-4 w-2/3\" />\n <Skeleton className=\"h-3 w-1/3\" />\n </div>\n </>\n ) : (\n <>\n <Skeleton className=\"h-4 w-2/3\" />\n <Skeleton className=\"h-3 w-1/2\" />\n </>\n )}\n </div>\n ))}\n </div>\n )}\n </div>\n );\n}\n\nexport function WidgetErrorState({\n title,\n description,\n onRetry,\n retrying = false,\n}: {\n title?: ReactNode;\n description?: ReactNode;\n onRetry?: () => void;\n retrying?: boolean;\n}) {\n return (\n <StateNote\n role=\"alert\"\n icon=\"warning-circle\"\n title={\n title ?? (\n <Trans\n i18nKey=\"dashboard:widgetErrorTitle\"\n defaults=\"Couldn't load this widget\"\n />\n )\n }\n description={\n description ??\n (onRetry ? (\n <Trans\n i18nKey=\"dashboard:widgetErrorBodyRetry\"\n defaults=\"Try again, or check back in a few minutes.\"\n />\n ) : (\n <Trans\n i18nKey=\"dashboard:widgetErrorBody\"\n defaults=\"Check back in a few minutes.\"\n />\n ))\n }\n action={\n onRetry ? (\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={onRetry}\n disabled={retrying}\n data-test=\"widget-error-retry\"\n >\n <Icon\n name=\"arrows-clockwise\"\n className={cn(retrying && 'animate-spin')}\n aria-hidden\n />\n <Trans i18nKey=\"dashboard:widgetRetry\" defaults=\"Try again\" />\n </Button>\n ) : null\n }\n testId=\"widget-error\"\n />\n );\n}\n\nexport function WidgetDataLoading() {\n return (\n <div className=\"flex flex-1 items-center justify-center py-12\">\n <Spinner />\n </div>\n );\n}\n\nexport function WidgetDisabledState() {\n return (\n <StateNote\n icon=\"prohibit\"\n title={\n <Trans i18nKey=\"dashboard:widgetDisabled\" defaults=\"Widget Disabled\" />\n }\n testId=\"widget-disabled\"\n />\n );\n}\n"]}
@@ -103,8 +103,8 @@ declare function WidgetMenuChoice<Value extends string>({ icon, label, value, op
103
103
  * ordinary content (text, rows, a KPI readout) is left flush against the
104
104
  * card's sides while `Widget.Header` stays inset (`px-card`) unless the body
105
105
  * supplies its own padding. `Widget.Body` is that padding: `px-card` matches
106
- * the header's horizontal inset so header and body align, and `pb-card`
107
- * matches the header's top.
106
+ * the header's horizontal inset so header and body align, `pt-1` makes the
107
+ * step under the header 16px, and `pb-card` matches the header's top.
108
108
  *
109
109
  * Every widget wraps its content in it:
110
110
  *
@@ -87,7 +87,9 @@ function WidgetCard({ children }) {
87
87
  tone: "verdict",
88
88
  // Bleed: the header, body and footers pad themselves so a list or
89
89
  // chart can run to the card's edges.
90
- layout: "bleed", className: cn('@container/widget relative h-full', meta.className), "data-widget-id": meta.widgetId, children: _jsxs(WidgetAskSlotProvider, { children: [children, _jsx(WidgetFreshness, {})] }) }));
90
+ layout: "bleed",
91
+ // The widget tier: a 20px inset (`surface="widget"`, card-surface.ts).
92
+ surface: "widget", className: cn('@container/widget relative h-full', meta.className), "data-widget-id": meta.widgetId, children: _jsxs(WidgetAskSlotProvider, { children: [children, _jsx(WidgetFreshness, {})] }) }));
91
93
  }
92
94
  function HeaderTrailing({ trailing }) {
93
95
  var _a;
@@ -144,14 +146,17 @@ function WidgetHeader({ title, subtitle, description, context, trailing, menu, c
144
146
  }
145
147
  if (!effectiveTitle)
146
148
  return null;
147
- const titleNode = effectiveDescription ? (_jsxs(_Fragment, { children: [_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: _jsx(CardTitle, { className: "truncate" }), children: effectiveTitle }), _jsx(TooltipContent, { children: _jsx("p", { children: effectiveDescription }) })] }) }), _jsx("span", { className: "sr-only", children: effectiveDescription })] })) : (_jsx(CardTitle, { className: "truncate", children: effectiveTitle }));
149
+ const titleNode = effectiveDescription ? (_jsxs(_Fragment, { children: [_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: _jsx(CardTitle, { size: "lg", className: "truncate" }), children: effectiveTitle }), _jsx(TooltipContent, { children: _jsx("p", { children: effectiveDescription }) })] }) }), _jsx("span", { className: "sr-only", children: effectiveDescription })] })) : (_jsx(CardTitle, { size: "lg", className: "truncate", children: effectiveTitle }));
148
150
  const subline = verdict && verdict.tone !== 'clear' ? (_jsx(VerdictLine, { verdict: verdict })) : contextLine ? (_jsxs(CardDescription, { className: "truncate", "data-test": "widget-header-context", children: [contextLine, verdict ? (_jsxs(_Fragment, { children: [' · ', _jsx("span", { "data-test": "widget-verdict", "data-verdict": "clear", children: verdict.sentence })] })) : null] })) : verdict ? (_jsx(VerdictLine, { verdict: verdict })) : null;
149
- return (_jsxs(CardHeader, { className: "py-card", children: [titleNode, subline, _jsxs(CardAction, { className: "flex items-center gap-2", children: [trailing ? _jsx(HeaderTrailing, { trailing: trailing }) : null, children, _jsx(WidgetAskHeaderSlot, {}), _jsx(WidgetMenu, { items: menu })] })] }));
151
+ // One rhythm for every widget: the card's inset above the title, and a
152
+ // short step (12px) below the context line. A padded body adds 4px to make
153
+ // 16; an edge-to-edge list's first row pads itself, so its hover band
154
+ // starts at 12 and its text sits at 24, level with the card's side inset.
155
+ return (_jsxs(CardHeader, { className: "pt-card pb-3", children: [titleNode, subline, _jsxs(CardAction, { className: "flex items-center gap-2", children: [trailing ? _jsx(HeaderTrailing, { trailing: trailing }) : null, children, _jsx(WidgetAskHeaderSlot, {}), _jsx(WidgetMenu, { items: menu })] })] }));
150
156
  }
151
157
  /**
152
158
  * The actions every widget shares, whatever it renders: open its full
153
- * surface, reload it, collapse it, pin or unpin it. One menu per widget, so
154
- * collapse lives here rather than as a second header control. Each item needs
159
+ * surface, reload it, pin or unpin it. One menu per widget. Each item needs
155
160
  * something from the host or the widget's data layer, so the menu shows only
156
161
  * what applies — and nothing at all when nothing does.
157
162
  */
@@ -160,11 +165,11 @@ function WidgetMenu({ items }) {
160
165
  const { state, actions, meta, data } = useWidget();
161
166
  const refresh = state.state === 'active' ? data === null || data === void 0 ? void 0 : data.refresh : undefined;
162
167
  const hasNavigation = !!items || !!meta.openHref || !!refresh;
163
- const hasLayout = !!meta.isCollapsible || !!meta.isPinnable;
168
+ const hasLayout = !!meta.isPinnable;
164
169
  if (!hasNavigation && !hasLayout)
165
170
  return null;
166
171
  const title = (_a = meta.title) !== null && _a !== void 0 ? _a : 'widget';
167
- return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { render: _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": `Actions for ${title}`, "data-test": `widget-menu-${meta.widgetId}` }), children: _jsx(Icon, { name: "dots-three", "aria-hidden": true }) }), _jsxs(DropdownMenuContent, { align: "end", children: [items, meta.openHref ? (_jsxs(DropdownMenuItem, { render: _jsx(Link, { href: meta.openHref }), children: [_jsx(Icon, { name: "arrow-square-out", "aria-hidden": true }), _jsx(Trans, { i18nKey: "dashboard:widgetOpenInWorkspace", defaults: "Open in workspace" })] })) : null, refresh ? (_jsxs(DropdownMenuItem, { onClick: refresh, disabled: data === null || data === void 0 ? void 0 : data.refreshing, children: [_jsx(Icon, { name: "arrows-clockwise", "aria-hidden": true }), _jsx(Trans, { i18nKey: "dashboard:widgetRefresh", defaults: "Refresh" })] })) : null, hasNavigation && hasLayout ? _jsx(DropdownMenuSeparator, {}) : null, meta.isCollapsible ? (_jsxs(DropdownMenuItem, { onClick: actions.toggleCollapsed, disabled: state.pendingCollapse, "data-test": `widget-menu-collapse-${meta.widgetId}`, children: [_jsx(Icon, { name: state.collapsed ? 'arrows-out-simple' : 'arrows-in-simple', "aria-hidden": true }), state.collapsed ? (_jsx(Trans, { i18nKey: "dashboard:widgetExpand", defaults: "Expand" })) : (_jsx(Trans, { i18nKey: "dashboard:widgetCollapse", defaults: "Collapse" }))] })) : null, meta.isPinnable ? (_jsxs(DropdownMenuItem, { onClick: actions.togglePinned, disabled: state.pendingPin, "data-test": `widget-menu-pin-${meta.widgetId}`, children: [_jsx(Icon, { name: state.pinned ? 'push-pin-slash' : 'push-pin', "aria-hidden": true }), state.pinned ? (_jsx(Trans, { i18nKey: "dashboard:widgetUnpin", defaults: "Unpin from board" })) : (_jsx(Trans, { i18nKey: "dashboard:widgetPin", defaults: "Pin to board" }))] })) : null] })] }));
172
+ return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { render: _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": `Actions for ${title}`, "data-test": `widget-menu-${meta.widgetId}` }), children: _jsx(Icon, { name: "dots-three", "aria-hidden": true }) }), _jsxs(DropdownMenuContent, { align: "end", children: [items, meta.openHref ? (_jsxs(DropdownMenuItem, { render: _jsx(Link, { href: meta.openHref }), children: [_jsx(Icon, { name: "arrow-square-out", "aria-hidden": true }), _jsx(Trans, { i18nKey: "dashboard:widgetOpenInWorkspace", defaults: "Open in workspace" })] })) : null, refresh ? (_jsxs(DropdownMenuItem, { onClick: refresh, disabled: data === null || data === void 0 ? void 0 : data.refreshing, children: [_jsx(Icon, { name: "arrows-clockwise", "aria-hidden": true }), _jsx(Trans, { i18nKey: "dashboard:widgetRefresh", defaults: "Refresh" })] })) : null, hasNavigation && hasLayout ? _jsx(DropdownMenuSeparator, {}) : null, meta.isPinnable ? (_jsxs(DropdownMenuItem, { onClick: actions.togglePinned, disabled: state.pendingPin, "data-test": `widget-menu-pin-${meta.widgetId}`, children: [_jsx(Icon, { name: state.pinned ? 'push-pin-slash' : 'push-pin', "aria-hidden": true }), state.pinned ? (_jsx(Trans, { i18nKey: "dashboard:widgetUnpin", defaults: "Unpin from board" })) : (_jsx(Trans, { i18nKey: "dashboard:widgetPin", defaults: "Pin to board" }))] })) : null] })] }));
168
173
  }
169
174
  /**
170
175
  * One widget-specific entry in the header's ⋯ menu; pass it through
@@ -195,16 +200,11 @@ function WidgetMenuChoice({ icon, label, value, options, onChange, }) {
195
200
  function WidgetFreshness() {
196
201
  const { state, data } = useWidget();
197
202
  const updated = useRelativeTime(data === null || data === void 0 ? void 0 : data.updatedAt);
198
- if (state.state !== 'active' || state.collapsed || !updated)
203
+ if (state.state !== 'active' || !updated)
199
204
  return null;
200
205
  return (_jsx("div", { className: "text-muted-foreground px-card py-row flex items-center gap-1.5 border-t text-xs", "aria-live": "polite", children: (data === null || data === void 0 ? void 0 : data.refreshing) ? (_jsxs(_Fragment, { children: [_jsx(Icon, { name: "arrows-clockwise", className: "animate-spin", "aria-hidden": true }), _jsx(Trans, { i18nKey: "dashboard:widgetRefreshing", defaults: "Refreshing\u2026" })] })) : (_jsx(Trans, { i18nKey: "dashboard:widgetUpdated", defaults: "Updated {{time}}", values: { time: updated } })) }));
201
206
  }
202
207
  // ─── State-gated content ────────────────────────────────────────────────────
203
- function CollapsibleBody({ collapsed, maxContentHeight, widgetId, children, }) {
204
- return (_jsx("div", { className: cn('transition-fold grid min-h-0 flex-1 motion-reduce:transition-none', collapsed ? 'grid-rows-[0fr]' : 'grid-rows-[1fr]'), children: _jsx("div", { className: "min-h-0 overflow-hidden", children: _jsx("div", { id: `widget-content-${widgetId}`, className: cn('flex h-full min-h-0 flex-1 flex-col overflow-y-auto', 'transition-opacity duration-(--duration-enter) ease-(--ease-enter) motion-reduce:transition-none', collapsed ? 'opacity-0' : 'opacity-100', maxContentHeight && 'max-h-(--widget-max-height)'), style: maxContentHeight
205
- ? { '--widget-max-height': maxContentHeight }
206
- : undefined, children: children }) }) }));
207
- }
208
208
  function StaticBody({ maxContentHeight, children, }) {
209
209
  const { innerRef, height } = useAnimatedHeight();
210
210
  return (_jsx("div", { className: "flex min-h-0 flex-1 flex-col", children: _jsx("div", { className: cn('transition-fold h-(--body-height) overflow-hidden motion-reduce:transition-none', maxContentHeight && 'max-h-(--widget-max-height)'), style: {
@@ -220,8 +220,8 @@ function StaticBody({ maxContentHeight, children, }) {
220
220
  * ordinary content (text, rows, a KPI readout) is left flush against the
221
221
  * card's sides while `Widget.Header` stays inset (`px-card`) unless the body
222
222
  * supplies its own padding. `Widget.Body` is that padding: `px-card` matches
223
- * the header's horizontal inset so header and body align, and `pb-card`
224
- * matches the header's top.
223
+ * the header's horizontal inset so header and body align, `pt-1` makes the
224
+ * step under the header 16px, and `pb-card` matches the header's top.
225
225
  *
226
226
  * Every widget wraps its content in it:
227
227
  *
@@ -235,7 +235,7 @@ function StaticBody({ maxContentHeight, children, }) {
235
235
  * that pad themselves, a chart, a table with its own header row, an image.
236
236
  */
237
237
  function WidgetBody({ flush = false, className, children, }) {
238
- return (_jsx("div", { className: cn('flex flex-1 flex-col', flush ? 'pb-2' : 'px-card pb-card gap-4', className), "data-flush": flush || undefined, children: children }));
238
+ return (_jsx("div", { className: cn('flex flex-1 flex-col', flush ? 'pb-2' : 'px-card pb-card gap-4 pt-1', className), "data-flush": flush || undefined, children: children }));
239
239
  }
240
240
  /**
241
241
  * Renders `children` once the widget's state is `active`. Its body
@@ -248,7 +248,7 @@ function WidgetActive({ children }) {
248
248
  if (state.state !== 'active')
249
249
  return null;
250
250
  const body = (_jsx(WidgetErrorBoundary, { widgetId: meta.widgetId, onRetry: data === null || data === void 0 ? void 0 : data.refresh, children: children }));
251
- return meta.isCollapsible ? (_jsx(CollapsibleBody, { collapsed: state.collapsed, maxContentHeight: meta.maxContentHeight, widgetId: meta.widgetId, children: body })) : (_jsx(StaticBody, { maxContentHeight: meta.maxContentHeight, children: body }));
251
+ return (_jsx(StaticBody, { maxContentHeight: meta.maxContentHeight, children: body }));
252
252
  }
253
253
  /**
254
254
  * Shows while the widget loads: a skeleton shaped like its body (`variant`,
@@ -302,32 +302,34 @@ function WidgetDisabled({ children }) {
302
302
  }
303
303
  // ─── Footers ────────────────────────────────────────────────────────────────
304
304
  function WidgetFooter({ children }) {
305
- const { state, meta } = useWidget();
305
+ const { state } = useWidget();
306
306
  if (state.state !== 'active')
307
307
  return null;
308
- return (_jsx(CardFooter, { className: cn('transition-opacity motion-reduce:transition-none', meta.isCollapsible && state.collapsed
309
- ? 'pointer-events-none opacity-0'
310
- : 'opacity-100'), "aria-hidden": meta.isCollapsible && state.collapsed, children: children }));
308
+ return _jsx(CardFooter, { children: children });
311
309
  }
312
310
  function WidgetActions({ children }) {
313
311
  return _jsx(CardFooter, { className: "justify-end", children: children });
314
312
  }
315
- /** A header-placed Ask, beside the ⋯ menu. */
313
+ /**
314
+ * A header-placed Ask, beside the ⋯ menu. On a pointer device it shows on
315
+ * hover (after 150ms, so a pointer crossing the board does not flash every
316
+ * key) or focus of its widget (at once), and while its popover is open; on touch,
317
+ * where there is no hover, it always shows. It keeps its place either way, so
318
+ * the header never shifts.
319
+ */
316
320
  function WidgetAskHeaderSlot() {
317
321
  const presentation = useWidgetAskPresentation();
318
322
  const slot = useWidgetAskSlot();
319
323
  if (!presentation || !(slot === null || slot === void 0 ? void 0 : slot.context))
320
324
  return null;
321
- return presentation.render(slot.context);
325
+ return (_jsx("span", { "data-slot": "widget-ask", className: "flex transition-opacity duration-(--duration-colour) ease-out pointer-fine:opacity-0 pointer-fine:has-data-popup-open:opacity-100 pointer-fine:[[data-surface=widget]:focus-within_&]:opacity-100 pointer-fine:[[data-surface=widget]:hover_&]:opacity-100 pointer-fine:[[data-surface=widget]:hover_&]:delay-150", children: presentation.render(slot.context) }));
322
326
  }
323
327
  function WidgetAskFooter({ context }) {
324
328
  var _a, _b;
325
329
  const presentation = useWidgetAskPresentation();
326
330
  const { state, meta, data } = useWidget();
327
331
  const effectiveContext = context !== null && context !== void 0 ? context : meta.askContext;
328
- const shouldShow = (meta.aiFooterEnabled || !!effectiveContext) &&
329
- state.state === 'active' &&
330
- !state.collapsed;
332
+ const shouldShow = (meta.aiFooterEnabled || !!effectiveContext) && state.state === 'active';
331
333
  const base = effectiveContext !== null && effectiveContext !== void 0 ? effectiveContext : {
332
334
  widgetId: meta.widgetId,
333
335
  title: (_a = meta.title) !== null && _a !== void 0 ? _a : meta.widgetId,
@@ -359,9 +361,7 @@ function WidgetHealthFooter() {
359
361
  const { state, meta } = useWidget();
360
362
  const lastSuccessAt = toEpochMs((_a = meta.health) === null || _a === void 0 ? void 0 : _a.lastSuccessAt);
361
363
  const lastSynced = useRelativeTime(lastSuccessAt);
362
- const shouldShow = state.state === 'active' &&
363
- !state.collapsed &&
364
- ((_b = meta.health) === null || _b === void 0 ? void 0 : _b.status) === 'degraded';
364
+ const shouldShow = state.state === 'active' && ((_b = meta.health) === null || _b === void 0 ? void 0 : _b.status) === 'degraded';
365
365
  if (!shouldShow)
366
366
  return null;
367
367
  return (_jsxs("div", { className: "text-warning bg-warning-surface px-card py-row flex items-center gap-2 border-t text-xs", children: [_jsx(Icon, { name: "warning-circle", "aria-hidden": true }), _jsx("span", { children: lastSynced ? (_jsx(Trans, { i18nKey: "common:integrationHealth.degradedWidgetNoticeSince", defaults: "Data may be out of date. Last synced {{time}}.", values: { time: lastSynced } })) : (_jsx(Trans, { i18nKey: "common:integrationHealth.degradedWidgetNotice", defaults: "This integration is degraded \u2014 data may be stale." })) })] }));
@@ -1 +1 @@
1
- {"version":3,"file":"widget.js","sourceRoot":"","sources":["../../../src/components/widgets/widget.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;AAEb,OAAO,EACL,SAAS,EAGT,GAAG,EACH,WAAW,EACX,OAAO,GACR,MAAM,OAAO,CAAC;AAEf,OAAO,IAAI,MAAM,cAAc,CAAC;AAEhC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EACL,IAAI,EACJ,UAAU,EACV,eAAe,EACf,UAAU,EACV,UAAU,EACV,SAAS,GACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EACL,MAAM,EACN,aAAa,EACb,UAAU,EACV,aAAa,EACb,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EACL,OAAO,EACP,cAAc,EACd,eAAe,EACf,cAAc,GACf,MAAM,oB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AW;IAClB,QAAQ,EAAE,cAAc;IACxB,QAAQ,EAAE,cAAc;IACxB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,aAAa;IACtB,SAAS,EAAE,eAAe;IAC1B,YAAY,EAAE,kBAAkB;CACjC,CAAC","sourcesContent":["'use client';\n\nimport {\n Component,\n type CSSProperties,\n type ReactNode,\n use,\n useCallback,\n useMemo,\n} from 'react';\n\nimport Link from 'next/link.js';\n\nimport { Button } from '@ekanos/ui/button';\nimport {\n Card,\n CardAction,\n CardDescription,\n CardFooter,\n CardHeader,\n CardTitle,\n} from '@ekanos/ui/card';\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n} from '@ekanos/ui/dropdown-menu';\nimport { Icon } from '@ekanos/ui/icon';\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@ekanos/ui/select';\nimport { StatusBadge } from '@ekanos/ui/status-badge';\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from '@ekanos/ui/tooltip';\nimport { Trans } from '@ekanos/ui/trans';\nimport { cn } from '@ekanos/ui/utils';\n\nimport type { WidgetAskContext } from '../../types/widget-ask-context';\nimport type { WidgetVerdict } from '../../types/widget-verdict';\nimport { useAnimatedHeight } from './use-animated-height';\nimport { useRelativeTime } from './use-relative-time';\nimport { WidgetAskBar } from './widget-ask-bar';\nimport {\n WidgetAskSlotProvider,\n usePublishAskContext,\n useWidgetAskPresentation,\n useWidgetAskSlot,\n} from './widget-ask-presentation';\nimport { WidgetContext, type WidgetRenderState } from './widget-context';\nimport {\n type WidgetConnectionGate,\n type WidgetQuery,\n widgetQueryStatus,\n} from './widget-query-state';\nimport {\n WidgetDisabledState,\n WidgetEmptyState,\n type WidgetEmptyStateProps,\n WidgetErrorState,\n WidgetInactiveState,\n type WidgetInactiveStateProps,\n WidgetLoadingSkeleton,\n type WidgetSkeletonVariant,\n} from './widget-state-components';\n\n// ─── Error Boundary ─────────────────────────────────────────────────────────\n\nclass WidgetErrorBoundary extends Component<\n { widgetId: string; onRetry?: () => void; children: ReactNode },\n { hasError: boolean }\n> {\n state = { hasError: false };\n static getDerivedStateFromError() {\n return { hasError: true };\n }\n componentDidCatch(error: Error, info: React.ErrorInfo) {\n console.error(`Widget \"${this.props.widgetId}\" crashed:`, error, info);\n }\n retry = () => {\n this.props.onRetry?.();\n this.setState({ hasError: false });\n };\n render() {\n if (this.state.hasError) {\n return (\n <WidgetErrorState\n title={\n <Trans\n i18nKey=\"dashboard:widgetCrashedTitle\"\n defaults=\"This widget ran into a problem\"\n />\n }\n description={\n <Trans\n i18nKey=\"dashboard:widgetCrashedBody\"\n defaults=\"Try again. If it keeps happening, reload the page.\"\n />\n }\n onRetry={this.retry}\n />\n );\n }\n return this.props.children;\n }\n}\n\n// ─── Hook ───────────────────────────────────────────────────────────────────\n\nfunction useWidget() {\n const ctx = use(WidgetContext);\n if (!ctx) {\n throw new Error(\n 'Widget.* compound components must be rendered inside a widget provider. ' +\n 'On the Ekanos dashboard the host supplies one. Anywhere else — your own ' +\n 'app, a story, a component test — wrap the widget in ' +\n \"`WidgetPreviewProvider` from '@ekanos/sdk/components'.\",\n );\n }\n return ctx;\n}\n\n/**\n * The verdict the widget reported through `Widget.DataState`, for a body that\n * wants to echo it (an empty state, a summary row). `undefined` before the\n * widget has one.\n */\nexport function useWidgetVerdict(): WidgetVerdict | undefined {\n return useWidget().data?.verdict;\n}\n\n// ─── Card ───────────────────────────────────────────────────────────────────\n\nfunction WidgetCard({ children }: { children: ReactNode }) {\n const { meta } = useWidget();\n return (\n <Card\n // A verdict that needs the owner rings the card in its status mark, so\n // Home's \"needs you\" is found at a glance; the verdict is decided in\n // `Widget.DataState` below, so the card follows its header's pill.\n tone=\"verdict\"\n // Bleed: the header, body and footers pad themselves so a list or\n // chart can run to the card's edges.\n layout=\"bleed\"\n className={cn('@container/widget relative h-full', meta.className)}\n data-widget-id={meta.widgetId}\n >\n <WidgetAskSlotProvider>\n {children}\n <WidgetFreshness />\n </WidgetAskSlotProvider>\n </Card>\n );\n}\n\n// ─── Header ─────────────────────────────────────────────────────────────────\n\n/**\n * The header's one trailing control (the design system's widget rules): a \"View all ›\"\n * link to where the data lives, or a period switch. Everything else goes in\n * the ⋯ menu.\n */\nexport type WidgetHeaderTrailing =\n | {\n kind: 'link';\n href: string;\n label: ReactNode;\n /** Open in a new tab. */\n external?: boolean;\n }\n | {\n kind: 'period';\n value: string;\n options: ReadonlyArray<{ value: string; label: string }>;\n onChange: (value: string) => void;\n /** Accessible name; defaults to \"Period\". */\n label?: string;\n };\n\nfunction HeaderTrailing({ trailing }: { trailing: WidgetHeaderTrailing }) {\n if (trailing.kind === 'link') {\n const link = trailing.external ? (\n <a href={trailing.href} target=\"_blank\" rel=\"noopener noreferrer\" />\n ) : (\n <Link href={trailing.href} />\n );\n\n return (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n render={link}\n nativeButton={false}\n data-test=\"widget-header-link\"\n >\n {trailing.label}\n <Icon name=\"caret-right\" aria-hidden />\n </Button>\n );\n }\n\n return (\n <Select\n value={trailing.value}\n onValueChange={(value) => {\n if (typeof value === 'string') trailing.onChange(value);\n }}\n >\n <SelectTrigger\n size=\"sm\"\n aria-label={trailing.label ?? 'Period'}\n data-test=\"widget-header-period\"\n >\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {trailing.options.map((option) => (\n <SelectItem key={option.value} value={option.value}>\n {option.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n );\n}\n\nconst VERDICT_BADGE_TONE = {\n attention: 'warning',\n critical: 'destructive',\n degraded: 'warning',\n unknown: 'neutral',\n} as const;\n\n/** Only the verdicts that ask something of the owner fill their pill. */\nconst VERDICT_BADGE_PROMINENT = {\n attention: true,\n critical: true,\n degraded: false,\n unknown: false,\n} as const;\n\n/**\n * The verdict under the title. Anything but `clear` is a status pill, the\n * words carrying the tone and the dot confirming it. `clear` is plain ink and\n * a check, no colour at all (plan 251 D24): calm is the absence of colour,\n * so colour on a dashboard always means \"look here\".\n */\nfunction VerdictLine({ verdict }: { verdict: WidgetVerdict }) {\n if (verdict.tone === 'clear') {\n return (\n <p\n className=\"text-foreground flex min-w-0 items-center gap-1.5 text-sm\"\n data-test=\"widget-verdict\"\n data-verdict=\"clear\"\n >\n <Icon name=\"check-circle\" aria-hidden />\n <span className=\"truncate\">{verdict.sentence}</span>\n </p>\n );\n }\n\n return (\n <StatusBadge\n tone={VERDICT_BADGE_TONE[verdict.tone]}\n prominent={VERDICT_BADGE_PROMINENT[verdict.tone]}\n className=\"max-w-full\"\n data-test=\"widget-verdict\"\n data-verdict={verdict.tone}\n >\n <span className=\"truncate\">{verdict.sentence}</span>\n </StatusBadge>\n );\n}\n\n/** Widgets already warned about `children` beside `trailing`, so each warns once. */\nconst warnedChildrenWithTrailing = new Set<string>();\n\nfunction WidgetHeader({\n title,\n subtitle,\n description,\n context,\n trailing,\n menu,\n children,\n}: {\n /** Override the provider's title — useful when the rendered name differs from the config name. */\n title?: string;\n /**\n * Override the provider's subtitle. It renders as the context line when\n * `context` is not set.\n */\n subtitle?: string;\n /** Override the provider's description — useful for widget-computed values. */\n description?: string;\n /**\n * One muted line under the title that frames the data: \"This month\",\n * \"As of today\", \"3 accounts\". A verdict that needs the owner replaces it;\n * a clear one joins it (\"This month · All caught up\").\n */\n context?: ReactNode;\n /** At most one control on the right: a \"View all ›\" link or a period switch. */\n trailing?: WidgetHeaderTrailing;\n /**\n * `Widget.MenuItem`s and `Widget.MenuChoice`s placed at the top of the\n * header's ⋯ menu: occasional actions (\"Open in QuickBooks\") and secondary\n * settings (a comparison basis) that don't earn the one trailing slot.\n */\n menu?: ReactNode;\n /**\n * @deprecated Free controls beside the ⋯ menu. Use `trailing` for the one\n * control a header carries and `menu` for the rest; `children` goes away\n * in a later major release.\n */\n children?: ReactNode;\n}) {\n const { meta, state, data } = useWidget();\n const effectiveTitle = title ?? meta.title;\n const effectiveDescription = description ?? meta.description;\n const contextLine = context ?? subtitle ?? meta.subtitle;\n // A verdict speaks for data on screen, so it shows only while active.\n const verdict = state.state === 'active' ? data?.verdict : undefined;\n\n if (\n process.env.NODE_ENV !== 'production' &&\n children &&\n trailing &&\n !warnedChildrenWithTrailing.has(meta.widgetId)\n ) {\n warnedChildrenWithTrailing.add(meta.widgetId);\n console.warn(\n `Widget.Header (${meta.widgetId}): pass \\`trailing\\` or \\`children\\`, not both. \\`children\\` is deprecated; move other controls into \\`menu\\`.`,\n );\n }\n\n if (!effectiveTitle) return null;\n\n const titleNode = effectiveDescription ? (\n <>\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger render={<CardTitle className=\"truncate\" />}>\n {effectiveTitle}\n </TooltipTrigger>\n <TooltipContent>\n <p>{effectiveDescription}</p>\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n <span className=\"sr-only\">{effectiveDescription}</span>\n </>\n ) : (\n <CardTitle className=\"truncate\">{effectiveTitle}</CardTitle>\n );\n\n const subline =\n verdict && verdict.tone !== 'clear' ? (\n <VerdictLine verdict={verdict} />\n ) : contextLine ? (\n <CardDescription className=\"truncate\" data-test=\"widget-header-context\">\n {contextLine}\n {verdict ? (\n <>\n {' · '}\n <span data-test=\"widget-verdict\" data-verdict=\"clear\">\n {verdict.sentence}\n </span>\n </>\n ) : null}\n </CardDescription>\n ) : verdict ? (\n <VerdictLine verdict={verdict} />\n ) : null;\n\n return (\n <CardHeader className=\"py-card\">\n {titleNode}\n {subline}\n <CardAction className=\"flex items-center gap-2\">\n {trailing ? <HeaderTrailing trailing={trailing} /> : null}\n {children}\n <WidgetAskHeaderSlot />\n <WidgetMenu items={menu} />\n </CardAction>\n </CardHeader>\n );\n}\n\n/**\n * The actions every widget shares, whatever it renders: open its full\n * surface, reload it, collapse it, pin or unpin it. One menu per widget, so\n * collapse lives here rather than as a second header control. Each item needs\n * something from the host or the widget's data layer, so the menu shows only\n * what applies — and nothing at all when nothing does.\n */\nfunction WidgetMenu({ items }: { items?: ReactNode }) {\n const { state, actions, meta, data } = useWidget();\n const refresh = state.state === 'active' ? data?.refresh : undefined;\n const hasNavigation = !!items || !!meta.openHref || !!refresh;\n\n const hasLayout = !!meta.isCollapsible || !!meta.isPinnable;\n\n if (!hasNavigation && !hasLayout) return null;\n\n const title = meta.title ?? 'widget';\n\n return (\n <DropdownMenu>\n <DropdownMenuTrigger\n render={\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label={`Actions for ${title}`}\n data-test={`widget-menu-${meta.widgetId}`}\n />\n }\n >\n <Icon name=\"dots-three\" aria-hidden />\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n {items}\n {meta.openHref ? (\n <DropdownMenuItem render={<Link href={meta.openHref} />}>\n <Icon name=\"arrow-square-out\" aria-hidden />\n <Trans\n i18nKey=\"dashboard:widgetOpenInWorkspace\"\n defaults=\"Open in workspace\"\n />\n </DropdownMenuItem>\n ) : null}\n {refresh ? (\n <DropdownMenuItem onClick={refresh} disabled={data?.refreshing}>\n <Icon name=\"arrows-clockwise\" aria-hidden />\n <Trans i18nKey=\"dashboard:widgetRefresh\" defaults=\"Refresh\" />\n </DropdownMenuItem>\n ) : null}\n {hasNavigation && hasLayout ? <DropdownMenuSeparator /> : null}\n {meta.isCollapsible ? (\n <DropdownMenuItem\n onClick={actions.toggleCollapsed}\n disabled={state.pendingCollapse}\n data-test={`widget-menu-collapse-${meta.widgetId}`}\n >\n <Icon\n name={state.collapsed ? 'arrows-out-simple' : 'arrows-in-simple'}\n aria-hidden\n />\n {state.collapsed ? (\n <Trans i18nKey=\"dashboard:widgetExpand\" defaults=\"Expand\" />\n ) : (\n <Trans i18nKey=\"dashboard:widgetCollapse\" defaults=\"Collapse\" />\n )}\n </DropdownMenuItem>\n ) : null}\n {meta.isPinnable ? (\n <DropdownMenuItem\n onClick={actions.togglePinned}\n disabled={state.pendingPin}\n data-test={`widget-menu-pin-${meta.widgetId}`}\n >\n <Icon\n name={state.pinned ? 'push-pin-slash' : 'push-pin'}\n aria-hidden\n />\n {state.pinned ? (\n <Trans\n i18nKey=\"dashboard:widgetUnpin\"\n defaults=\"Unpin from board\"\n />\n ) : (\n <Trans i18nKey=\"dashboard:widgetPin\" defaults=\"Pin to board\" />\n )}\n </DropdownMenuItem>\n ) : null}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\n/**\n * One widget-specific entry in the header's ⋯ menu; pass it through\n * `Widget.Header`'s `menu` prop. With `href` it is a link, opened in a new tab\n * when `external`; otherwise it runs `onSelect`.\n */\nfunction WidgetMenuItem({\n icon,\n href,\n external = false,\n onSelect,\n disabled,\n children,\n}: {\n /** A Phosphor icon name, e.g. `envelope`. */\n icon?: string;\n href?: string;\n external?: boolean;\n onSelect?: () => void;\n disabled?: boolean;\n children: ReactNode;\n}) {\n const link = !href ? undefined : external ? (\n <a href={href} target=\"_blank\" rel=\"noopener noreferrer\" />\n ) : (\n <Link href={href} />\n );\n\n return (\n <DropdownMenuItem render={link} onClick={onSelect} disabled={disabled}>\n <Icon\n name={icon ?? (external ? 'arrow-square-out' : 'arrow-right')}\n aria-hidden\n />\n {children}\n </DropdownMenuItem>\n );\n}\n\n/**\n * A setting that doesn't earn the header's one trailing slot (a comparison\n * basis, an as-of month), as a submenu of choices in the ⋯ menu. Pass it\n * through `Widget.Header`'s `menu` prop.\n */\nfunction WidgetMenuChoice<Value extends string>({\n icon,\n label,\n value,\n options,\n onChange,\n}: {\n /** A Phosphor icon name, e.g. `scales`. */\n icon?: string;\n label: ReactNode;\n value: Value;\n options: ReadonlyArray<{ value: Value; label: ReactNode }>;\n onChange: (value: Value) => void;\n}) {\n const current = options.find((option) => option.value === value);\n\n return (\n <DropdownMenuSub>\n <DropdownMenuSubTrigger>\n <Icon name={icon ?? 'sliders-horizontal'} aria-hidden />\n <span className=\"flex-1\">{label}</span>\n {current ? (\n <span className=\"text-muted-foreground text-xs\">{current.label}</span>\n ) : null}\n </DropdownMenuSubTrigger>\n <DropdownMenuSubContent>\n <DropdownMenuRadioGroup\n value={value}\n onValueChange={(next) => {\n const match = options.find((option) => option.value === next);\n if (match) onChange(match.value);\n }}\n >\n {options.map((option) => (\n <DropdownMenuRadioItem key={option.value} value={option.value}>\n {option.label}\n </DropdownMenuRadioItem>\n ))}\n </DropdownMenuRadioGroup>\n </DropdownMenuSubContent>\n </DropdownMenuSub>\n );\n}\n\n/**\n * \"Updated 3 minutes ago\" under an active widget whose data layer reports\n * when it last loaded (see `Widget.DataState`'s `updatedAt`).\n */\nfunction WidgetFreshness() {\n const { state, data } = useWidget();\n const updated = useRelativeTime(data?.updatedAt);\n\n if (state.state !== 'active' || state.collapsed || !updated) return null;\n\n return (\n <div\n className=\"text-muted-foreground px-card py-row flex items-center gap-1.5 border-t text-xs\"\n aria-live=\"polite\"\n >\n {data?.refreshing ? (\n <>\n <Icon name=\"arrows-clockwise\" className=\"animate-spin\" aria-hidden />\n <Trans i18nKey=\"dashboard:widgetRefreshing\" defaults=\"Refreshing…\" />\n </>\n ) : (\n <Trans\n i18nKey=\"dashboard:widgetUpdated\"\n defaults=\"Updated {{time}}\"\n values={{ time: updated }}\n />\n )}\n </div>\n );\n}\n\n// ─── State-gated content ────────────────────────────────────────────────────\n\nfunction CollapsibleBody({\n collapsed,\n maxContentHeight,\n widgetId,\n children,\n}: {\n collapsed: boolean;\n maxContentHeight?: string;\n widgetId: string;\n children: ReactNode;\n}) {\n return (\n <div\n className={cn(\n 'transition-fold grid min-h-0 flex-1 motion-reduce:transition-none',\n collapsed ? 'grid-rows-[0fr]' : 'grid-rows-[1fr]',\n )}\n >\n <div className=\"min-h-0 overflow-hidden\">\n <div\n id={`widget-content-${widgetId}`}\n className={cn(\n 'flex h-full min-h-0 flex-1 flex-col overflow-y-auto',\n 'transition-opacity duration-(--duration-enter) ease-(--ease-enter) motion-reduce:transition-none',\n collapsed ? 'opacity-0' : 'opacity-100',\n maxContentHeight && 'max-h-(--widget-max-height)',\n )}\n style={\n maxContentHeight\n ? ({ '--widget-max-height': maxContentHeight } as CSSProperties)\n : undefined\n }\n >\n {children}\n </div>\n </div>\n </div>\n );\n}\n\nfunction StaticBody({\n maxContentHeight,\n children,\n}: {\n maxContentHeight?: string;\n children: ReactNode;\n}) {\n const { innerRef, height } = useAnimatedHeight();\n return (\n <div className=\"flex min-h-0 flex-1 flex-col\">\n <div\n className={cn(\n 'transition-fold h-(--body-height) overflow-hidden motion-reduce:transition-none',\n maxContentHeight && 'max-h-(--widget-max-height)',\n )}\n style={\n {\n '--body-height': height === 'auto' ? 'auto' : `${height}px`,\n '--widget-max-height': maxContentHeight,\n } as CSSProperties\n }\n >\n <div ref={innerRef}>{children}</div>\n </div>\n </div>\n );\n}\n\n/**\n * The standard padded body for content rendered inside `Widget.Active`.\n *\n * `Widget.Active`'s body has no padding — deliberately, so a\n * full-bleed chart or table can run edge-to-edge inside the card. That means\n * ordinary content (text, rows, a KPI readout) is left flush against the\n * card's sides while `Widget.Header` stays inset (`px-card`) unless the body\n * supplies its own padding. `Widget.Body` is that padding: `px-card` matches\n * the header's horizontal inset so header and body align, and `pb-card`\n * matches the header's top.\n *\n * Every widget wraps its content in it:\n *\n * ```tsx\n * <Widget.Active>\n * <Widget.Body>{/* text, a Stat, a form *\\/}</Widget.Body>\n * </Widget.Active>\n * ```\n *\n * Pass `flush` when the content runs to the card's edges: edge-to-edge rows\n * that pad themselves, a chart, a table with its own header row, an image.\n */\nfunction WidgetBody({\n flush = false,\n className,\n children,\n}: {\n /**\n * Drop the padding for content that runs to the card's edges: edge-to-edge\n * rows (which pad themselves, `px-card py-row`), a full-bleed chart, an image.\n */\n flush?: boolean;\n className?: string;\n children: ReactNode;\n}) {\n return (\n <div\n className={cn(\n 'flex flex-1 flex-col',\n flush ? 'pb-2' : 'px-card pb-card gap-4',\n className,\n )}\n data-flush={flush || undefined}\n >\n {children}\n </div>\n );\n}\n\n/**\n * Renders `children` once the widget's state is `active`. Its body\n * is flush; wrap content in `Widget.Body`, which pads it to line up\n * with the header, or `Widget.Body flush` for edge-to-edge rows and charts.\n * Never hand-roll a `px-*` wrapper.\n */\nfunction WidgetActive({ children }: { children: ReactNode }) {\n const { state, meta, data } = useWidget();\n if (state.state !== 'active') return null;\n const body = (\n <WidgetErrorBoundary widgetId={meta.widgetId} onRetry={data?.refresh}>\n {children}\n </WidgetErrorBoundary>\n );\n return meta.isCollapsible ? (\n <CollapsibleBody\n collapsed={state.collapsed}\n maxContentHeight={meta.maxContentHeight}\n widgetId={meta.widgetId}\n >\n {body}\n </CollapsibleBody>\n ) : (\n <StaticBody maxContentHeight={meta.maxContentHeight}>{body}</StaticBody>\n );\n}\n\n/**\n * Shows while the widget loads: a skeleton shaped like its body (`variant`,\n * `rows` by default), never a spinner.\n */\nfunction WidgetLoading({\n variant,\n children,\n}: {\n variant?: WidgetSkeletonVariant;\n children?: ReactNode;\n}) {\n const { state } = useWidget();\n if (state.state !== 'loading') return null;\n return (\n <div className=\"flex min-h-0 flex-1 flex-col\">\n {children ?? <WidgetLoadingSkeleton variant={variant} />}\n </div>\n );\n}\n\n/**\n * Shows when the widget's data failed to load. Offers Try again whenever the\n * widget reports `onRefresh` through `Widget.DataState`. `title` and\n * `description` replace the default copy with something specific (\"Couldn't\n * load your inbox\").\n */\nfunction WidgetError({\n title,\n description,\n children,\n}: {\n title?: ReactNode;\n description?: ReactNode;\n children?: ReactNode;\n}) {\n const { state, data } = useWidget();\n if (state.state !== 'error') return null;\n return (\n <div className=\"flex min-h-0 flex-1 flex-col\">\n {children ?? (\n <WidgetErrorState\n title={title}\n description={description}\n onRetry={data?.refresh}\n retrying={data?.refreshing}\n />\n )}\n </div>\n );\n}\n\n/**\n * Shows when the widget can't reach its data. Give it a `reason`:\n * `not-connected` (one Connect button in `action`), `no-access` (a calm note\n * pointing to an admin) or `setup-needed`. `integrationName` defaults to the\n * host's source name.\n */\nfunction WidgetInactive({\n children,\n integrationName,\n ...props\n}: WidgetInactiveStateProps & { children?: ReactNode }) {\n const { state, meta } = useWidget();\n if (state.state !== 'inactive') return null;\n return (\n <div className=\"flex min-h-0 flex-1 flex-col\">\n {children ?? (\n <WidgetInactiveState\n integrationName={integrationName ?? meta.source?.name}\n {...props}\n />\n )}\n </div>\n );\n}\n\n/**\n * What an active widget shows when it has nothing to list. Render it inside\n * `Widget.Active`. Positive by default (\"You're all caught up\"), because an\n * empty queue is good news; `tone=\"neutral\"` for an empty search.\n */\nfunction WidgetEmpty(props: WidgetEmptyStateProps) {\n return <WidgetEmptyState {...props} />;\n}\n\nfunction WidgetDisabled({ children }: { children?: ReactNode }) {\n const { state } = useWidget();\n if (state.state !== 'disabled') return null;\n return (\n <div className=\"flex min-h-0 flex-1 flex-col\">\n {children ?? <WidgetDisabledState />}\n </div>\n );\n}\n\n// ─── Footers ────────────────────────────────────────────────────────────────\n\nfunction WidgetFooter({ children }: { children: ReactNode }) {\n const { state, meta } = useWidget();\n if (state.state !== 'active') return null;\n return (\n <CardFooter\n className={cn(\n 'transition-opacity motion-reduce:transition-none',\n meta.isCollapsible && state.collapsed\n ? 'pointer-events-none opacity-0'\n : 'opacity-100',\n )}\n aria-hidden={meta.isCollapsible && state.collapsed}\n >\n {children}\n </CardFooter>\n );\n}\n\nfunction WidgetActions({ children }: { children: ReactNode }) {\n return <CardFooter className=\"justify-end\">{children}</CardFooter>;\n}\n\n/** A header-placed Ask, beside the ⋯ menu. */\nfunction WidgetAskHeaderSlot() {\n const presentation = useWidgetAskPresentation();\n const slot = useWidgetAskSlot();\n if (!presentation || !slot?.context) return null;\n return presentation.render(slot.context);\n}\n\nfunction WidgetAskFooter({ context }: { context?: WidgetAskContext }) {\n const presentation = useWidgetAskPresentation();\n const { state, meta, data } = useWidget();\n const effectiveContext = context ?? meta.askContext;\n const shouldShow =\n (meta.aiFooterEnabled || !!effectiveContext) &&\n state.state === 'active' &&\n !state.collapsed;\n const base = effectiveContext ?? {\n widgetId: meta.widgetId,\n title: meta.title ?? meta.widgetId,\n snapshot: null,\n suggestedPrompt: `Tell me about ${meta.title ?? 'this widget'}.`,\n };\n const askContext = withVerdict(base, data?.verdict);\n usePublishAskContext(askContext, shouldShow && !!presentation);\n if (!shouldShow || presentation) return null;\n return <WidgetAskBar context={askContext} />;\n}\n\n/**\n * Adds the widget's own conclusion to what the assistant sees, so an answer\n * starts from the verdict on the card instead of re-deriving it.\n */\nfunction withVerdict(\n context: WidgetAskContext,\n verdict: WidgetVerdict | undefined,\n): WidgetAskContext {\n if (!verdict) return context;\n return {\n ...context,\n snapshot: {\n ...context.snapshot,\n verdict: {\n tone: verdict.tone,\n sentence: verdict.sentence,\n ...(verdict.count !== undefined ? { count: verdict.count } : {}),\n },\n },\n };\n}\n\n/**\n * Renders a subtle \"data may be stale\" banner when the widget's integration is\n * `degraded` (but still active). Unhealthy integrations route to `disabled`\n * instead, so this only fires for the degraded middle ground.\n */\nfunction WidgetHealthFooter() {\n const { state, meta } = useWidget();\n const lastSuccessAt = toEpochMs(meta.health?.lastSuccessAt);\n const lastSynced = useRelativeTime(lastSuccessAt);\n const shouldShow =\n state.state === 'active' &&\n !state.collapsed &&\n meta.health?.status === 'degraded';\n if (!shouldShow) return null;\n return (\n <div className=\"text-warning bg-warning-surface px-card py-row flex items-center gap-2 border-t text-xs\">\n <Icon name=\"warning-circle\" aria-hidden />\n <span>\n {lastSynced ? (\n <Trans\n i18nKey=\"common:integrationHealth.degradedWidgetNoticeSince\"\n defaults=\"Data may be out of date. Last synced {{time}}.\"\n values={{ time: lastSynced }}\n />\n ) : (\n <Trans\n i18nKey=\"common:integrationHealth.degradedWidgetNotice\"\n defaults=\"This integration is degraded — data may be stale.\"\n />\n )}\n </span>\n </div>\n );\n}\n\nfunction toEpochMs(\n value: number | string | Date | null | undefined,\n): number | undefined {\n if (value === null || value === undefined) return undefined;\n const ms =\n value instanceof Date ? value.getTime() : new Date(value).getTime();\n return Number.isFinite(ms) && ms > 0 ? ms : undefined;\n}\n\n// ─── Data state override ────────────────────────────────────────────────────\n\n/** A widget's own data, as `Widget.DataState` takes it. */\nexport type WidgetDataStatus = 'ready' | 'loading' | 'error' | 'inactive';\n\n/**\n * Wraps children in a sub-provider that overrides the effective render state\n * with the widget's own data loading / error state. Only overrides when the\n * parent state is `active` — so the integration's `inactive` / `disabled` /\n * `loading` (initial) states still win.\n *\n * Pass the widget's own query as `query` and the component works out the\n * status, the shared Refresh menu item, the Try again button on its error\n * view and the \"Updated 3 minutes ago\" footer. A connector widget that waits\n * on an upstream OAuth connection also passes `connection`, the\n * `useOAuthWidgetGate` result:\n *\n * ```tsx\n * const { state } = use(WidgetContext);\n * const gate = useOAuthWidgetGate(accountId, state.state === 'active', opts);\n * const query = useMyData(accountId, gate.dataEnabled);\n * return (\n * <Widget.DataState query={query} connection={gate}>\n * <Widget.Card>…</Widget.Card>\n * </Widget.DataState>\n * );\n * ```\n *\n * A failed background refresh keeps the card on its rows (`ready`); only a\n * read that failed with nothing on screen shows the error view. The rule is\n * `widgetQueryStatus`. `status`, `onRefresh`, `refreshing` and `updatedAt`\n * still take explicit values and win over what `query` gives.\n */\nfunction WidgetDataState({\n query,\n connection,\n status: statusProp,\n loading,\n error,\n inactive,\n onRefresh: onRefreshProp,\n refreshing: refreshingProp,\n updatedAt: updatedAtProp,\n verdict,\n children,\n}: {\n /** The widget's own read; a TanStack Query result fits. */\n query?: WidgetQuery;\n /** The upstream connection the read waits on (`useOAuthWidgetGate`). */\n connection?: WidgetConnectionGate;\n /**\n * The widget's own data state. `inactive` is a widget-level \"not connected\"\n * state while the integration itself is active (the product is activated\n * but the upstream OAuth connection is missing). Defaults to `ready`.\n */\n status?: WidgetDataStatus;\n /** @deprecated Pass `status=\"loading\"`. */\n loading?: boolean;\n /** @deprecated Pass `status=\"error\"`. */\n error?: boolean;\n /** @deprecated Pass `status=\"inactive\"`; it wins over loading and error. */\n inactive?: boolean;\n /** Reloads the widget's data. */\n onRefresh?: () => void;\n /** A reload is in flight. */\n refreshing?: boolean;\n /**\n * When the data on screen last loaded successfully: epoch milliseconds, an\n * ISO string or a `Date`. `0` means never, which TanStack Query's\n * `dataUpdatedAt` reports before the first success.\n */\n updatedAt?: number | string | Date | null;\n /**\n * The widget's verdict on its data (the design system's widget rules): `{ tone,\n * sentence, count? }`. Compute it with the same function the integration's\n * server `getAttention` uses, so the card and home's Needs you agree.\n */\n verdict?: WidgetVerdict;\n children: ReactNode;\n}) {\n const parent = useWidget();\n const refetch = query?.refetch;\n // `refetch` is stable across renders, so the context value is too.\n const queryRefresh = useCallback(() => void refetch?.(), [refetch]);\n const status =\n statusProp ?? (query ? widgetQueryStatus(query, connection) : undefined);\n const onRefresh = onRefreshProp ?? (query ? queryRefresh : undefined);\n const refreshing = refreshingProp ?? query?.isFetching ?? false;\n const updatedAt = updatedAtProp ?? query?.dataUpdatedAt;\n const own: WidgetDataStatus =\n status ??\n (inactive ? 'inactive' : loading ? 'loading' : error ? 'error' : 'ready');\n const overrideState: WidgetRenderState =\n parent.state.state !== 'active'\n ? parent.state.state\n : own === 'ready'\n ? 'active'\n : own;\n const updatedAtMs = toEpochMs(updatedAt);\n const reportsData =\n onRefresh !== undefined ||\n updatedAtMs !== undefined ||\n verdict !== undefined;\n const value = useMemo(\n () => ({\n state: { ...parent.state, state: overrideState },\n actions: parent.actions,\n meta: parent.meta,\n data: reportsData\n ? { updatedAt: updatedAtMs, refreshing, refresh: onRefresh, verdict }\n : parent.data,\n }),\n [\n parent.state,\n parent.actions,\n parent.meta,\n parent.data,\n overrideState,\n reportsData,\n updatedAtMs,\n refreshing,\n onRefresh,\n verdict,\n ],\n );\n return <WidgetContext value={value}>{children}</WidgetContext>;\n}\n\n// ─── Compound export ────────────────────────────────────────────────────────\n\nexport const Widget = {\n Card: WidgetCard,\n Header: WidgetHeader,\n MenuItem: WidgetMenuItem,\n MenuChoice: WidgetMenuChoice,\n DataState: WidgetDataState,\n Active: WidgetActive,\n Body: WidgetBody,\n Empty: WidgetEmpty,\n Loading: WidgetLoading,\n Error: WidgetError,\n Inactive: WidgetInactive,\n Disabled: WidgetDisabled,\n Footer: WidgetFooter,\n Actions: WidgetActions,\n AskFooter: WidgetAskFooter,\n HealthFooter: WidgetHealthFooter,\n};\n"]}
1
+ {"version":3,"file":"widget.js","sourceRoot":"","sources":["../../../src/components/widgets/widget.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;AAEb,OAAO,EACL,SAAS,EAGT,GAAG,EACH,WAAW,EACX,OAAO,GACR,MAAM,OAAO,CAAC;AAEf,OAAO,IAAI,MAAM,cAAc,CAAC;AAEhC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EACL,IAAI,EACJ,UAAU,EACV,eAAe,EACf,UAAU,EACV,UAAU,EACV,SAAS,GACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EACL,MAAM,EACN,aAAa,EACb,UAAU,EACV,aAAa,EACb,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EACL,OAAO,EACP,cAAc,EACd,eAAe,EACf,cAAc,GACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAItC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,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AAC,OAAO;QACvB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,IAAI,EAAE,WAAW;YACf,CAAC,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE;YACrE,CAAC,CAAC,MAAM,CAAC,IAAI;KAChB,CAAC,EACF;QACE,MAAM,CAAC,KAAK;QACZ,MAAM,CAAC,OAAO;QACd,MAAM,CAAC,IAAI;QACX,MAAM,CAAC,IAAI;QACX,aAAa;QACb,WAAW;QACX,WAAW;QACX,UAAU;QACV,SAAS;QACT,OAAO;KACR,CACF,CAAC;IACF,OAAO,KAAC,aAAa,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAiB,CAAC;AACjE,CAAC;AAED,+EAA+E;AAE/E,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,YAAY;IACpB,QAAQ,EAAE,cAAc;IACxB,UAAU,EAAE,gBAAgB;IAC5B,SAAS,EAAE,eAAe;IAC1B,MAAM,EAAE,YAAY;IACpB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,WAAW;IAClB,OAAO,EAAE,aAAa;IACtB,KAAK,EAAE,WAAW;IAClB,QAAQ,EAAE,cAAc;IACxB,QAAQ,EAAE,cAAc;IACxB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,aAAa;IACtB,SAAS,EAAE,eAAe;IAC1B,YAAY,EAAE,kBAAkB;CACjC,CAAC","sourcesContent":["'use client';\n\nimport {\n Component,\n type CSSProperties,\n type ReactNode,\n use,\n useCallback,\n useMemo,\n} from 'react';\n\nimport Link from 'next/link.js';\n\nimport { Button } from '@ekanos/ui/button';\nimport {\n Card,\n CardAction,\n CardDescription,\n CardFooter,\n CardHeader,\n CardTitle,\n} from '@ekanos/ui/card';\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n} from '@ekanos/ui/dropdown-menu';\nimport { Icon } from '@ekanos/ui/icon';\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@ekanos/ui/select';\nimport { StatusBadge } from '@ekanos/ui/status-badge';\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from '@ekanos/ui/tooltip';\nimport { Trans } from '@ekanos/ui/trans';\nimport { cn } from '@ekanos/ui/utils';\n\nimport type { WidgetAskContext } from '../../types/widget-ask-context';\nimport type { WidgetVerdict } from '../../types/widget-verdict';\nimport { useAnimatedHeight } from './use-animated-height';\nimport { useRelativeTime } from './use-relative-time';\nimport { WidgetAskBar } from './widget-ask-bar';\nimport {\n WidgetAskSlotProvider,\n usePublishAskContext,\n useWidgetAskPresentation,\n useWidgetAskSlot,\n} from './widget-ask-presentation';\nimport { WidgetContext, type WidgetRenderState } from './widget-context';\nimport {\n type WidgetConnectionGate,\n type WidgetQuery,\n widgetQueryStatus,\n} from './widget-query-state';\nimport {\n WidgetDisabledState,\n WidgetEmptyState,\n type WidgetEmptyStateProps,\n WidgetErrorState,\n WidgetInactiveState,\n type WidgetInactiveStateProps,\n WidgetLoadingSkeleton,\n type WidgetSkeletonVariant,\n} from './widget-state-components';\n\n// ─── Error Boundary ─────────────────────────────────────────────────────────\n\nclass WidgetErrorBoundary extends Component<\n { widgetId: string; onRetry?: () => void; children: ReactNode },\n { hasError: boolean }\n> {\n state = { hasError: false };\n static getDerivedStateFromError() {\n return { hasError: true };\n }\n componentDidCatch(error: Error, info: React.ErrorInfo) {\n console.error(`Widget \"${this.props.widgetId}\" crashed:`, error, info);\n }\n retry = () => {\n this.props.onRetry?.();\n this.setState({ hasError: false });\n };\n render() {\n if (this.state.hasError) {\n return (\n <WidgetErrorState\n title={\n <Trans\n i18nKey=\"dashboard:widgetCrashedTitle\"\n defaults=\"This widget ran into a problem\"\n />\n }\n description={\n <Trans\n i18nKey=\"dashboard:widgetCrashedBody\"\n defaults=\"Try again. If it keeps happening, reload the page.\"\n />\n }\n onRetry={this.retry}\n />\n );\n }\n return this.props.children;\n }\n}\n\n// ─── Hook ───────────────────────────────────────────────────────────────────\n\nfunction useWidget() {\n const ctx = use(WidgetContext);\n if (!ctx) {\n throw new Error(\n 'Widget.* compound components must be rendered inside a widget provider. ' +\n 'On the Ekanos dashboard the host supplies one. Anywhere else — your own ' +\n 'app, a story, a component test — wrap the widget in ' +\n \"`WidgetPreviewProvider` from '@ekanos/sdk/components'.\",\n );\n }\n return ctx;\n}\n\n/**\n * The verdict the widget reported through `Widget.DataState`, for a body that\n * wants to echo it (an empty state, a summary row). `undefined` before the\n * widget has one.\n */\nexport function useWidgetVerdict(): WidgetVerdict | undefined {\n return useWidget().data?.verdict;\n}\n\n// ─── Card ───────────────────────────────────────────────────────────────────\n\nfunction WidgetCard({ children }: { children: ReactNode }) {\n const { meta } = useWidget();\n return (\n <Card\n // A verdict that needs the owner rings the card in its status mark, so\n // Home's \"needs you\" is found at a glance; the verdict is decided in\n // `Widget.DataState` below, so the card follows its header's pill.\n tone=\"verdict\"\n // Bleed: the header, body and footers pad themselves so a list or\n // chart can run to the card's edges.\n layout=\"bleed\"\n // The widget tier: a 20px inset (`surface=\"widget\"`, card-surface.ts).\n surface=\"widget\"\n className={cn('@container/widget relative h-full', meta.className)}\n data-widget-id={meta.widgetId}\n >\n <WidgetAskSlotProvider>\n {children}\n <WidgetFreshness />\n </WidgetAskSlotProvider>\n </Card>\n );\n}\n\n// ─── Header ─────────────────────────────────────────────────────────────────\n\n/**\n * The header's one trailing control (the design system's widget rules): a \"View all ›\"\n * link to where the data lives, or a period switch. Everything else goes in\n * the ⋯ menu.\n */\nexport type WidgetHeaderTrailing =\n | {\n kind: 'link';\n href: string;\n label: ReactNode;\n /** Open in a new tab. */\n external?: boolean;\n }\n | {\n kind: 'period';\n value: string;\n options: ReadonlyArray<{ value: string; label: string }>;\n onChange: (value: string) => void;\n /** Accessible name; defaults to \"Period\". */\n label?: string;\n };\n\nfunction HeaderTrailing({ trailing }: { trailing: WidgetHeaderTrailing }) {\n if (trailing.kind === 'link') {\n const link = trailing.external ? (\n <a href={trailing.href} target=\"_blank\" rel=\"noopener noreferrer\" />\n ) : (\n <Link href={trailing.href} />\n );\n\n return (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n render={link}\n nativeButton={false}\n data-test=\"widget-header-link\"\n >\n {trailing.label}\n <Icon name=\"caret-right\" aria-hidden />\n </Button>\n );\n }\n\n return (\n <Select\n value={trailing.value}\n onValueChange={(value) => {\n if (typeof value === 'string') trailing.onChange(value);\n }}\n >\n <SelectTrigger\n size=\"sm\"\n aria-label={trailing.label ?? 'Period'}\n data-test=\"widget-header-period\"\n >\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {trailing.options.map((option) => (\n <SelectItem key={option.value} value={option.value}>\n {option.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n );\n}\n\nconst VERDICT_BADGE_TONE = {\n attention: 'warning',\n critical: 'destructive',\n degraded: 'warning',\n unknown: 'neutral',\n} as const;\n\n/** Only the verdicts that ask something of the owner fill their pill. */\nconst VERDICT_BADGE_PROMINENT = {\n attention: true,\n critical: true,\n degraded: false,\n unknown: false,\n} as const;\n\n/**\n * The verdict under the title. Anything but `clear` is a status pill, the\n * words carrying the tone and the dot confirming it. `clear` is plain ink and\n * a check, no colour at all (plan 251 D24): calm is the absence of colour,\n * so colour on a dashboard always means \"look here\".\n */\nfunction VerdictLine({ verdict }: { verdict: WidgetVerdict }) {\n if (verdict.tone === 'clear') {\n return (\n <p\n className=\"text-foreground flex min-w-0 items-center gap-1.5 text-sm\"\n data-test=\"widget-verdict\"\n data-verdict=\"clear\"\n >\n <Icon name=\"check-circle\" aria-hidden />\n <span className=\"truncate\">{verdict.sentence}</span>\n </p>\n );\n }\n\n return (\n <StatusBadge\n tone={VERDICT_BADGE_TONE[verdict.tone]}\n prominent={VERDICT_BADGE_PROMINENT[verdict.tone]}\n className=\"max-w-full\"\n data-test=\"widget-verdict\"\n data-verdict={verdict.tone}\n >\n <span className=\"truncate\">{verdict.sentence}</span>\n </StatusBadge>\n );\n}\n\n/** Widgets already warned about `children` beside `trailing`, so each warns once. */\nconst warnedChildrenWithTrailing = new Set<string>();\n\nfunction WidgetHeader({\n title,\n subtitle,\n description,\n context,\n trailing,\n menu,\n children,\n}: {\n /** Override the provider's title — useful when the rendered name differs from the config name. */\n title?: string;\n /**\n * Override the provider's subtitle. It renders as the context line when\n * `context` is not set.\n */\n subtitle?: string;\n /** Override the provider's description — useful for widget-computed values. */\n description?: string;\n /**\n * One muted line under the title that frames the data: \"This month\",\n * \"As of today\", \"3 accounts\". A verdict that needs the owner replaces it;\n * a clear one joins it (\"This month · All caught up\").\n */\n context?: ReactNode;\n /** At most one control on the right: a \"View all ›\" link or a period switch. */\n trailing?: WidgetHeaderTrailing;\n /**\n * `Widget.MenuItem`s and `Widget.MenuChoice`s placed at the top of the\n * header's ⋯ menu: occasional actions (\"Open in QuickBooks\") and secondary\n * settings (a comparison basis) that don't earn the one trailing slot.\n */\n menu?: ReactNode;\n /**\n * @deprecated Free controls beside the ⋯ menu. Use `trailing` for the one\n * control a header carries and `menu` for the rest; `children` goes away\n * in a later major release.\n */\n children?: ReactNode;\n}) {\n const { meta, state, data } = useWidget();\n const effectiveTitle = title ?? meta.title;\n const effectiveDescription = description ?? meta.description;\n const contextLine = context ?? subtitle ?? meta.subtitle;\n // A verdict speaks for data on screen, so it shows only while active.\n const verdict = state.state === 'active' ? data?.verdict : undefined;\n\n if (\n process.env.NODE_ENV !== 'production' &&\n children &&\n trailing &&\n !warnedChildrenWithTrailing.has(meta.widgetId)\n ) {\n warnedChildrenWithTrailing.add(meta.widgetId);\n console.warn(\n `Widget.Header (${meta.widgetId}): pass \\`trailing\\` or \\`children\\`, not both. \\`children\\` is deprecated; move other controls into \\`menu\\`.`,\n );\n }\n\n if (!effectiveTitle) return null;\n\n const titleNode = effectiveDescription ? (\n <>\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger render={<CardTitle size=\"lg\" className=\"truncate\" />}>\n {effectiveTitle}\n </TooltipTrigger>\n <TooltipContent>\n <p>{effectiveDescription}</p>\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n <span className=\"sr-only\">{effectiveDescription}</span>\n </>\n ) : (\n <CardTitle size=\"lg\" className=\"truncate\">\n {effectiveTitle}\n </CardTitle>\n );\n\n const subline =\n verdict && verdict.tone !== 'clear' ? (\n <VerdictLine verdict={verdict} />\n ) : contextLine ? (\n <CardDescription className=\"truncate\" data-test=\"widget-header-context\">\n {contextLine}\n {verdict ? (\n <>\n {' · '}\n <span data-test=\"widget-verdict\" data-verdict=\"clear\">\n {verdict.sentence}\n </span>\n </>\n ) : null}\n </CardDescription>\n ) : verdict ? (\n <VerdictLine verdict={verdict} />\n ) : null;\n\n // One rhythm for every widget: the card's inset above the title, and a\n // short step (12px) below the context line. A padded body adds 4px to make\n // 16; an edge-to-edge list's first row pads itself, so its hover band\n // starts at 12 and its text sits at 24, level with the card's side inset.\n return (\n <CardHeader className=\"pt-card pb-3\">\n {titleNode}\n {subline}\n <CardAction className=\"flex items-center gap-2\">\n {trailing ? <HeaderTrailing trailing={trailing} /> : null}\n {children}\n <WidgetAskHeaderSlot />\n <WidgetMenu items={menu} />\n </CardAction>\n </CardHeader>\n );\n}\n\n/**\n * The actions every widget shares, whatever it renders: open its full\n * surface, reload it, pin or unpin it. One menu per widget. Each item needs\n * something from the host or the widget's data layer, so the menu shows only\n * what applies — and nothing at all when nothing does.\n */\nfunction WidgetMenu({ items }: { items?: ReactNode }) {\n const { state, actions, meta, data } = useWidget();\n const refresh = state.state === 'active' ? data?.refresh : undefined;\n const hasNavigation = !!items || !!meta.openHref || !!refresh;\n\n const hasLayout = !!meta.isPinnable;\n\n if (!hasNavigation && !hasLayout) return null;\n\n const title = meta.title ?? 'widget';\n\n return (\n <DropdownMenu>\n <DropdownMenuTrigger\n render={\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label={`Actions for ${title}`}\n data-test={`widget-menu-${meta.widgetId}`}\n />\n }\n >\n <Icon name=\"dots-three\" aria-hidden />\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n {items}\n {meta.openHref ? (\n <DropdownMenuItem render={<Link href={meta.openHref} />}>\n <Icon name=\"arrow-square-out\" aria-hidden />\n <Trans\n i18nKey=\"dashboard:widgetOpenInWorkspace\"\n defaults=\"Open in workspace\"\n />\n </DropdownMenuItem>\n ) : null}\n {refresh ? (\n <DropdownMenuItem onClick={refresh} disabled={data?.refreshing}>\n <Icon name=\"arrows-clockwise\" aria-hidden />\n <Trans i18nKey=\"dashboard:widgetRefresh\" defaults=\"Refresh\" />\n </DropdownMenuItem>\n ) : null}\n {hasNavigation && hasLayout ? <DropdownMenuSeparator /> : null}\n {meta.isPinnable ? (\n <DropdownMenuItem\n onClick={actions.togglePinned}\n disabled={state.pendingPin}\n data-test={`widget-menu-pin-${meta.widgetId}`}\n >\n <Icon\n name={state.pinned ? 'push-pin-slash' : 'push-pin'}\n aria-hidden\n />\n {state.pinned ? (\n <Trans\n i18nKey=\"dashboard:widgetUnpin\"\n defaults=\"Unpin from board\"\n />\n ) : (\n <Trans i18nKey=\"dashboard:widgetPin\" defaults=\"Pin to board\" />\n )}\n </DropdownMenuItem>\n ) : null}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\n/**\n * One widget-specific entry in the header's ⋯ menu; pass it through\n * `Widget.Header`'s `menu` prop. With `href` it is a link, opened in a new tab\n * when `external`; otherwise it runs `onSelect`.\n */\nfunction WidgetMenuItem({\n icon,\n href,\n external = false,\n onSelect,\n disabled,\n children,\n}: {\n /** A Phosphor icon name, e.g. `envelope`. */\n icon?: string;\n href?: string;\n external?: boolean;\n onSelect?: () => void;\n disabled?: boolean;\n children: ReactNode;\n}) {\n const link = !href ? undefined : external ? (\n <a href={href} target=\"_blank\" rel=\"noopener noreferrer\" />\n ) : (\n <Link href={href} />\n );\n\n return (\n <DropdownMenuItem render={link} onClick={onSelect} disabled={disabled}>\n <Icon\n name={icon ?? (external ? 'arrow-square-out' : 'arrow-right')}\n aria-hidden\n />\n {children}\n </DropdownMenuItem>\n );\n}\n\n/**\n * A setting that doesn't earn the header's one trailing slot (a comparison\n * basis, an as-of month), as a submenu of choices in the ⋯ menu. Pass it\n * through `Widget.Header`'s `menu` prop.\n */\nfunction WidgetMenuChoice<Value extends string>({\n icon,\n label,\n value,\n options,\n onChange,\n}: {\n /** A Phosphor icon name, e.g. `scales`. */\n icon?: string;\n label: ReactNode;\n value: Value;\n options: ReadonlyArray<{ value: Value; label: ReactNode }>;\n onChange: (value: Value) => void;\n}) {\n const current = options.find((option) => option.value === value);\n\n return (\n <DropdownMenuSub>\n <DropdownMenuSubTrigger>\n <Icon name={icon ?? 'sliders-horizontal'} aria-hidden />\n <span className=\"flex-1\">{label}</span>\n {current ? (\n <span className=\"text-muted-foreground text-xs\">{current.label}</span>\n ) : null}\n </DropdownMenuSubTrigger>\n <DropdownMenuSubContent>\n <DropdownMenuRadioGroup\n value={value}\n onValueChange={(next) => {\n const match = options.find((option) => option.value === next);\n if (match) onChange(match.value);\n }}\n >\n {options.map((option) => (\n <DropdownMenuRadioItem key={option.value} value={option.value}>\n {option.label}\n </DropdownMenuRadioItem>\n ))}\n </DropdownMenuRadioGroup>\n </DropdownMenuSubContent>\n </DropdownMenuSub>\n );\n}\n\n/**\n * \"Updated 3 minutes ago\" under an active widget whose data layer reports\n * when it last loaded (see `Widget.DataState`'s `updatedAt`).\n */\nfunction WidgetFreshness() {\n const { state, data } = useWidget();\n const updated = useRelativeTime(data?.updatedAt);\n\n if (state.state !== 'active' || !updated) return null;\n\n return (\n <div\n className=\"text-muted-foreground px-card py-row flex items-center gap-1.5 border-t text-xs\"\n aria-live=\"polite\"\n >\n {data?.refreshing ? (\n <>\n <Icon name=\"arrows-clockwise\" className=\"animate-spin\" aria-hidden />\n <Trans i18nKey=\"dashboard:widgetRefreshing\" defaults=\"Refreshing…\" />\n </>\n ) : (\n <Trans\n i18nKey=\"dashboard:widgetUpdated\"\n defaults=\"Updated {{time}}\"\n values={{ time: updated }}\n />\n )}\n </div>\n );\n}\n\n// ─── State-gated content ────────────────────────────────────────────────────\n\nfunction StaticBody({\n maxContentHeight,\n children,\n}: {\n maxContentHeight?: string;\n children: ReactNode;\n}) {\n const { innerRef, height } = useAnimatedHeight();\n return (\n <div className=\"flex min-h-0 flex-1 flex-col\">\n <div\n className={cn(\n 'transition-fold h-(--body-height) overflow-hidden motion-reduce:transition-none',\n maxContentHeight && 'max-h-(--widget-max-height)',\n )}\n style={\n {\n '--body-height': height === 'auto' ? 'auto' : `${height}px`,\n '--widget-max-height': maxContentHeight,\n } as CSSProperties\n }\n >\n <div ref={innerRef}>{children}</div>\n </div>\n </div>\n );\n}\n\n/**\n * The standard padded body for content rendered inside `Widget.Active`.\n *\n * `Widget.Active`'s body has no padding — deliberately, so a\n * full-bleed chart or table can run edge-to-edge inside the card. That means\n * ordinary content (text, rows, a KPI readout) is left flush against the\n * card's sides while `Widget.Header` stays inset (`px-card`) unless the body\n * supplies its own padding. `Widget.Body` is that padding: `px-card` matches\n * the header's horizontal inset so header and body align, `pt-1` makes the\n * step under the header 16px, and `pb-card` matches the header's top.\n *\n * Every widget wraps its content in it:\n *\n * ```tsx\n * <Widget.Active>\n * <Widget.Body>{/* text, a Stat, a form *\\/}</Widget.Body>\n * </Widget.Active>\n * ```\n *\n * Pass `flush` when the content runs to the card's edges: edge-to-edge rows\n * that pad themselves, a chart, a table with its own header row, an image.\n */\nfunction WidgetBody({\n flush = false,\n className,\n children,\n}: {\n /**\n * Drop the padding for content that runs to the card's edges: edge-to-edge\n * rows (which pad themselves, `px-card py-row`), a full-bleed chart, an image.\n */\n flush?: boolean;\n className?: string;\n children: ReactNode;\n}) {\n return (\n <div\n className={cn(\n 'flex flex-1 flex-col',\n flush ? 'pb-2' : 'px-card pb-card gap-4 pt-1',\n className,\n )}\n data-flush={flush || undefined}\n >\n {children}\n </div>\n );\n}\n\n/**\n * Renders `children` once the widget's state is `active`. Its body\n * is flush; wrap content in `Widget.Body`, which pads it to line up\n * with the header, or `Widget.Body flush` for edge-to-edge rows and charts.\n * Never hand-roll a `px-*` wrapper.\n */\nfunction WidgetActive({ children }: { children: ReactNode }) {\n const { state, meta, data } = useWidget();\n if (state.state !== 'active') return null;\n const body = (\n <WidgetErrorBoundary widgetId={meta.widgetId} onRetry={data?.refresh}>\n {children}\n </WidgetErrorBoundary>\n );\n return (\n <StaticBody maxContentHeight={meta.maxContentHeight}>{body}</StaticBody>\n );\n}\n\n/**\n * Shows while the widget loads: a skeleton shaped like its body (`variant`,\n * `rows` by default), never a spinner.\n */\nfunction WidgetLoading({\n variant,\n children,\n}: {\n variant?: WidgetSkeletonVariant;\n children?: ReactNode;\n}) {\n const { state } = useWidget();\n if (state.state !== 'loading') return null;\n return (\n <div className=\"flex min-h-0 flex-1 flex-col\">\n {children ?? <WidgetLoadingSkeleton variant={variant} />}\n </div>\n );\n}\n\n/**\n * Shows when the widget's data failed to load. Offers Try again whenever the\n * widget reports `onRefresh` through `Widget.DataState`. `title` and\n * `description` replace the default copy with something specific (\"Couldn't\n * load your inbox\").\n */\nfunction WidgetError({\n title,\n description,\n children,\n}: {\n title?: ReactNode;\n description?: ReactNode;\n children?: ReactNode;\n}) {\n const { state, data } = useWidget();\n if (state.state !== 'error') return null;\n return (\n <div className=\"flex min-h-0 flex-1 flex-col\">\n {children ?? (\n <WidgetErrorState\n title={title}\n description={description}\n onRetry={data?.refresh}\n retrying={data?.refreshing}\n />\n )}\n </div>\n );\n}\n\n/**\n * Shows when the widget can't reach its data. Give it a `reason`:\n * `not-connected` (one Connect button in `action`), `no-access` (a calm note\n * pointing to an admin) or `setup-needed`. `integrationName` defaults to the\n * host's source name.\n */\nfunction WidgetInactive({\n children,\n integrationName,\n ...props\n}: WidgetInactiveStateProps & { children?: ReactNode }) {\n const { state, meta } = useWidget();\n if (state.state !== 'inactive') return null;\n return (\n <div className=\"flex min-h-0 flex-1 flex-col\">\n {children ?? (\n <WidgetInactiveState\n integrationName={integrationName ?? meta.source?.name}\n {...props}\n />\n )}\n </div>\n );\n}\n\n/**\n * What an active widget shows when it has nothing to list. Render it inside\n * `Widget.Active`. Positive by default (\"You're all caught up\"), because an\n * empty queue is good news; `tone=\"neutral\"` for an empty search.\n */\nfunction WidgetEmpty(props: WidgetEmptyStateProps) {\n return <WidgetEmptyState {...props} />;\n}\n\nfunction WidgetDisabled({ children }: { children?: ReactNode }) {\n const { state } = useWidget();\n if (state.state !== 'disabled') return null;\n return (\n <div className=\"flex min-h-0 flex-1 flex-col\">\n {children ?? <WidgetDisabledState />}\n </div>\n );\n}\n\n// ─── Footers ────────────────────────────────────────────────────────────────\n\nfunction WidgetFooter({ children }: { children: ReactNode }) {\n const { state } = useWidget();\n if (state.state !== 'active') return null;\n return <CardFooter>{children}</CardFooter>;\n}\n\nfunction WidgetActions({ children }: { children: ReactNode }) {\n return <CardFooter className=\"justify-end\">{children}</CardFooter>;\n}\n\n/**\n * A header-placed Ask, beside the ⋯ menu. On a pointer device it shows on\n * hover (after 150ms, so a pointer crossing the board does not flash every\n * key) or focus of its widget (at once), and while its popover is open; on touch,\n * where there is no hover, it always shows. It keeps its place either way, so\n * the header never shifts.\n */\nfunction WidgetAskHeaderSlot() {\n const presentation = useWidgetAskPresentation();\n const slot = useWidgetAskSlot();\n if (!presentation || !slot?.context) return null;\n return (\n <span\n data-slot=\"widget-ask\"\n className=\"flex transition-opacity duration-(--duration-colour) ease-out pointer-fine:opacity-0 pointer-fine:has-data-popup-open:opacity-100 pointer-fine:[[data-surface=widget]:focus-within_&]:opacity-100 pointer-fine:[[data-surface=widget]:hover_&]:opacity-100 pointer-fine:[[data-surface=widget]:hover_&]:delay-150\"\n >\n {presentation.render(slot.context)}\n </span>\n );\n}\n\nfunction WidgetAskFooter({ context }: { context?: WidgetAskContext }) {\n const presentation = useWidgetAskPresentation();\n const { state, meta, data } = useWidget();\n const effectiveContext = context ?? meta.askContext;\n const shouldShow =\n (meta.aiFooterEnabled || !!effectiveContext) && state.state === 'active';\n const base = effectiveContext ?? {\n widgetId: meta.widgetId,\n title: meta.title ?? meta.widgetId,\n snapshot: null,\n suggestedPrompt: `Tell me about ${meta.title ?? 'this widget'}.`,\n };\n const askContext = withVerdict(base, data?.verdict);\n usePublishAskContext(askContext, shouldShow && !!presentation);\n if (!shouldShow || presentation) return null;\n return <WidgetAskBar context={askContext} />;\n}\n\n/**\n * Adds the widget's own conclusion to what the assistant sees, so an answer\n * starts from the verdict on the card instead of re-deriving it.\n */\nfunction withVerdict(\n context: WidgetAskContext,\n verdict: WidgetVerdict | undefined,\n): WidgetAskContext {\n if (!verdict) return context;\n return {\n ...context,\n snapshot: {\n ...context.snapshot,\n verdict: {\n tone: verdict.tone,\n sentence: verdict.sentence,\n ...(verdict.count !== undefined ? { count: verdict.count } : {}),\n },\n },\n };\n}\n\n/**\n * Renders a subtle \"data may be stale\" banner when the widget's integration is\n * `degraded` (but still active). Unhealthy integrations route to `disabled`\n * instead, so this only fires for the degraded middle ground.\n */\nfunction WidgetHealthFooter() {\n const { state, meta } = useWidget();\n const lastSuccessAt = toEpochMs(meta.health?.lastSuccessAt);\n const lastSynced = useRelativeTime(lastSuccessAt);\n const shouldShow =\n state.state === 'active' && meta.health?.status === 'degraded';\n if (!shouldShow) return null;\n return (\n <div className=\"text-warning bg-warning-surface px-card py-row flex items-center gap-2 border-t text-xs\">\n <Icon name=\"warning-circle\" aria-hidden />\n <span>\n {lastSynced ? (\n <Trans\n i18nKey=\"common:integrationHealth.degradedWidgetNoticeSince\"\n defaults=\"Data may be out of date. Last synced {{time}}.\"\n values={{ time: lastSynced }}\n />\n ) : (\n <Trans\n i18nKey=\"common:integrationHealth.degradedWidgetNotice\"\n defaults=\"This integration is degraded — data may be stale.\"\n />\n )}\n </span>\n </div>\n );\n}\n\nfunction toEpochMs(\n value: number | string | Date | null | undefined,\n): number | undefined {\n if (value === null || value === undefined) return undefined;\n const ms =\n value instanceof Date ? value.getTime() : new Date(value).getTime();\n return Number.isFinite(ms) && ms > 0 ? ms : undefined;\n}\n\n// ─── Data state override ────────────────────────────────────────────────────\n\n/** A widget's own data, as `Widget.DataState` takes it. */\nexport type WidgetDataStatus = 'ready' | 'loading' | 'error' | 'inactive';\n\n/**\n * Wraps children in a sub-provider that overrides the effective render state\n * with the widget's own data loading / error state. Only overrides when the\n * parent state is `active` — so the integration's `inactive` / `disabled` /\n * `loading` (initial) states still win.\n *\n * Pass the widget's own query as `query` and the component works out the\n * status, the shared Refresh menu item, the Try again button on its error\n * view and the \"Updated 3 minutes ago\" footer. A connector widget that waits\n * on an upstream OAuth connection also passes `connection`, the\n * `useOAuthWidgetGate` result:\n *\n * ```tsx\n * const { state } = use(WidgetContext);\n * const gate = useOAuthWidgetGate(accountId, state.state === 'active', opts);\n * const query = useMyData(accountId, gate.dataEnabled);\n * return (\n * <Widget.DataState query={query} connection={gate}>\n * <Widget.Card>…</Widget.Card>\n * </Widget.DataState>\n * );\n * ```\n *\n * A failed background refresh keeps the card on its rows (`ready`); only a\n * read that failed with nothing on screen shows the error view. The rule is\n * `widgetQueryStatus`. `status`, `onRefresh`, `refreshing` and `updatedAt`\n * still take explicit values and win over what `query` gives.\n */\nfunction WidgetDataState({\n query,\n connection,\n status: statusProp,\n loading,\n error,\n inactive,\n onRefresh: onRefreshProp,\n refreshing: refreshingProp,\n updatedAt: updatedAtProp,\n verdict,\n children,\n}: {\n /** The widget's own read; a TanStack Query result fits. */\n query?: WidgetQuery;\n /** The upstream connection the read waits on (`useOAuthWidgetGate`). */\n connection?: WidgetConnectionGate;\n /**\n * The widget's own data state. `inactive` is a widget-level \"not connected\"\n * state while the integration itself is active (the product is activated\n * but the upstream OAuth connection is missing). Defaults to `ready`.\n */\n status?: WidgetDataStatus;\n /** @deprecated Pass `status=\"loading\"`. */\n loading?: boolean;\n /** @deprecated Pass `status=\"error\"`. */\n error?: boolean;\n /** @deprecated Pass `status=\"inactive\"`; it wins over loading and error. */\n inactive?: boolean;\n /** Reloads the widget's data. */\n onRefresh?: () => void;\n /** A reload is in flight. */\n refreshing?: boolean;\n /**\n * When the data on screen last loaded successfully: epoch milliseconds, an\n * ISO string or a `Date`. `0` means never, which TanStack Query's\n * `dataUpdatedAt` reports before the first success.\n */\n updatedAt?: number | string | Date | null;\n /**\n * The widget's verdict on its data (the design system's widget rules): `{ tone,\n * sentence, count? }`. Compute it with the same function the integration's\n * server `getAttention` uses, so the card and home's Needs you agree.\n */\n verdict?: WidgetVerdict;\n children: ReactNode;\n}) {\n const parent = useWidget();\n const refetch = query?.refetch;\n // `refetch` is stable across renders, so the context value is too.\n const queryRefresh = useCallback(() => void refetch?.(), [refetch]);\n const status =\n statusProp ?? (query ? widgetQueryStatus(query, connection) : undefined);\n const onRefresh = onRefreshProp ?? (query ? queryRefresh : undefined);\n const refreshing = refreshingProp ?? query?.isFetching ?? false;\n const updatedAt = updatedAtProp ?? query?.dataUpdatedAt;\n const own: WidgetDataStatus =\n status ??\n (inactive ? 'inactive' : loading ? 'loading' : error ? 'error' : 'ready');\n const overrideState: WidgetRenderState =\n parent.state.state !== 'active'\n ? parent.state.state\n : own === 'ready'\n ? 'active'\n : own;\n const updatedAtMs = toEpochMs(updatedAt);\n const reportsData =\n onRefresh !== undefined ||\n updatedAtMs !== undefined ||\n verdict !== undefined;\n const value = useMemo(\n () => ({\n state: { ...parent.state, state: overrideState },\n actions: parent.actions,\n meta: parent.meta,\n data: reportsData\n ? { updatedAt: updatedAtMs, refreshing, refresh: onRefresh, verdict }\n : parent.data,\n }),\n [\n parent.state,\n parent.actions,\n parent.meta,\n parent.data,\n overrideState,\n reportsData,\n updatedAtMs,\n refreshing,\n onRefresh,\n verdict,\n ],\n );\n return <WidgetContext value={value}>{children}</WidgetContext>;\n}\n\n// ─── Compound export ────────────────────────────────────────────────────────\n\nexport const Widget = {\n Card: WidgetCard,\n Header: WidgetHeader,\n MenuItem: WidgetMenuItem,\n MenuChoice: WidgetMenuChoice,\n DataState: WidgetDataState,\n Active: WidgetActive,\n Body: WidgetBody,\n Empty: WidgetEmpty,\n Loading: WidgetLoading,\n Error: WidgetError,\n Inactive: WidgetInactive,\n Disabled: WidgetDisabled,\n Footer: WidgetFooter,\n Actions: WidgetActions,\n AskFooter: WidgetAskFooter,\n HealthFooter: WidgetHealthFooter,\n};\n"]}
@@ -48,6 +48,7 @@ export interface ExperienceWidget {
48
48
  * exactly as an integration widget does today.
49
49
  */
50
50
  component: ComponentType;
51
+ /** @deprecated Ignored: widgets no longer collapse. */
51
52
  isCollapsible?: boolean;
52
53
  isPinnable?: boolean;
53
54
  aiFooterEnabled?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"define-experience.js","sourceRoot":"","sources":["../../src/experience/define-experience.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAIhB,eAAe,GAChB,MAAM,4BAA4B,CAAC;AA0BpC,MAAM,qBAAqB,GAAsB;IAC/C,OAAO;IACP,QAAQ;IACR,SAAS;IACT,UAAU;IACV,OAAO;IACP,SAAS;IACT,YAAY;IACZ,YAAY;IACZ,QAAQ;IACR,aAAa;IACb,WAAW;IACX,SAAS;CACV,CAAC;AAmKF,SAAS,aAAa,CAAC,IAAyB;;IAC9C,MAAM,IAAI,SAAuB,IAAI,CAAC,IAAI,mCAAI,QAAQ,CAAC;IACvD,MAAM,OAAO,GAAI,IAA2B,CAAC,IAAI,CAAC;IAClD,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;QACxB,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CACb,iDAAiD,IAAI,CAAC,EAAE,+CAA+C,CACxG,CAAC;QACJ,CAAC;IACH,CAAC;SAAM,IAAI,OA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chema,\n type ExperiencePageKind,\n type WidgetLayouts,\n type SuggestedLayout,\n surfaceProblems,\n} from '@ekanos/integration-schema';\n\nimport type { ReadOperationKey, IntegrationName } from './types';\nimport type { WorkflowTemplate } from './workflow-template';\n\n/**\n * Keys that belong to an INTEGRATION and have no meaning on an experience.\n * Typed `never` so passing one is a compile error that names the key; the\n * runtime check in {@link defineExperience} catches the same keys from\n * untyped code.\n */\nexport interface IntegrationOnlyKeys {\n oauth?: never;\n egress?: never;\n storage?: never;\n webhooks?: never;\n tools?: never;\n actions?: never;\n connection?: never;\n activation?: never;\n events?: never;\n agentEvents?: never;\n schedules?: never;\n secrets?: never;\n}\n\nconst INTEGRATION_ONLY_KEYS: readonly string[] = [\n 'oauth',\n 'egress',\n 'storage',\n 'webhooks',\n 'tools',\n 'actions',\n 'connection',\n 'activation',\n 'events',\n 'agentEvents',\n 'schedules',\n 'secrets',\n];\n\nexport type ExperienceWidgetWidth = 'compact' | 'half' | 'full';\n\nexport interface ExperienceWidget {\n /** kebab-case, unique within the experience. */\n id: string;\n title: string;\n /** Integrations this widget calls. Checked against `ekanos.json` `integrations` by `ekanos check`. */\n integrations: readonly IntegrationName[];\n /**\n * How wide the card is. The simple form. Precedence when more than one is\n * declared: `size`, then `layouts.lg.w`, then `width`.\n */\n width?: ExperienceWidgetWidth;\n /** Same as an integration widget's `size`; wins over `layouts` and `width`. */\n size?: ExperienceWidgetWidth;\n /**\n * Same as an integration widget's `layouts`. The grid reads `lg.w` (over 6 is\n * full, 3 or under is compact, otherwise half) and `lg.maxHeight`; `x`, `y`,\n * `h` and the `md` / `sm` boxes are accepted but not used today.\n */\n layouts?: WidgetLayouts;\n /**\n * A plain React component. It receives no integration props: it calls\n * `useOperation` / `useOperationMutation` and renders with `@ekanos/ui`,\n * exactly as an integration widget does today.\n */\n component: ComponentType;\n isCollapsible?: boolean;\n isPinnable?: boolean;\n aiFooterEnabled?: boolean;\n}\n\n/** What a custom page's component receives. */\nexport interface ExperiencePageProps {\n /**\n * The route below the page's own path, as segments: `[]` at the page itself,\n * `['archive']` at `<page path>/archive`. Only the sub-routes a page declares\n * in `routes` are served.\n */\n path: string[];\n}\n\nexport interface ExperiencePageRoute {\n /** kebab-case segments joined by `/`, relative to the page: `archive`, `drafts/new`. */\n path: string;\n title: string;\n}\n\ninterface ExperiencePageBase {\n /** kebab-case, unique within the experience. */\n id: string;\n title: string;\n}\n\n/**\n * The experience's root, shown when someone opens it. Give it a `component`\n * for a hand-built landing page, or none for the host's default overview.\n * An experience has at most one.\n */\nexport interface ExperienceOverviewPageInput extends ExperiencePageBase {\n kind: 'overview';\n path?: never;\n integrations?: readonly IntegrationName[];\n component?: ComponentType<ExperiencePageProps>;\n}\n\n/**\n * A widget dashboard of the experience's own widgets, laid out by the host.\n * No component: `widgets` lists widget ids declared in this experience.\n */\nexport interface ExperienceCanvasPageInput extends ExperiencePageBase {\n kind: 'canvas';\n /** Route segment under the experience, e.g. `review`. */\n path: string;\n widgets: readonly string[];\n integrations?: readonly IntegrationName[];\n component?: never;\n}\n\n/** A page you build yourself. `kind` may be left out: this is the default. */\nexport interface ExperienceCustomPageInput extends ExperiencePageBase {\n kind?: 'custom';\n /** Route segment under the experience, e.g. `review`. */\n path: string;\n /** Sub-routes the component handles; it reads the remainder from its `path` prop. */\n routes?: readonly ExperiencePageRoute[];\n integrations: readonly IntegrationName[];\n component: ComponentType<ExperiencePageProps>;\n}\n\nexport type ExperiencePageInput =\n | ExperienceOverviewPageInput\n | ExperienceCanvasPageInput\n | ExperienceCustomPageInput;\n\n/** A page as `defineExperience` returns it: `kind` and `integrations` always set. */\nexport type ExperiencePage =\n | (Omit<ExperienceOverviewPageInput, 'integrations'> & {\n integrations: readonly IntegrationName[];\n })\n | (Omit<ExperienceCanvasPageInput, 'integrations'> & {\n integrations: readonly IntegrationName[];\n })\n | (Omit<ExperienceCustomPageInput, 'kind'> & { kind: 'custom' });\n\n/**\n * A layout the experience suggests: workspaces (named groups of widgets and\n * pages) a Source admin can apply. Audiences are free-form NAMES, not roles or\n * permissions: a package cannot know a Source's audiences, so the host maps a\n * name to the Source's business type (level-1 audience) of the same name and\n * leaves an item with no match for everyone.\n */\nexport type ExperienceSuggestedLayout = SuggestedLayout;\n\n/** One reads-only section of the review queue; `read` must be a READ op of the integration. */\nexport type ReviewQueueSection = {\n [S in IntegrationName]: {\n id: string;\n integration: S;\n read: ReadOperationKey<S>;\n };\n}[IntegrationName];\n\nexport interface ExperienceReviewQueue {\n readsOnly: true;\n sections: readonly ReviewQueueSection[];\n}\n\n/** A declaration only: the host decides how the sidebar draws it. */\nexport interface ExperienceSidebar {\n section: string;\n icon: string;\n label: string;\n}\n\nexport interface ExperienceInput extends IntegrationOnlyKeys {\n /** kebab-case; must equal `slug` in `ekanos.json`. */\n slug: string;\n name: string;\n description?: string;\n sidebar?: ExperienceSidebar;\n widgets?: readonly ExperienceWidget[];\n pages?: readonly ExperiencePageInput[];\n workflows?: readonly WorkflowTemplate[];\n reviewQueue?: ExperienceReviewQueue;\n suggestedLayout?: ExperienceSuggestedLayout;\n}\n\nexport interface ExperienceDefinition {\n readonly kind: 'experience';\n readonly slug: string;\n readonly name: string;\n readonly description?: string;\n readonly sidebar?: ExperienceSidebar;\n readonly widgets: readonly ExperienceWidget[];\n readonly pages: readonly ExperiencePage[];\n readonly workflows: readonly WorkflowTemplate[];\n readonly reviewQueue?: ExperienceReviewQueue;\n readonly suggestedLayout?: ExperienceSuggestedLayout;\n}\n\nfunction normalizePage(page: ExperiencePageInput): ExperiencePage {\n const kind: ExperiencePageKind = page.kind ?? 'custom';\n const rawPath = (page as { path?: unknown }).path;\n if (kind === 'overview') {\n if (rawPath !== undefined) {\n throw new Error(\n `Invalid experience definition: overview page \"${page.id}\" is the experience's root and takes no path.`,\n );\n }\n } else if (typeof rawPath !== 'string' || rawPath === '') {\n throw new Error(\n `Invalid experience definition: page \"${page.id}\" needs a path (a kebab-case string).`,\n );\n }\n\n return {\n ...page,\n kind,\n integrations: page.integrations ?? [],\n } as ExperiencePage;\n}\n\nconst KEBAB = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;\n\nfunction assertUnique(kind: string, ids: readonly string[]): void {\n const seen = new Set<string>();\n for (const id of ids) {\n if (seen.has(id)) {\n throw new Error(\n `Invalid experience definition: ${kind} id \"${id}\" is declared twice.`,\n );\n }\n seen.add(id);\n }\n}\n\n/**\n * Declare an experience: widgets, pages, workflow templates and a reads-only\n * review queue that reach integrations only through their pinned contracts.\n *\n * Integrations are NOT declared here. They live in `ekanos.json` `integrations` (readable\n * without running code) and `ekanos codegen` types them; naming an integration that is\n * not there is a compile error, and `ekanos check` re-verifies it.\n *\n * @example\n * export default defineExperience({\n * slug: 'content-engine',\n * name: 'Content engine',\n * widgets: [{ id: 'queue', title: 'Queue', integrations: ['cms'], component: Queue }],\n * });\n */\nexport function defineExperience(input: ExperienceInput): ExperienceDefinition {\n const raw = input as unknown as Record<string, unknown>;\n for (const key of INTEGRATION_ONLY_KEYS) {\n if (raw[key] !== undefined) {\n throw new Error(\n `Invalid experience definition: \"${key}\" belongs to an integration. An experience reaches integrations only through the integrations it declares (ekanos.json \"integrations\").`,\n );\n }\n }\n if (!KEBAB.test(input.slug)) {\n throw new Error(\n `Invalid experience definition: slug \"${input.slug}\" must be kebab-case.`,\n );\n }\n if (input.name.trim() === '') {\n throw new Error('Invalid experience definition: name is required.');\n }\n\n const widgets = input.widgets ?? [];\n const pages = input.pages ?? [];\n const workflows = input.workflows ?? [];\n\n for (const widget of widgets) {\n if (!KEBAB.test(widget.id)) {\n throw new Error(\n `Invalid experience definition: widget id \"${widget.id}\" must be kebab-case.`,\n );\n }\n for (const key of ['width', 'size'] as const) {\n const value = widget[key];\n if (value !== undefined && !widgetSizeSchema.safeParse(value).success) {\n throw new Error(\n `Invalid experience definition: widget \"${widget.id}\" ${key} \"${String(value)}\" must be compact, half or full.`,\n );\n }\n }\n if (widget.layouts !== undefined) {\n const parsed = widgetLayoutsSchema.safeParse(widget.layouts);\n if (!parsed.success) {\n throw new Error(\n `Invalid experience definition: widget \"${widget.id}\" layouts is malformed: ${parsed.error.issues.map((i) => `${i.path.join('.')}: ${i.message}`).join('; ')}.`,\n );\n }\n }\n if (\n typeof widget.component !== 'function' &&\n typeof widget.component !== 'object'\n ) {\n throw new Error(\n `Invalid experience definition: widget \"${widget.id}\" needs a component.`,\n );\n }\n }\n const normalizedPages = pages.map(normalizePage);\n for (const page of normalizedPages) {\n if (!(EXPERIENCE_PAGE_KINDS as readonly string[]).includes(page.kind)) {\n throw new Error(\n `Invalid experience definition: page \"${page.id}\" has kind \"${String(page.kind)}\"; use overview, canvas or custom.`,\n );\n }\n if (\n !KEBAB.test(page.id) ||\n (page.kind !== 'overview' && !KEBAB.test(page.path))\n ) {\n throw new Error(\n `Invalid experience definition: page \"${page.id}\" id and path must be kebab-case.`,\n );\n }\n const component = (page as { component?: unknown }).component;\n if (page.kind === 'canvas' && component !== undefined) {\n throw new Error(\n `Invalid experience definition: canvas page \"${page.id}\" takes \"widgets\", not a component.`,\n );\n }\n if (\n page.kind === 'custom' &&\n typeof component !== 'function' &&\n typeof component !== 'object'\n ) {\n throw new Error(\n `Invalid experience definition: page \"${page.id}\" needs a component.`,\n );\n }\n }\n if (input.suggestedLayout !== undefined) {\n const parsed = SuggestedLayoutSchema.safeParse(input.suggestedLayout);\n if (!parsed.success) {\n throw new Error(\n `Invalid experience definition: suggestedLayout is malformed: ${parsed.error.issues.map((i) => `${i.path.join('.')}: ${i.message}`).join('; ')}.`,\n );\n }\n }\n const problems = surfaceProblems({\n widgets,\n pages: normalizedPages.map((page) => ({\n id: page.id,\n kind: page.kind,\n ...(page.kind === 'overview' ? {} : { path: page.path }),\n ...(page.kind === 'canvas' ? { widgets: page.widgets } : {}),\n ...(page.kind === 'custom' && page.routes ? { routes: page.routes } : {}),\n })),\n ...(input.suggestedLayout\n ? { suggestedLayout: input.suggestedLayout }\n : {}),\n });\n if (problems[0] !== undefined) {\n throw new Error(`Invalid experience definition: ${problems[0]}.`);\n }\n assertUnique(\n 'workflow template',\n workflows.map((w) => w.id),\n );\n\n if (input.reviewQueue) {\n if (input.reviewQueue.readsOnly !== true) {\n throw new Error(\n 'Invalid experience definition: reviewQueue.readsOnly must be true.',\n );\n }\n assertUnique(\n 'review queue section',\n input.reviewQueue.sections.map((s) => s.id),\n );\n }\n\n return Object.freeze({\n kind: 'experience' as const,\n slug: input.slug,\n name: input.name,\n ...(input.description === undefined\n ? {}\n : { description: input.description }),\n ...(input.sidebar === undefined ? {} : { sidebar: input.sidebar }),\n widgets: Object.freeze([...widgets]),\n pages: Object.freeze(normalizedPages),\n workflows: Object.freeze([...workflows]),\n ...(input.reviewQueue === undefined\n ? {}\n : { reviewQueue: input.reviewQueue }),\n ...(input.suggestedLayout === undefined\n ? {}\n : { suggestedLayout: input.suggestedLayout }),\n });\n}\n\n/** Integrations an experience definition touches, deduplicated (for `check`/manifest). */\nexport function slotsUsedBy(definition: ExperienceDefinition): string[] {\n const used = new Set<string>();\n for (const widget of definition.widgets)\n for (const s of widget.integrations) used.add(s);\n for (const page of definition.pages)\n for (const s of page.integrations) used.add(s);\n for (const section of definition.reviewQueue?.sections ?? [])\n used.add(section.integration);\n for (const template of definition.workflows) {\n for (const s of template.build())\n if (s.type === 'tool') used.add(s.integration);\n }\n\n return [...used].sort();\n}\n"]}
1
+ {"version":3,"file":"define-experience.js","sourceRoot":"","sources":["../../src/experience/define-experience.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAIhB,eAAe,GAChB,MAAM,4BAA4B,CAAC;AA0BpC,MAAM,qBAAqB,GAAsB;IAC/C,OAAO;IACP,QAAQ;IACR,SAAS;IACT,UAAU;IACV,OAAO;IACP,SAAS;IACT,YAAY;IACZ,YAAY;IACZ,QAAQ;IACR,aAAa;IACb,WAAW;IACX,SAAS;CACV,CAAC;AAoKF,SAAS,aAAa,CAAC,IAAyB;;IAC9C,MAAM,IA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E;YAC9B,IAAI,CAAC,CAAC,IAAI,KAAK,MAAM;gBAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;AAC1B,CAAC","sourcesContent":["import type { ComponentType } from 'react';\n\nimport {\n EXPERIENCE_PAGE_KINDS,\n SuggestedLayoutSchema,\n widgetLayoutsSchema,\n widgetSizeSchema,\n type ExperiencePageKind,\n type WidgetLayouts,\n type SuggestedLayout,\n surfaceProblems,\n} from '@ekanos/integration-schema';\n\nimport type { ReadOperationKey, IntegrationName } from './types';\nimport type { WorkflowTemplate } from './workflow-template';\n\n/**\n * Keys that belong to an INTEGRATION and have no meaning on an experience.\n * Typed `never` so passing one is a compile error that names the key; the\n * runtime check in {@link defineExperience} catches the same keys from\n * untyped code.\n */\nexport interface IntegrationOnlyKeys {\n oauth?: never;\n egress?: never;\n storage?: never;\n webhooks?: never;\n tools?: never;\n actions?: never;\n connection?: never;\n activation?: never;\n events?: never;\n agentEvents?: never;\n schedules?: never;\n secrets?: never;\n}\n\nconst INTEGRATION_ONLY_KEYS: readonly string[] = [\n 'oauth',\n 'egress',\n 'storage',\n 'webhooks',\n 'tools',\n 'actions',\n 'connection',\n 'activation',\n 'events',\n 'agentEvents',\n 'schedules',\n 'secrets',\n];\n\nexport type ExperienceWidgetWidth = 'compact' | 'half' | 'full';\n\nexport interface ExperienceWidget {\n /** kebab-case, unique within the experience. */\n id: string;\n title: string;\n /** Integrations this widget calls. Checked against `ekanos.json` `integrations` by `ekanos check`. */\n integrations: readonly IntegrationName[];\n /**\n * How wide the card is. The simple form. Precedence when more than one is\n * declared: `size`, then `layouts.lg.w`, then `width`.\n */\n width?: ExperienceWidgetWidth;\n /** Same as an integration widget's `size`; wins over `layouts` and `width`. */\n size?: ExperienceWidgetWidth;\n /**\n * Same as an integration widget's `layouts`. The grid reads `lg.w` (over 6 is\n * full, 3 or under is compact, otherwise half) and `lg.maxHeight`; `x`, `y`,\n * `h` and the `md` / `sm` boxes are accepted but not used today.\n */\n layouts?: WidgetLayouts;\n /**\n * A plain React component. It receives no integration props: it calls\n * `useOperation` / `useOperationMutation` and renders with `@ekanos/ui`,\n * exactly as an integration widget does today.\n */\n component: ComponentType;\n /** @deprecated Ignored: widgets no longer collapse. */\n isCollapsible?: boolean;\n isPinnable?: boolean;\n aiFooterEnabled?: boolean;\n}\n\n/** What a custom page's component receives. */\nexport interface ExperiencePageProps {\n /**\n * The route below the page's own path, as segments: `[]` at the page itself,\n * `['archive']` at `<page path>/archive`. Only the sub-routes a page declares\n * in `routes` are served.\n */\n path: string[];\n}\n\nexport interface ExperiencePageRoute {\n /** kebab-case segments joined by `/`, relative to the page: `archive`, `drafts/new`. */\n path: string;\n title: string;\n}\n\ninterface ExperiencePageBase {\n /** kebab-case, unique within the experience. */\n id: string;\n title: string;\n}\n\n/**\n * The experience's root, shown when someone opens it. Give it a `component`\n * for a hand-built landing page, or none for the host's default overview.\n * An experience has at most one.\n */\nexport interface ExperienceOverviewPageInput extends ExperiencePageBase {\n kind: 'overview';\n path?: never;\n integrations?: readonly IntegrationName[];\n component?: ComponentType<ExperiencePageProps>;\n}\n\n/**\n * A widget dashboard of the experience's own widgets, laid out by the host.\n * No component: `widgets` lists widget ids declared in this experience.\n */\nexport interface ExperienceCanvasPageInput extends ExperiencePageBase {\n kind: 'canvas';\n /** Route segment under the experience, e.g. `review`. */\n path: string;\n widgets: readonly string[];\n integrations?: readonly IntegrationName[];\n component?: never;\n}\n\n/** A page you build yourself. `kind` may be left out: this is the default. */\nexport interface ExperienceCustomPageInput extends ExperiencePageBase {\n kind?: 'custom';\n /** Route segment under the experience, e.g. `review`. */\n path: string;\n /** Sub-routes the component handles; it reads the remainder from its `path` prop. */\n routes?: readonly ExperiencePageRoute[];\n integrations: readonly IntegrationName[];\n component: ComponentType<ExperiencePageProps>;\n}\n\nexport type ExperiencePageInput =\n | ExperienceOverviewPageInput\n | ExperienceCanvasPageInput\n | ExperienceCustomPageInput;\n\n/** A page as `defineExperience` returns it: `kind` and `integrations` always set. */\nexport type ExperiencePage =\n | (Omit<ExperienceOverviewPageInput, 'integrations'> & {\n integrations: readonly IntegrationName[];\n })\n | (Omit<ExperienceCanvasPageInput, 'integrations'> & {\n integrations: readonly IntegrationName[];\n })\n | (Omit<ExperienceCustomPageInput, 'kind'> & { kind: 'custom' });\n\n/**\n * A layout the experience suggests: workspaces (named groups of widgets and\n * pages) a Source admin can apply. Audiences are free-form NAMES, not roles or\n * permissions: a package cannot know a Source's audiences, so the host maps a\n * name to the Source's business type (level-1 audience) of the same name and\n * leaves an item with no match for everyone.\n */\nexport type ExperienceSuggestedLayout = SuggestedLayout;\n\n/** One reads-only section of the review queue; `read` must be a READ op of the integration. */\nexport type ReviewQueueSection = {\n [S in IntegrationName]: {\n id: string;\n integration: S;\n read: ReadOperationKey<S>;\n };\n}[IntegrationName];\n\nexport interface ExperienceReviewQueue {\n readsOnly: true;\n sections: readonly ReviewQueueSection[];\n}\n\n/** A declaration only: the host decides how the sidebar draws it. */\nexport interface ExperienceSidebar {\n section: string;\n icon: string;\n label: string;\n}\n\nexport interface ExperienceInput extends IntegrationOnlyKeys {\n /** kebab-case; must equal `slug` in `ekanos.json`. */\n slug: string;\n name: string;\n description?: string;\n sidebar?: ExperienceSidebar;\n widgets?: readonly ExperienceWidget[];\n pages?: readonly ExperiencePageInput[];\n workflows?: readonly WorkflowTemplate[];\n reviewQueue?: ExperienceReviewQueue;\n suggestedLayout?: ExperienceSuggestedLayout;\n}\n\nexport interface ExperienceDefinition {\n readonly kind: 'experience';\n readonly slug: string;\n readonly name: string;\n readonly description?: string;\n readonly sidebar?: ExperienceSidebar;\n readonly widgets: readonly ExperienceWidget[];\n readonly pages: readonly ExperiencePage[];\n readonly workflows: readonly WorkflowTemplate[];\n readonly reviewQueue?: ExperienceReviewQueue;\n readonly suggestedLayout?: ExperienceSuggestedLayout;\n}\n\nfunction normalizePage(page: ExperiencePageInput): ExperiencePage {\n const kind: ExperiencePageKind = page.kind ?? 'custom';\n const rawPath = (page as { path?: unknown }).path;\n if (kind === 'overview') {\n if (rawPath !== undefined) {\n throw new Error(\n `Invalid experience definition: overview page \"${page.id}\" is the experience's root and takes no path.`,\n );\n }\n } else if (typeof rawPath !== 'string' || rawPath === '') {\n throw new Error(\n `Invalid experience definition: page \"${page.id}\" needs a path (a kebab-case string).`,\n );\n }\n\n return {\n ...page,\n kind,\n integrations: page.integrations ?? [],\n } as ExperiencePage;\n}\n\nconst KEBAB = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;\n\nfunction assertUnique(kind: string, ids: readonly string[]): void {\n const seen = new Set<string>();\n for (const id of ids) {\n if (seen.has(id)) {\n throw new Error(\n `Invalid experience definition: ${kind} id \"${id}\" is declared twice.`,\n );\n }\n seen.add(id);\n }\n}\n\n/**\n * Declare an experience: widgets, pages, workflow templates and a reads-only\n * review queue that reach integrations only through their pinned contracts.\n *\n * Integrations are NOT declared here. They live in `ekanos.json` `integrations` (readable\n * without running code) and `ekanos codegen` types them; naming an integration that is\n * not there is a compile error, and `ekanos check` re-verifies it.\n *\n * @example\n * export default defineExperience({\n * slug: 'content-engine',\n * name: 'Content engine',\n * widgets: [{ id: 'queue', title: 'Queue', integrations: ['cms'], component: Queue }],\n * });\n */\nexport function defineExperience(input: ExperienceInput): ExperienceDefinition {\n const raw = input as unknown as Record<string, unknown>;\n for (const key of INTEGRATION_ONLY_KEYS) {\n if (raw[key] !== undefined) {\n throw new Error(\n `Invalid experience definition: \"${key}\" belongs to an integration. An experience reaches integrations only through the integrations it declares (ekanos.json \"integrations\").`,\n );\n }\n }\n if (!KEBAB.test(input.slug)) {\n throw new Error(\n `Invalid experience definition: slug \"${input.slug}\" must be kebab-case.`,\n );\n }\n if (input.name.trim() === '') {\n throw new Error('Invalid experience definition: name is required.');\n }\n\n const widgets = input.widgets ?? [];\n const pages = input.pages ?? [];\n const workflows = input.workflows ?? [];\n\n for (const widget of widgets) {\n if (!KEBAB.test(widget.id)) {\n throw new Error(\n `Invalid experience definition: widget id \"${widget.id}\" must be kebab-case.`,\n );\n }\n for (const key of ['width', 'size'] as const) {\n const value = widget[key];\n if (value !== undefined && !widgetSizeSchema.safeParse(value).success) {\n throw new Error(\n `Invalid experience definition: widget \"${widget.id}\" ${key} \"${String(value)}\" must be compact, half or full.`,\n );\n }\n }\n if (widget.layouts !== undefined) {\n const parsed = widgetLayoutsSchema.safeParse(widget.layouts);\n if (!parsed.success) {\n throw new Error(\n `Invalid experience definition: widget \"${widget.id}\" layouts is malformed: ${parsed.error.issues.map((i) => `${i.path.join('.')}: ${i.message}`).join('; ')}.`,\n );\n }\n }\n if (\n typeof widget.component !== 'function' &&\n typeof widget.component !== 'object'\n ) {\n throw new Error(\n `Invalid experience definition: widget \"${widget.id}\" needs a component.`,\n );\n }\n }\n const normalizedPages = pages.map(normalizePage);\n for (const page of normalizedPages) {\n if (!(EXPERIENCE_PAGE_KINDS as readonly string[]).includes(page.kind)) {\n throw new Error(\n `Invalid experience definition: page \"${page.id}\" has kind \"${String(page.kind)}\"; use overview, canvas or custom.`,\n );\n }\n if (\n !KEBAB.test(page.id) ||\n (page.kind !== 'overview' && !KEBAB.test(page.path))\n ) {\n throw new Error(\n `Invalid experience definition: page \"${page.id}\" id and path must be kebab-case.`,\n );\n }\n const component = (page as { component?: unknown }).component;\n if (page.kind === 'canvas' && component !== undefined) {\n throw new Error(\n `Invalid experience definition: canvas page \"${page.id}\" takes \"widgets\", not a component.`,\n );\n }\n if (\n page.kind === 'custom' &&\n typeof component !== 'function' &&\n typeof component !== 'object'\n ) {\n throw new Error(\n `Invalid experience definition: page \"${page.id}\" needs a component.`,\n );\n }\n }\n if (input.suggestedLayout !== undefined) {\n const parsed = SuggestedLayoutSchema.safeParse(input.suggestedLayout);\n if (!parsed.success) {\n throw new Error(\n `Invalid experience definition: suggestedLayout is malformed: ${parsed.error.issues.map((i) => `${i.path.join('.')}: ${i.message}`).join('; ')}.`,\n );\n }\n }\n const problems = surfaceProblems({\n widgets,\n pages: normalizedPages.map((page) => ({\n id: page.id,\n kind: page.kind,\n ...(page.kind === 'overview' ? {} : { path: page.path }),\n ...(page.kind === 'canvas' ? { widgets: page.widgets } : {}),\n ...(page.kind === 'custom' && page.routes ? { routes: page.routes } : {}),\n })),\n ...(input.suggestedLayout\n ? { suggestedLayout: input.suggestedLayout }\n : {}),\n });\n if (problems[0] !== undefined) {\n throw new Error(`Invalid experience definition: ${problems[0]}.`);\n }\n assertUnique(\n 'workflow template',\n workflows.map((w) => w.id),\n );\n\n if (input.reviewQueue) {\n if (input.reviewQueue.readsOnly !== true) {\n throw new Error(\n 'Invalid experience definition: reviewQueue.readsOnly must be true.',\n );\n }\n assertUnique(\n 'review queue section',\n input.reviewQueue.sections.map((s) => s.id),\n );\n }\n\n return Object.freeze({\n kind: 'experience' as const,\n slug: input.slug,\n name: input.name,\n ...(input.description === undefined\n ? {}\n : { description: input.description }),\n ...(input.sidebar === undefined ? {} : { sidebar: input.sidebar }),\n widgets: Object.freeze([...widgets]),\n pages: Object.freeze(normalizedPages),\n workflows: Object.freeze([...workflows]),\n ...(input.reviewQueue === undefined\n ? {}\n : { reviewQueue: input.reviewQueue }),\n ...(input.suggestedLayout === undefined\n ? {}\n : { suggestedLayout: input.suggestedLayout }),\n });\n}\n\n/** Integrations an experience definition touches, deduplicated (for `check`/manifest). */\nexport function slotsUsedBy(definition: ExperienceDefinition): string[] {\n const used = new Set<string>();\n for (const widget of definition.widgets)\n for (const s of widget.integrations) used.add(s);\n for (const page of definition.pages)\n for (const s of page.integrations) used.add(s);\n for (const section of definition.reviewQueue?.sections ?? [])\n used.add(section.integration);\n for (const template of definition.workflows) {\n for (const s of template.build())\n if (s.type === 'tool') used.add(s.integration);\n }\n\n return [...used].sort();\n}\n"]}
@@ -221,8 +221,8 @@ export interface WidgetConfig {
221
221
  icon: string | null;
222
222
  };
223
223
  productId?: string;
224
+ /** @deprecated Ignored: widgets no longer collapse. */
224
225
  isCollapsible?: boolean;
225
- collapsed?: boolean;
226
226
  widgetConfigId?: string;
227
227
  workspaceId?: string | null;
228
228
  isPinnable?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"integration.js","sourceRoot":"","sources":["../../src/types/integration.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentType } from 'react';\n\nimport type { IconRenderer } from './icon';\n\n// Capability shown on the integration detail page (numbered grid)\nexport interface IntegrationCapability {\n label: string;\n description: string;\n icon?: IconRenderer;\n}\n\n// Permission scope shown on the integration detail page\nexport interface IntegrationPermission {\n label: string;\n detail: string;\n type: 'read' | 'write';\n}\n\n// ---- Integration Health Monitoring (issue #474) -----------------------------\n\n// Higher = healthier. Used internally for \"least healthy wins\" merging.\nexport type HealthStatus = 'healthy' | 'degraded' | 'unhealthy' | 'unknown';\n\n/**\n * Result returned by `BaseIntegration.healthCheck(accountId)`. Routed through\n * `classifyHealth()` (server-side) before writing to\n * `integration_health_status`.\n */\nexport interface HealthCheckResult {\n status: HealthStatus;\n errorCode?: string;\n errorMessage?: string;\n /** Rolling 24h error rate from `account_product_usage_events`, 0..100. */\n errorRatePct?: number;\n /** Sample size used to compute errorRatePct; if below threshold, treated as unknown. */\n sampleSize?: number;\n /** Whether the most recent observed call succeeded. */\n lastObservationSucceeded?: boolean;\n /** Token/credential expiry, if known. Drives token-expiry warnings. */\n tokenExpiresAt?: string;\n /** Free-form per-integration data carried to the dashboard. */\n metadata?: Record<string, unknown>;\n}\n\n// Activation result from integration\nexport interface ActivationResult {\n success: boolean;\n configData?: Record<string, unknown>;\n externalId?: string;\n errorMessage?: string;\n metadata?: Record<string, unknown>;\n}\n\n// Base props that all integration components need\ninterface BaseIntegrationComponentProps {\n accountId: string;\n sourceId?: string;\n integrationConfig?: Record<string, unknown>;\n}\n\n// Discriminated union for product reference - only one allowed\ntype ProductReference =\n | { productId: string; productSlug?: never }\n | { productSlug: string; productId?: never };\n\n// New base type using discriminated union\nexport type IntegrationComponentProps = BaseIntegrationComponentProps &\n ProductReference;\n\n// Marketplace tile props\nexport type MarketplaceTileProps = IntegrationComponentProps & {\n onActivate?: () => void;\n isActivated?: boolean;\n /** Navigation URL for the integration detail page */\n href?: string;\n};\n\n// Activation form props\nexport type ActivationFormProps = IntegrationComponentProps & {\n onSuccess?: (result: ActivationResult) => void;\n onCancel?: () => void;\n isLoading?: boolean;\n /**\n * @deprecated Every host renders a connect form inline in its own frame,\n * and `ActivationForm` is always inline; a form can ignore this.\n */\n inline?: boolean;\n /**\n * The integration is already connected and the person chose to connect it\n * again — after a token expired, a password changed, or a health check\n * failed. An OAuth form sends them through sign-in even when a token is\n * stored; a credential form simply accepts new values. Activating again\n * resets the integration's health to unknown until the next check.\n */\n reconnect?: boolean;\n /**\n * The TEAM account context the user is activating within — separate from\n * `accountId`, which for `scope: 'user'` integrations is collapsed to the\n * personal account for activation storage/token purposes. Only consumed by\n * workspace materialization (`materializeWorkspaceOnActivation`), never for\n * activation/token storage itself (plan 009 Part A2). Optional: undefined\n * for team-scoped integrations (their `accountId` already IS the team) and\n * for any caller that hasn't threaded it yet — the server action falls back\n * to `accountId` when absent.\n */\n teamAccountId?: string;\n};\n\n// Integration metadata\nexport interface IntegrationMetadata {\n productId: string;\n productSlug: string;\n integrationName: string;\n description: string;\n category: string;\n version: string;\n icon?: string;\n /** Bundled logo URL — overrides product.logo_path on the marketplace */\n logoPath?: string;\n /** When 'user', activation data is stored under the user's personal account (user.id) instead of the team account */\n scope?: 'user' | 'team';\n /**\n * Set FALSE to assert this integration has NO self-serve activation surface —\n * the marketplace detail page then renders no activation form at all.\n *\n * This is deliberately distinct from \"has no CUSTOM activation form\": an\n * integration that omits `getActivationForm()` still gets the generic one, and\n * six integrations depend on that. Use this flag only when submitting ANY\n * activation form would be a dead end — where `activate()` cannot succeed, so\n * showing a form hands the user a button that cannot work.\n * Undefined/true = normal self-serve activation.\n */\n selfServeActivation?: boolean;\n /**\n * How this integration's MCP tools resolve credentials — the integration's\n * SELF-DECLARATION of machine-executability, consumed dynamically by the\n * workflow engine's fail-closed tool allowlist (isGatewayExposableTool).\n *\n * 'account' — credentials/identity resolve from team- or source-level\n * config via the ToolContext (`getAccountId(ctx)` + `ctx.supabase`).\n * Safe for durable machine-principal execution (workflows): eligible\n * tools (read + public/internal sensitivity) become workflow-callable.\n * 'user' — credentials or identity are personal (ctx.user.id, personal\n * OAuth, session reads like getSupabaseServerClient()/requireUser()).\n * NEVER machine-executable: a workflow would silently ride one\n * employee's personal grant.\n * 'source' — platform-level credentials (diagnostics-class integrations).\n * Not exposed to account workflows.\n *\n * UNDECLARED = fail closed (treated as not machine-executable). Declaring\n * 'account' is a security assertion: the integration's MCP run() handlers\n * must use ctx-based resolution ONLY — no session clients, no personal\n * grants. A guard test in @kit/integrations-workflows enforces the obvious\n * violations (session-client reads in mcp/ code of 'account' declarers).\n */\n credentialModel?: 'account' | 'user' | 'source';\n /**\n * Which KIND of integration this is. **Required** — nothing is inferred from\n * omission. An Integration is any package extending `BaseIntegration`; its\n * kind says who turns it on and whether it needs credentials:\n *\n * 'feature' — an Ekanos-native capability. Enabled for a Source by a\n * super-admin; no third-party credentials, no activation flow, no\n * marketplace tile. Always declares its own top-level sidebar Section\n * via `getSidebarNav()` and NEVER declares `getWorkspaceTargets()` —\n * its widgets have no Workspace of their own, so an admin places them\n * on one in the composer (`/admin/sources/[id]/workspaces`).\n * 'integration' — a connection to an outside system. Made available to a\n * Source by a super-admin, then connected by a team or user (usually\n * OAuth/SSO); has credentials, an activation flow and a marketplace\n * tile. Declares a Workspace via `getWorkspaceTargets()`, a top-level\n * Section via `getSidebarNav()`, or both (Centrex does both).\n *\n * The asymmetry is one-directional and enforced by the host's CI:\n * a Feature MUST declare a Section and MUST NOT declare a Workspace; a\n * connector MAY declare either or both.\n */\n kind: 'feature' | 'integration';\n /**\n * Product slugs that MUST be attached to the same Source for this product to\n * function — a hard dependency, not a suggestion.\n *\n * The host REFUSES to attach this product to a Source missing any of them,\n * and refuses a detach that would strand a dependent. Admin surfaces render\n * the dependency in both directions (\"Requires X\" / \"Enables Y\").\n *\n * Host CI enforces: every slug is registered, nothing requires itself, no\n * cycles, and a `kind: 'feature'` may require a `'integration'` but never\n * the reverse.\n */\n requires?: string[];\n}\n\n// Widget configuration\nexport interface WidgetConfig {\n id: string;\n name: string;\n component: ComponentType<IntegrationComponentProps>;\n gridSize?: { cols: number; rows: number } | { cols: number; rows: number }[];\n gridPosition?: { col: number; row: number };\n widgetState: 'active' | 'inactive' | 'disabled';\n /**\n * `compact` (a figure tile, 1 → 2 → 4 across its row), `half` or `full`\n * (the design system's widget rules). Unset, it is derived from `layouts.lg.w`.\n */\n size?: 'compact' | 'half' | 'full';\n // React-grid-layout format\n layouts?: {\n lg?: { x: number; y: number; w: number; h: number; maxHeight?: number };\n md?: { x: number; y: number; w: number; h: number; maxHeight?: number };\n sm?: { x: number; y: number; w: number; h: number; maxHeight?: number };\n };\n // Integration metadata for widgets\n integrationMetadata?: IntegrationMetadata;\n category?: { id: string; name: string; slug: string; icon: string | null };\n // Database product ID (UUID) from widget_config table\n productId?: string;\n isCollapsible?: boolean;\n // For collapsed state persistence\n collapsed?: boolean;\n widgetConfigId?: string;\n // Resolved workspace placement (explicit widget_config.workspace_id\n // override, else the product's inheriting attachment). Populated by the\n // dashboard widgets loader; null = no workspace (unscoped dashboard).\n workspaceId?: string | null;\n isPinnable?: boolean;\n isPinned?: boolean;\n // When true, the dashboard renders the \"Ask about this\" AI footer bar for\n // this widget. The widget may still pass `askContext` to the wrapper for a\n // rich snapshot; otherwise a minimal default is used.\n aiFooterEnabled?: boolean;\n // Integration health for this widget's product. `unhealthy` downgrades the\n // widget to `disabled`; `degraded` surfaces a stale-data footer.\n health?: {\n status: HealthStatus;\n lastSuccessAt?: string | null;\n errorMessage?: string | null;\n };\n}\n\n// Database types for integration tables.\n//\n// PARTNER-VISIBLE SUBSET: these row types deliberately OMIT `vault_secret_id`.\n// A vault id is a host handle to a decryptable secret; the partner surface\n// never exposes one — `ctx.secrets` fences it off. Host code keeps the full\n// row because it needs the handle; a parity test pins the SDK type as the\n// host's row minus exactly the host-only fields, so a new column cannot drift\n// in here unnoticed.\nexport interface IntegrationConfig {\n id: string;\n account_id: string | null;\n product_id: string;\n config_type: 'api_credentials' | 'activation_data' | 'settings';\n config_data: Record<string, unknown>;\n status: 'active' | 'inactive' | 'pending' | 'error' | 'suspended';\n is_active: boolean;\n created_at: string;\n updated_at: string;\n created_by: string | null;\n updated_by: string | null;\n}\n\n/**\n * The PARTNER-VISIBLE `data_type` values on `account_product_data` — a strict\n * SUBSET of `@kit/integrations-core`'s union.\n *\n * `'secret'` is deliberately absent. Secret rows are host-managed (one row per\n * secret name, value in Vault, `vault_secret_id` on the row), written only by\n * the capability context's `persistSecret` and read only through\n * `ctx.secrets`. Naming the kind here would advertise a row shape partner code\n * must never address: `ctx.storage` rejects it, and core's generic accessors\n * reject it too (`config-utils.ts`, `assertNotHostOnlyDataType`) precisely\n * because a write there would land the plaintext in the `data` column.\n *\n * When you add an integration-specific kind, add it in BOTH places (core owns\n * the full union) and keep this one partner-appropriate. Prefer `dataSubtype`\n * for orthogonal slicing within a kind (e.g. `data_type='cache'`,\n * `data_subtype='profile'`); reserve a new top-level kind for data that has a\n * distinct lifecycle or is queried independently.\n */\nexport type AccountProductDataType =\n | 'activation'\n | 'settings'\n | 'metrics_summary'\n | 'sync_state'\n | 'cache'\n // Integration-specific kinds — extend here when needed.\n | 'cash_forecast' // quickbooks — user-supplied manual cash-forecast estimates\n | 'tax_config'; // quickbooks — per-user federal/state tax rate config\n\nexport interface AccountProductData {\n id: string;\n account_id: string;\n product_id: string;\n data_type: AccountProductDataType;\n data_subtype?: string;\n data: Record<string, unknown>;\n expires_at?: string;\n integration_config_id?: string;\n external_id?: string;\n created_at: string;\n updated_at: string;\n created_by: string | null;\n updated_by: string | null;\n}\n"]}
1
+ {"version":3,"file":"integration.js","sourceRoot":"","sources":["../../src/types/integration.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentType } from 'react';\n\nimport type { IconRenderer } from './icon';\n\n// Capability shown on the integration detail page (numbered grid)\nexport interface IntegrationCapability {\n label: string;\n description: string;\n icon?: IconRenderer;\n}\n\n// Permission scope shown on the integration detail page\nexport interface IntegrationPermission {\n label: string;\n detail: string;\n type: 'read' | 'write';\n}\n\n// ---- Integration Health Monitoring (issue #474) -----------------------------\n\n// Higher = healthier. Used internally for \"least healthy wins\" merging.\nexport type HealthStatus = 'healthy' | 'degraded' | 'unhealthy' | 'unknown';\n\n/**\n * Result returned by `BaseIntegration.healthCheck(accountId)`. Routed through\n * `classifyHealth()` (server-side) before writing to\n * `integration_health_status`.\n */\nexport interface HealthCheckResult {\n status: HealthStatus;\n errorCode?: string;\n errorMessage?: string;\n /** Rolling 24h error rate from `account_product_usage_events`, 0..100. */\n errorRatePct?: number;\n /** Sample size used to compute errorRatePct; if below threshold, treated as unknown. */\n sampleSize?: number;\n /** Whether the most recent observed call succeeded. */\n lastObservationSucceeded?: boolean;\n /** Token/credential expiry, if known. Drives token-expiry warnings. */\n tokenExpiresAt?: string;\n /** Free-form per-integration data carried to the dashboard. */\n metadata?: Record<string, unknown>;\n}\n\n// Activation result from integration\nexport interface ActivationResult {\n success: boolean;\n configData?: Record<string, unknown>;\n externalId?: string;\n errorMessage?: string;\n metadata?: Record<string, unknown>;\n}\n\n// Base props that all integration components need\ninterface BaseIntegrationComponentProps {\n accountId: string;\n sourceId?: string;\n integrationConfig?: Record<string, unknown>;\n}\n\n// Discriminated union for product reference - only one allowed\ntype ProductReference =\n | { productId: string; productSlug?: never }\n | { productSlug: string; productId?: never };\n\n// New base type using discriminated union\nexport type IntegrationComponentProps = BaseIntegrationComponentProps &\n ProductReference;\n\n// Marketplace tile props\nexport type MarketplaceTileProps = IntegrationComponentProps & {\n onActivate?: () => void;\n isActivated?: boolean;\n /** Navigation URL for the integration detail page */\n href?: string;\n};\n\n// Activation form props\nexport type ActivationFormProps = IntegrationComponentProps & {\n onSuccess?: (result: ActivationResult) => void;\n onCancel?: () => void;\n isLoading?: boolean;\n /**\n * @deprecated Every host renders a connect form inline in its own frame,\n * and `ActivationForm` is always inline; a form can ignore this.\n */\n inline?: boolean;\n /**\n * The integration is already connected and the person chose to connect it\n * again — after a token expired, a password changed, or a health check\n * failed. An OAuth form sends them through sign-in even when a token is\n * stored; a credential form simply accepts new values. Activating again\n * resets the integration's health to unknown until the next check.\n */\n reconnect?: boolean;\n /**\n * The TEAM account context the user is activating within — separate from\n * `accountId`, which for `scope: 'user'` integrations is collapsed to the\n * personal account for activation storage/token purposes. Only consumed by\n * workspace materialization (`materializeWorkspaceOnActivation`), never for\n * activation/token storage itself (plan 009 Part A2). Optional: undefined\n * for team-scoped integrations (their `accountId` already IS the team) and\n * for any caller that hasn't threaded it yet — the server action falls back\n * to `accountId` when absent.\n */\n teamAccountId?: string;\n};\n\n// Integration metadata\nexport interface IntegrationMetadata {\n productId: string;\n productSlug: string;\n integrationName: string;\n description: string;\n category: string;\n version: string;\n icon?: string;\n /** Bundled logo URL — overrides product.logo_path on the marketplace */\n logoPath?: string;\n /** When 'user', activation data is stored under the user's personal account (user.id) instead of the team account */\n scope?: 'user' | 'team';\n /**\n * Set FALSE to assert this integration has NO self-serve activation surface —\n * the marketplace detail page then renders no activation form at all.\n *\n * This is deliberately distinct from \"has no CUSTOM activation form\": an\n * integration that omits `getActivationForm()` still gets the generic one, and\n * six integrations depend on that. Use this flag only when submitting ANY\n * activation form would be a dead end — where `activate()` cannot succeed, so\n * showing a form hands the user a button that cannot work.\n * Undefined/true = normal self-serve activation.\n */\n selfServeActivation?: boolean;\n /**\n * How this integration's MCP tools resolve credentials — the integration's\n * SELF-DECLARATION of machine-executability, consumed dynamically by the\n * workflow engine's fail-closed tool allowlist (isGatewayExposableTool).\n *\n * 'account' — credentials/identity resolve from team- or source-level\n * config via the ToolContext (`getAccountId(ctx)` + `ctx.supabase`).\n * Safe for durable machine-principal execution (workflows): eligible\n * tools (read + public/internal sensitivity) become workflow-callable.\n * 'user' — credentials or identity are personal (ctx.user.id, personal\n * OAuth, session reads like getSupabaseServerClient()/requireUser()).\n * NEVER machine-executable: a workflow would silently ride one\n * employee's personal grant.\n * 'source' — platform-level credentials (diagnostics-class integrations).\n * Not exposed to account workflows.\n *\n * UNDECLARED = fail closed (treated as not machine-executable). Declaring\n * 'account' is a security assertion: the integration's MCP run() handlers\n * must use ctx-based resolution ONLY — no session clients, no personal\n * grants. A guard test in @kit/integrations-workflows enforces the obvious\n * violations (session-client reads in mcp/ code of 'account' declarers).\n */\n credentialModel?: 'account' | 'user' | 'source';\n /**\n * Which KIND of integration this is. **Required** — nothing is inferred from\n * omission. An Integration is any package extending `BaseIntegration`; its\n * kind says who turns it on and whether it needs credentials:\n *\n * 'feature' — an Ekanos-native capability. Enabled for a Source by a\n * super-admin; no third-party credentials, no activation flow, no\n * marketplace tile. Always declares its own top-level sidebar Section\n * via `getSidebarNav()` and NEVER declares `getWorkspaceTargets()` —\n * its widgets have no Workspace of their own, so an admin places them\n * on one in the composer (`/admin/sources/[id]/workspaces`).\n * 'integration' — a connection to an outside system. Made available to a\n * Source by a super-admin, then connected by a team or user (usually\n * OAuth/SSO); has credentials, an activation flow and a marketplace\n * tile. Declares a Workspace via `getWorkspaceTargets()`, a top-level\n * Section via `getSidebarNav()`, or both (Centrex does both).\n *\n * The asymmetry is one-directional and enforced by the host's CI:\n * a Feature MUST declare a Section and MUST NOT declare a Workspace; a\n * connector MAY declare either or both.\n */\n kind: 'feature' | 'integration';\n /**\n * Product slugs that MUST be attached to the same Source for this product to\n * function — a hard dependency, not a suggestion.\n *\n * The host REFUSES to attach this product to a Source missing any of them,\n * and refuses a detach that would strand a dependent. Admin surfaces render\n * the dependency in both directions (\"Requires X\" / \"Enables Y\").\n *\n * Host CI enforces: every slug is registered, nothing requires itself, no\n * cycles, and a `kind: 'feature'` may require a `'integration'` but never\n * the reverse.\n */\n requires?: string[];\n}\n\n// Widget configuration\nexport interface WidgetConfig {\n id: string;\n name: string;\n component: ComponentType<IntegrationComponentProps>;\n gridSize?: { cols: number; rows: number } | { cols: number; rows: number }[];\n gridPosition?: { col: number; row: number };\n widgetState: 'active' | 'inactive' | 'disabled';\n /**\n * `compact` (a figure tile, 1 → 2 → 4 across its row), `half` or `full`\n * (the design system's widget rules). Unset, it is derived from `layouts.lg.w`.\n */\n size?: 'compact' | 'half' | 'full';\n // React-grid-layout format\n layouts?: {\n lg?: { x: number; y: number; w: number; h: number; maxHeight?: number };\n md?: { x: number; y: number; w: number; h: number; maxHeight?: number };\n sm?: { x: number; y: number; w: number; h: number; maxHeight?: number };\n };\n // Integration metadata for widgets\n integrationMetadata?: IntegrationMetadata;\n category?: { id: string; name: string; slug: string; icon: string | null };\n // Database product ID (UUID) from widget_config table\n productId?: string;\n /** @deprecated Ignored: widgets no longer collapse. */\n isCollapsible?: boolean;\n widgetConfigId?: string;\n // Resolved workspace placement (explicit widget_config.workspace_id\n // override, else the product's inheriting attachment). Populated by the\n // dashboard widgets loader; null = no workspace (unscoped dashboard).\n workspaceId?: string | null;\n isPinnable?: boolean;\n isPinned?: boolean;\n // When true, the dashboard renders the \"Ask about this\" AI footer bar for\n // this widget. The widget may still pass `askContext` to the wrapper for a\n // rich snapshot; otherwise a minimal default is used.\n aiFooterEnabled?: boolean;\n // Integration health for this widget's product. `unhealthy` downgrades the\n // widget to `disabled`; `degraded` surfaces a stale-data footer.\n health?: {\n status: HealthStatus;\n lastSuccessAt?: string | null;\n errorMessage?: string | null;\n };\n}\n\n// Database types for integration tables.\n//\n// PARTNER-VISIBLE SUBSET: these row types deliberately OMIT `vault_secret_id`.\n// A vault id is a host handle to a decryptable secret; the partner surface\n// never exposes one — `ctx.secrets` fences it off. Host code keeps the full\n// row because it needs the handle; a parity test pins the SDK type as the\n// host's row minus exactly the host-only fields, so a new column cannot drift\n// in here unnoticed.\nexport interface IntegrationConfig {\n id: string;\n account_id: string | null;\n product_id: string;\n config_type: 'api_credentials' | 'activation_data' | 'settings';\n config_data: Record<string, unknown>;\n status: 'active' | 'inactive' | 'pending' | 'error' | 'suspended';\n is_active: boolean;\n created_at: string;\n updated_at: string;\n created_by: string | null;\n updated_by: string | null;\n}\n\n/**\n * The PARTNER-VISIBLE `data_type` values on `account_product_data` — a strict\n * SUBSET of `@kit/integrations-core`'s union.\n *\n * `'secret'` is deliberately absent. Secret rows are host-managed (one row per\n * secret name, value in Vault, `vault_secret_id` on the row), written only by\n * the capability context's `persistSecret` and read only through\n * `ctx.secrets`. Naming the kind here would advertise a row shape partner code\n * must never address: `ctx.storage` rejects it, and core's generic accessors\n * reject it too (`config-utils.ts`, `assertNotHostOnlyDataType`) precisely\n * because a write there would land the plaintext in the `data` column.\n *\n * When you add an integration-specific kind, add it in BOTH places (core owns\n * the full union) and keep this one partner-appropriate. Prefer `dataSubtype`\n * for orthogonal slicing within a kind (e.g. `data_type='cache'`,\n * `data_subtype='profile'`); reserve a new top-level kind for data that has a\n * distinct lifecycle or is queried independently.\n */\nexport type AccountProductDataType =\n | 'activation'\n | 'settings'\n | 'metrics_summary'\n | 'sync_state'\n | 'cache'\n // Integration-specific kinds — extend here when needed.\n | 'cash_forecast' // quickbooks — user-supplied manual cash-forecast estimates\n | 'tax_config'; // quickbooks — per-user federal/state tax rate config\n\nexport interface AccountProductData {\n id: string;\n account_id: string;\n product_id: string;\n data_type: AccountProductDataType;\n data_subtype?: string;\n data: Record<string, unknown>;\n expires_at?: string;\n integration_config_id?: string;\n external_id?: string;\n created_at: string;\n updated_at: string;\n created_by: string | null;\n updated_by: string | null;\n}\n"]}
package/dist/version.d.ts CHANGED
@@ -4,4 +4,4 @@
4
4
  * from `package.json#version`; after `changeset version`, copy the new version
5
5
  * here.
6
6
  */
7
- export declare const SDK_VERSION = "0.26.0";
7
+ export declare const SDK_VERSION = "0.28.0";
package/dist/version.js CHANGED
@@ -4,5 +4,5 @@
4
4
  * from `package.json#version`; after `changeset version`, copy the new version
5
5
  * here.
6
6
  */
7
- export const SDK_VERSION = '0.26.0';
7
+ export const SDK_VERSION = '0.28.0';
8
8
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["/**\n * This package's own version, for diagnostics that must name which copy of\n * `@ekanos/sdk` is loaded. `src/__tests__/version.test.ts` fails when it drifts\n * from `package.json#version`; after `changeset version`, copy the new version\n * here.\n */\nexport const SDK_VERSION = '0.26.0';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["/**\n * This package's own version, for diagnostics that must name which copy of\n * `@ekanos/sdk` is loaded. `src/__tests__/version.test.ts` fails when it drifts\n * from `package.json#version`; after `changeset version`, copy the new version\n * here.\n */\nexport const SDK_VERSION = '0.28.0';\n"]}
@@ -121,7 +121,7 @@ export const FORBIDDEN_ELEMENTS = [
121
121
  '(sorting, paging, empty and loading states); use <Table> from ' +
122
122
  '@ekanos/ui/table only for a simple static table. ' +
123
123
  'For a plain list, prefer edge-to-edge rows: a container with no horizontal ' +
124
- 'padding, each row `px-5 py-3` with a flat `hover:bg-accent/50`, ' +
124
+ 'padding, each row `px-5 py-3` with a flat `hover:bg-muted`, ' +
125
125
  'separated by <Separator> from @ekanos/ui/separator. See ' +
126
126
  "the design system's widget rules.",
127
127
  },
@@ -68,6 +68,16 @@
68
68
 
69
69
  const FADED_MUTED = /(?:^|[\s:'"`])(?:[\w-]+:)*text-muted-foreground\/\d+/;
70
70
 
71
+ /**
72
+ * A grey that is not on the surface ladder: an opacity step on a neutral
73
+ * token (`bg-muted/50`, `dark:bg-input/30`, `text-foreground/60`) or a
74
+ * `color-mix` of neutral tokens. `ring-foreground/10` is the elevation edge
75
+ * and stays legal; a gradient's stops (`from-`/`via-`/`to-`) fade and stay
76
+ * legal too.
77
+ */
78
+ const NEUTRAL_WASH =
79
+ /(?:(?:^|[\s:'"`])(?:[\w-]+:)*(?:bg|text|border|divide|fill|stroke|outline)-(?:foreground|background|muted|accent|secondary|input|border|card|popover|field|sidebar|muted-foreground|card-foreground|popover-foreground|secondary-foreground|accent-foreground)\/(?:\d+|\[[^\]]+\]))|color-mix\(in_\w+,\s*var\(--(?:foreground|background|muted|accent|secondary|input|border|card|popover|field)\)/;
80
+
71
81
  /** `bg-white`, `text-black/50`, `dark:border-white`… — @shadcn/lint's
72
82
  * no-raw-colors covers the palette scales but not these two. */
73
83
  const ABSOLUTE_COLOR =
@@ -681,6 +691,19 @@ export default {
681
691
  'Opacity on text-muted-foreground fails WCAG AA: even /90 measures 4.18:1 on a dark card. Use plain text-muted-foreground, a smaller size if it must recede, or text-border for a decorative separator (design-system opacity-on-muted rule).',
682
692
  ),
683
693
  },
694
+ 'no-neutral-wash': {
695
+ meta: {
696
+ type: 'problem',
697
+ docs: {
698
+ description:
699
+ 'Disallow an opacity step or color-mix on a neutral token; every grey is a step of the surface ladder.',
700
+ },
701
+ },
702
+ create: stringVisitors(
703
+ NEUTRAL_WASH,
704
+ 'A grey between the ladder steps does not match the theme. Use a ladder token at full strength: bg-secondary for a quiet band, bg-muted for hover, bg-accent for the open or current state, bg-input for a filled control\u2019s hover, bg-field for a field, text-muted-foreground for quiet text. The assistant\u2019s chip is bg-primary-surface.',
705
+ ),
706
+ },
684
707
  'no-literal-gradient': {
685
708
  meta: {
686
709
  type: 'problem',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ekanos/sdk",
3
- "version": "0.26.0",
3
+ "version": "0.28.0",
4
4
  "private": false,
5
5
  "description": "The official SDK for building Ekanos integrations.",
6
6
  "homepage": "https://sdk.ekanos.dev/sdk/overview",
@@ -114,8 +114,8 @@
114
114
  "access": "public"
115
115
  },
116
116
  "dependencies": {
117
- "@ekanos/integration-schema": "0.26.0",
118
- "@ekanos/ui": "0.26.0",
117
+ "@ekanos/integration-schema": "0.28.0",
118
+ "@ekanos/ui": "0.28.0",
119
119
  "@supabase/supabase-js": "2.119.0",
120
120
  "server-only": "^0.0.1",
121
121
  "zod-to-json-schema": "3.25.2"