@apotech-os/ui-sdk 7.6.0 → 7.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -787,4 +787,45 @@ declare function toCsv(rows: string[][]): string;
787
787
  */
788
788
  declare function downloadCsv(rows: string[][], filename: string): void;
789
789
 
790
- export { type AppApiClient, AppApiProvider, AppContextProvider, type AppContextValue, AppInvokeError, type AppPageQuery, AreaChart, Badge, type BadgeProps, BarChart, Button, type ButtonProps, COMPARE_LABELS, COMPARE_SHORT_LABELS, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CartesianChartProps, type ChartRow, type ChartSeries, Checkbox, type CheckboxProps, CopyButton, type CopyButtonProps, DataTable, type DataTableBulkAction, type DataTableColumn, type DataTableColumnFormat, type DataTableCsvExport, type DataTableFacet, type DataTableFilter, type DataTableFilterOperator, type DataTableLoadMore, type DataTablePagination, type DataTableProps, type DataTableSort, type DataTableState, type DateRange, DateRangeCompare, type DateRangeCompareProps, DateRangePicker, type DateRangePickerProps, DropdownMenu, type DropdownMenuItem, type DropdownMenuProps, FunnelChart, type FunnelChartProps, type FunnelStep, Input, KpiCard, type KpiCardProps, LineChart, Link, type LinkProps, Modal, type ModalProps, PERIOD_PRESETS, type PeriodCompareMode, type PeriodPreset, type PeriodPresetKey, type PeriodRange, type PeriodValue, Popover, type PopoverProps, Select, type SelectOption, type SelectProps, SidePanel, type SidePanelProps, Spinner, type SpinnerProps, StackedBarChart, Switch, type SwitchProps, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, type TabsProps, TabsTrigger, Textarea, type TextareaProps, type ToastInput, ToastProvider, Tooltip, type TooltipProps, type ValueFormatter, badgeVariants, buttonVariants, cn, comparisonRange, copyToClipboard, downloadBlob, downloadCsv, formatCellValue, formatPeriod, formatRange, makePeriod, periodFromPreset, relativeDelta, toCsv, useAppApi, useAppContext, useAppPageHref, useAppRun, useAppRuns, useAppSettings, useToast };
790
+ /**
791
+ * Icons for external sites and the platform's integrations.
792
+ *
793
+ * The shell serves one 128 px icon per integration at `/brand-logos/<key>.png`
794
+ * (same origin as every app page). A link to one of those brands resolves to
795
+ * that file; any other site falls back to its favicon, fetched from Google's
796
+ * favicon service (the page's hostname is sent to Google — never pass a URL
797
+ * whose hostname is itself sensitive).
798
+ */
799
+ /** Integration keys with a file under `/brand-logos/`. */
800
+ declare const BRAND_LOGO_KEYS: readonly ["anthropic", "bigblue", "cchezvous", "google-ads", "google-drive", "google-search-console", "google-sheets", "gorgias", "hubble", "judgeme", "klaviyo", "meta", "monday", "openai", "openrouter", "pennylane", "pipedrive", "prediko", "ringover", "shopify", "slack"];
801
+ type BrandLogoKey = (typeof BRAND_LOGO_KEYS)[number];
802
+ /** Integration key a URL belongs to (`https://acme.gorgias.com/app` → `gorgias`), or null. */
803
+ declare function brandKeyForUrl(url: string): BrandLogoKey | null;
804
+ declare function isBrandLogoKey(key: string): key is BrandLogoKey;
805
+ /**
806
+ * Icon URL for an integration key or a site URL: the shipped brand logo when
807
+ * there is one, the site's favicon otherwise, null for something that is not
808
+ * an http(s) URL.
809
+ */
810
+ declare function siteIconUrl(target: {
811
+ provider?: string;
812
+ href?: string;
813
+ }): string | null;
814
+ type SiteIconProps = ({
815
+ provider: string;
816
+ href?: never;
817
+ } | {
818
+ href: string;
819
+ provider?: never;
820
+ }) & {
821
+ /** Sizing goes through the class, like a Lucide icon (default `size-4`). */
822
+ className?: string;
823
+ };
824
+ /**
825
+ * Logo of an integration (`provider="klaviyo"`) or favicon of the site a link
826
+ * points to (`href="https://…"`). Decorative: put it next to text that names
827
+ * the target. Falls back to a neutral globe when no icon can be loaded.
828
+ */
829
+ declare function SiteIcon({ className, provider, href }: SiteIconProps): React.JSX.Element;
830
+
831
+ export { type AppApiClient, AppApiProvider, AppContextProvider, type AppContextValue, AppInvokeError, type AppPageQuery, AreaChart, BRAND_LOGO_KEYS, Badge, type BadgeProps, BarChart, type BrandLogoKey, Button, type ButtonProps, COMPARE_LABELS, COMPARE_SHORT_LABELS, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CartesianChartProps, type ChartRow, type ChartSeries, Checkbox, type CheckboxProps, CopyButton, type CopyButtonProps, DataTable, type DataTableBulkAction, type DataTableColumn, type DataTableColumnFormat, type DataTableCsvExport, type DataTableFacet, type DataTableFilter, type DataTableFilterOperator, type DataTableLoadMore, type DataTablePagination, type DataTableProps, type DataTableSort, type DataTableState, type DateRange, DateRangeCompare, type DateRangeCompareProps, DateRangePicker, type DateRangePickerProps, DropdownMenu, type DropdownMenuItem, type DropdownMenuProps, FunnelChart, type FunnelChartProps, type FunnelStep, Input, KpiCard, type KpiCardProps, LineChart, Link, type LinkProps, Modal, type ModalProps, PERIOD_PRESETS, type PeriodCompareMode, type PeriodPreset, type PeriodPresetKey, type PeriodRange, type PeriodValue, Popover, type PopoverProps, Select, type SelectOption, type SelectProps, SidePanel, type SidePanelProps, SiteIcon, type SiteIconProps, Spinner, type SpinnerProps, StackedBarChart, Switch, type SwitchProps, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, type TabsProps, TabsTrigger, Textarea, type TextareaProps, type ToastInput, ToastProvider, Tooltip, type TooltipProps, type ValueFormatter, badgeVariants, brandKeyForUrl, buttonVariants, cn, comparisonRange, copyToClipboard, downloadBlob, downloadCsv, formatCellValue, formatPeriod, formatRange, isBrandLogoKey, makePeriod, periodFromPreset, relativeDelta, siteIconUrl, toCsv, useAppApi, useAppContext, useAppPageHref, useAppRun, useAppRuns, useAppSettings, useToast };
package/dist/index.d.ts CHANGED
@@ -787,4 +787,45 @@ declare function toCsv(rows: string[][]): string;
787
787
  */
788
788
  declare function downloadCsv(rows: string[][], filename: string): void;
789
789
 
790
- export { type AppApiClient, AppApiProvider, AppContextProvider, type AppContextValue, AppInvokeError, type AppPageQuery, AreaChart, Badge, type BadgeProps, BarChart, Button, type ButtonProps, COMPARE_LABELS, COMPARE_SHORT_LABELS, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CartesianChartProps, type ChartRow, type ChartSeries, Checkbox, type CheckboxProps, CopyButton, type CopyButtonProps, DataTable, type DataTableBulkAction, type DataTableColumn, type DataTableColumnFormat, type DataTableCsvExport, type DataTableFacet, type DataTableFilter, type DataTableFilterOperator, type DataTableLoadMore, type DataTablePagination, type DataTableProps, type DataTableSort, type DataTableState, type DateRange, DateRangeCompare, type DateRangeCompareProps, DateRangePicker, type DateRangePickerProps, DropdownMenu, type DropdownMenuItem, type DropdownMenuProps, FunnelChart, type FunnelChartProps, type FunnelStep, Input, KpiCard, type KpiCardProps, LineChart, Link, type LinkProps, Modal, type ModalProps, PERIOD_PRESETS, type PeriodCompareMode, type PeriodPreset, type PeriodPresetKey, type PeriodRange, type PeriodValue, Popover, type PopoverProps, Select, type SelectOption, type SelectProps, SidePanel, type SidePanelProps, Spinner, type SpinnerProps, StackedBarChart, Switch, type SwitchProps, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, type TabsProps, TabsTrigger, Textarea, type TextareaProps, type ToastInput, ToastProvider, Tooltip, type TooltipProps, type ValueFormatter, badgeVariants, buttonVariants, cn, comparisonRange, copyToClipboard, downloadBlob, downloadCsv, formatCellValue, formatPeriod, formatRange, makePeriod, periodFromPreset, relativeDelta, toCsv, useAppApi, useAppContext, useAppPageHref, useAppRun, useAppRuns, useAppSettings, useToast };
790
+ /**
791
+ * Icons for external sites and the platform's integrations.
792
+ *
793
+ * The shell serves one 128 px icon per integration at `/brand-logos/<key>.png`
794
+ * (same origin as every app page). A link to one of those brands resolves to
795
+ * that file; any other site falls back to its favicon, fetched from Google's
796
+ * favicon service (the page's hostname is sent to Google — never pass a URL
797
+ * whose hostname is itself sensitive).
798
+ */
799
+ /** Integration keys with a file under `/brand-logos/`. */
800
+ declare const BRAND_LOGO_KEYS: readonly ["anthropic", "bigblue", "cchezvous", "google-ads", "google-drive", "google-search-console", "google-sheets", "gorgias", "hubble", "judgeme", "klaviyo", "meta", "monday", "openai", "openrouter", "pennylane", "pipedrive", "prediko", "ringover", "shopify", "slack"];
801
+ type BrandLogoKey = (typeof BRAND_LOGO_KEYS)[number];
802
+ /** Integration key a URL belongs to (`https://acme.gorgias.com/app` → `gorgias`), or null. */
803
+ declare function brandKeyForUrl(url: string): BrandLogoKey | null;
804
+ declare function isBrandLogoKey(key: string): key is BrandLogoKey;
805
+ /**
806
+ * Icon URL for an integration key or a site URL: the shipped brand logo when
807
+ * there is one, the site's favicon otherwise, null for something that is not
808
+ * an http(s) URL.
809
+ */
810
+ declare function siteIconUrl(target: {
811
+ provider?: string;
812
+ href?: string;
813
+ }): string | null;
814
+ type SiteIconProps = ({
815
+ provider: string;
816
+ href?: never;
817
+ } | {
818
+ href: string;
819
+ provider?: never;
820
+ }) & {
821
+ /** Sizing goes through the class, like a Lucide icon (default `size-4`). */
822
+ className?: string;
823
+ };
824
+ /**
825
+ * Logo of an integration (`provider="klaviyo"`) or favicon of the site a link
826
+ * points to (`href="https://…"`). Decorative: put it next to text that names
827
+ * the target. Falls back to a neutral globe when no icon can be loaded.
828
+ */
829
+ declare function SiteIcon({ className, provider, href }: SiteIconProps): React.JSX.Element;
830
+
831
+ export { type AppApiClient, AppApiProvider, AppContextProvider, type AppContextValue, AppInvokeError, type AppPageQuery, AreaChart, BRAND_LOGO_KEYS, Badge, type BadgeProps, BarChart, type BrandLogoKey, Button, type ButtonProps, COMPARE_LABELS, COMPARE_SHORT_LABELS, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CartesianChartProps, type ChartRow, type ChartSeries, Checkbox, type CheckboxProps, CopyButton, type CopyButtonProps, DataTable, type DataTableBulkAction, type DataTableColumn, type DataTableColumnFormat, type DataTableCsvExport, type DataTableFacet, type DataTableFilter, type DataTableFilterOperator, type DataTableLoadMore, type DataTablePagination, type DataTableProps, type DataTableSort, type DataTableState, type DateRange, DateRangeCompare, type DateRangeCompareProps, DateRangePicker, type DateRangePickerProps, DropdownMenu, type DropdownMenuItem, type DropdownMenuProps, FunnelChart, type FunnelChartProps, type FunnelStep, Input, KpiCard, type KpiCardProps, LineChart, Link, type LinkProps, Modal, type ModalProps, PERIOD_PRESETS, type PeriodCompareMode, type PeriodPreset, type PeriodPresetKey, type PeriodRange, type PeriodValue, Popover, type PopoverProps, Select, type SelectOption, type SelectProps, SidePanel, type SidePanelProps, SiteIcon, type SiteIconProps, Spinner, type SpinnerProps, StackedBarChart, Switch, type SwitchProps, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, type TabsProps, TabsTrigger, Textarea, type TextareaProps, type ToastInput, ToastProvider, Tooltip, type TooltipProps, type ValueFormatter, badgeVariants, brandKeyForUrl, buttonVariants, cn, comparisonRange, copyToClipboard, downloadBlob, downloadCsv, formatCellValue, formatPeriod, formatRange, isBrandLogoKey, makePeriod, periodFromPreset, relativeDelta, siteIconUrl, toCsv, useAppApi, useAppContext, useAppPageHref, useAppRun, useAppRuns, useAppSettings, useToast };
package/dist/index.js CHANGED
@@ -2638,7 +2638,126 @@ function Tooltip2({ label, children, side = "top", className }) {
2638
2638
  )
2639
2639
  ] });
2640
2640
  }
2641
+ var BRAND_LOGO_KEYS = [
2642
+ "anthropic",
2643
+ "bigblue",
2644
+ "cchezvous",
2645
+ "google-ads",
2646
+ "google-drive",
2647
+ "google-search-console",
2648
+ "google-sheets",
2649
+ "gorgias",
2650
+ "hubble",
2651
+ "judgeme",
2652
+ "klaviyo",
2653
+ "meta",
2654
+ "monday",
2655
+ "openai",
2656
+ "openrouter",
2657
+ "pennylane",
2658
+ "pipedrive",
2659
+ "prediko",
2660
+ "ringover",
2661
+ "shopify",
2662
+ "slack"
2663
+ ];
2664
+ var HOSTS = [
2665
+ ["docs.google.com", "google-sheets", "/spreadsheets/"],
2666
+ ["ads.google.com", "google-ads"],
2667
+ ["search.google.com", "google-search-console"],
2668
+ ["drive.google.com", "google-drive"],
2669
+ ["sheets.google.com", "google-sheets"],
2670
+ ["shopify.com", "shopify"],
2671
+ ["myshopify.com", "shopify"],
2672
+ ["facebook.com", "meta"],
2673
+ ["instagram.com", "meta"],
2674
+ ["meta.com", "meta"],
2675
+ ["bigblue.co", "bigblue"],
2676
+ ["cchezvous.fr", "cchezvous"],
2677
+ ["gorgias.com", "gorgias"],
2678
+ ["thehubble.co", "hubble"],
2679
+ ["judge.me", "judgeme"],
2680
+ ["klaviyo.com", "klaviyo"],
2681
+ ["monday.com", "monday"],
2682
+ ["pennylane.com", "pennylane"],
2683
+ ["pipedrive.com", "pipedrive"],
2684
+ ["prediko.io", "prediko"],
2685
+ ["ringover.com", "ringover"],
2686
+ ["slack.com", "slack"],
2687
+ ["anthropic.com", "anthropic"],
2688
+ ["claude.ai", "anthropic"],
2689
+ ["openai.com", "openai"],
2690
+ ["chatgpt.com", "openai"],
2691
+ ["openrouter.ai", "openrouter"]
2692
+ ];
2693
+ function parseHttpUrl(url) {
2694
+ try {
2695
+ const parsed = new URL(/^[a-z][a-z\d+.-]*:/i.test(url) ? url : `https://${url}`);
2696
+ return parsed.protocol === "http:" || parsed.protocol === "https:" ? parsed : null;
2697
+ } catch {
2698
+ return null;
2699
+ }
2700
+ }
2701
+ function brandKeyForUrl(url) {
2702
+ const parsed = parseHttpUrl(url);
2703
+ if (!parsed) return null;
2704
+ for (const [domain, key, pathPrefix] of HOSTS) {
2705
+ const hostMatches = parsed.hostname === domain || parsed.hostname.endsWith(`.${domain}`);
2706
+ if (hostMatches && (!pathPrefix || parsed.pathname.startsWith(pathPrefix))) return key;
2707
+ }
2708
+ return null;
2709
+ }
2710
+ function isBrandLogoKey(key) {
2711
+ return BRAND_LOGO_KEYS.includes(key);
2712
+ }
2713
+ function siteIconUrl(target) {
2714
+ if (target.provider !== void 0) {
2715
+ return isBrandLogoKey(target.provider) ? `/brand-logos/${target.provider}.png` : null;
2716
+ }
2717
+ if (target.href === void 0) return null;
2718
+ const brand = brandKeyForUrl(target.href);
2719
+ if (brand) return `/brand-logos/${brand}.png`;
2720
+ const host = parseHttpUrl(target.href)?.hostname;
2721
+ return host ? `https://www.google.com/s2/favicons?domain=${encodeURIComponent(host)}&sz=64` : null;
2722
+ }
2723
+ function SiteIcon({ className, provider, href }) {
2724
+ const src = siteIconUrl({ provider, href });
2725
+ const [failed, setFailed] = React2.useState(false);
2726
+ React2.useEffect(() => setFailed(false), [src]);
2727
+ if (!src || failed) {
2728
+ return /* @__PURE__ */ jsxs(
2729
+ "svg",
2730
+ {
2731
+ viewBox: "0 0 24 24",
2732
+ fill: "none",
2733
+ stroke: "currentColor",
2734
+ strokeWidth: 2,
2735
+ strokeLinecap: "round",
2736
+ strokeLinejoin: "round",
2737
+ "aria-hidden": true,
2738
+ className: cn("size-4 shrink-0 text-muted-foreground", className),
2739
+ children: [
2740
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
2741
+ /* @__PURE__ */ jsx("path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" }),
2742
+ /* @__PURE__ */ jsx("path", { d: "M2 12h20" })
2743
+ ]
2744
+ }
2745
+ );
2746
+ }
2747
+ return /* @__PURE__ */ jsx(
2748
+ "img",
2749
+ {
2750
+ src,
2751
+ alt: "",
2752
+ "aria-hidden": true,
2753
+ loading: "lazy",
2754
+ referrerPolicy: "no-referrer",
2755
+ onError: () => setFailed(true),
2756
+ className: cn("size-4 shrink-0 rounded-[22%] object-contain", className)
2757
+ }
2758
+ );
2759
+ }
2641
2760
 
2642
- export { AppApiProvider, AppContextProvider, AppInvokeError, AreaChart, Badge, BarChart, Button, COMPARE_LABELS, COMPARE_SHORT_LABELS, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CopyButton, DataTable, DateRangeCompare, DateRangePicker, DropdownMenu, FunnelChart, Input, KpiCard, LineChart, Link, Modal, PERIOD_PRESETS, Popover, Select, SidePanel, Spinner, StackedBarChart, Switch, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ToastProvider, Tooltip2 as Tooltip, badgeVariants, buttonVariants, cn, comparisonRange, copyToClipboard, downloadBlob, downloadCsv, formatCellValue, formatPeriod, formatRange, makePeriod, periodFromPreset, relativeDelta, toCsv, useAppApi, useAppContext, useAppPageHref, useAppRun, useAppRuns, useAppSettings, useToast };
2761
+ export { AppApiProvider, AppContextProvider, AppInvokeError, AreaChart, BRAND_LOGO_KEYS, Badge, BarChart, Button, COMPARE_LABELS, COMPARE_SHORT_LABELS, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CopyButton, DataTable, DateRangeCompare, DateRangePicker, DropdownMenu, FunnelChart, Input, KpiCard, LineChart, Link, Modal, PERIOD_PRESETS, Popover, Select, SidePanel, SiteIcon, Spinner, StackedBarChart, Switch, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ToastProvider, Tooltip2 as Tooltip, badgeVariants, brandKeyForUrl, buttonVariants, cn, comparisonRange, copyToClipboard, downloadBlob, downloadCsv, formatCellValue, formatPeriod, formatRange, isBrandLogoKey, makePeriod, periodFromPreset, relativeDelta, siteIconUrl, toCsv, useAppApi, useAppContext, useAppPageHref, useAppRun, useAppRuns, useAppSettings, useToast };
2643
2762
  //# sourceMappingURL=index.js.map
2644
2763
  //# sourceMappingURL=index.js.map