aomi-widget
aomi/aomi-widgetFreeComponent
Embeddable Aomi widget with tenant-scoped provider or wallet authentication.
Install it
npx shadcn@latest add https://aomi.dev/r/aomi-widget.jsonSource
1"use client";23import type { CSSProperties, ReactNode } from "react";4import type { AomiClientOptions } from "@aomi-labs/react";5import { AomiFrame, type AomiFrameControlBarProps } from "./aomi-frame";6import { AomiWalletKitProvider, useAomiWalletKit } from "../lib/wallet-kit";7import type {8 AccountConfig,9 AomiWidgetAuthConfig,10 AuthConfig,11 ExecutionConfig,12 ProvidersConfig,13 WalletsConfig,14} from "../lib/wallet-kit/config/types";1516export type { AomiWidgetAuthConfig } from "../lib/wallet-kit/config/types";1718export type AomiWidgetProps = {19 children?: ReactNode;20 apiUrl: string;21 width?: CSSProperties["width"];22 height?: CSSProperties["height"];23 className?: string;24 style?: CSSProperties;25 walletPosition?: "header" | "footer" | null;26 walletFamilies?: Array<"evm" | "solana">;27 showSidebar?: boolean;28 showHeader?: boolean;29 controlBarProps?: Omit<AomiFrameControlBarProps, "children">;30 clientOptions?: Omit<AomiClientOptions, "baseUrl" | "getAccountBearer">;31 persistThread?: boolean;32 threadPersistenceKey?: string;33 threadPersistenceScope?: string | null;34 auth?: AomiWidgetAuthConfig;35 providers?: ProvidersConfig;36 wallets?: WalletsConfig;37 execution?: ExecutionConfig;38 account?: AccountConfig;39};4041export function AomiWidget(props: AomiWidgetProps) {42 const resolvedApiUrl = props.apiUrl.replace(/\/+$/, "");43 const resolved = resolveWidgetAuth(props.auth, props.providers);44 const account =45 props.account === undefined46 ? {47 mode: "aomi-backend" as const,48 baseUrl: resolvedApiUrl,49 widgetAuth: props.auth50 ? {51 mode: "provider" as const,52 provider: props.auth.provider,53 environment: props.auth.environment,54 }55 : { mode: "wallet" as const },56 }57 : props.account;5859 return (60 <AomiWalletKitProvider61 auth={resolved.auth}62 providers={resolved.providers}63 wallets={props.wallets}64 execution={props.execution ?? { aa: "optional" }}65 account={account}66 >67 <WidgetFrame68 apiUrl={resolvedApiUrl}69 width={props.width}70 height={props.height}71 className={props.className}72 style={props.style}73 walletPosition={props.walletPosition}74 walletFamilies={props.walletFamilies}75 showSidebar={props.showSidebar}76 showHeader={props.showHeader}77 controlBarProps={props.controlBarProps}78 clientOptions={props.clientOptions}79// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from aomi
All 34 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | aomi | Components | Free | 2 deps | |
| alertalert | aomi | Components | Free | 1 dep | |
| aomi-frameaomi-frame | aomi | Components | Free | 1 dep | |
| aomi-para-provideraomi-para-provider | aomi | Components | Free | 9 deps · 27 files | |
| aomi-privy-provideraomi-privy-provider | aomi | Components | Free | 7 deps · 15 files | |
| aomi-wallet-kitaomi-wallet-kit | aomi | Components | Free | 8 deps · 59 files | |
| assistant-threadassistant-thread | aomi | Components | Free | 6 deps · 26 files | |
| assistant-thread-listassistant-thread-list | aomi | Components | Free | 2 deps |
