@fluent.xyz/connect 0.2.0 → 0.2.2

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.ts CHANGED
@@ -1241,6 +1241,12 @@ type FluentWidgetConfig = {
1241
1241
  gasPayment?: {
1242
1242
  ethValueByToken?: FluentGasPaymentEthRates;
1243
1243
  };
1244
+ /**
1245
+ * `false` drops the Reputation tab from the account drawer — and with it the
1246
+ * whole tab strip, since Home is then the only tab. The families request is
1247
+ * never made. Default `true`.
1248
+ */
1249
+ reputationEnabled?: boolean;
1244
1250
  scopes?: string[];
1245
1251
  source?: string;
1246
1252
  campaign?: string;
@@ -1259,6 +1265,19 @@ type FluentWidgetConfig = {
1259
1265
  */
1260
1266
  authTokenRenewalOffsetSeconds?: number;
1261
1267
  assets?: Partial<typeof FLUENT_CONNECT_DEFAULT_ASSETS>;
1268
+ /** The account avatar shown on the connect button and in the account drawer. */
1269
+ avatar?: {
1270
+ /**
1271
+ * Image used when there is no X avatar to show — a URL or a data URI.
1272
+ * Defaults to the Fluent mark.
1273
+ */
1274
+ defaultLogoUrl?: string;
1275
+ /**
1276
+ * Always show `defaultLogoUrl`, even for users who signed in with X.
1277
+ * Default `false` (the X avatar wins when Privy has one).
1278
+ */
1279
+ forceDefault?: boolean;
1280
+ };
1262
1281
  };
1263
1282
  type ResolvedFluentWidgetConfig = {
1264
1283
  partnerId: string;
@@ -1285,10 +1304,15 @@ type ResolvedFluentWidgetConfig = {
1285
1304
  gasPayment: {
1286
1305
  ethValueByToken: FluentGasPaymentEthRates | undefined;
1287
1306
  };
1307
+ reputationEnabled: boolean;
1288
1308
  scopes: string[];
1289
1309
  source: string;
1290
1310
  campaign: string | undefined;
1291
1311
  assets: typeof FLUENT_CONNECT_DEFAULT_ASSETS & Partial<typeof FLUENT_CONNECT_DEFAULT_ASSETS>;
1312
+ avatar: {
1313
+ defaultLogoUrl: string | undefined;
1314
+ forceDefault: boolean;
1315
+ };
1292
1316
  };
1293
1317
 
1294
1318
  declare function normalizeFluentWidgetNetwork(value: string | undefined): FluentWidgetNetwork | undefined;
@@ -1784,9 +1808,11 @@ type FluentWidgetConnectButtonProps = {
1784
1808
  onClick: () => void;
1785
1809
  className?: string;
1786
1810
  userLogoUrl?: string | null;
1811
+ /** Shown instead of the Fluent mark when there is no `userLogoUrl` — a URL or a data URI. */
1812
+ defaultLogoUrl?: string | null;
1787
1813
  };
1788
1814
  /** Default Fluent Connect / account button — place it anywhere in your layout. */
1789
- declare function FluentWidgetConnectButton({ connected, pending, addressLabel, onClick, className, userLogoUrl, }: FluentWidgetConnectButtonProps): React.JSX.Element;
1815
+ declare function FluentWidgetConnectButton({ connected, pending, addressLabel, onClick, className, userLogoUrl, defaultLogoUrl, }: FluentWidgetConnectButtonProps): React.JSX.Element;
1790
1816
 
1791
1817
  declare const FLUENT_ZERODEV_ERC20_PAYMASTER_QUERY = "selfFunded=true";
1792
1818
  declare const FLUENT_ZERODEV_PAYMASTER_DEMO_RECIPIENT: "0x000000000000000000000000000000000000dEaD";
@@ -1939,6 +1965,81 @@ declare function sendFluentZeroDevErc20PaymasterDemo(params: {
1939
1965
  */
1940
1966
  declare function clearPrivyRecentLoginMethod(appId: string): void;
1941
1967
 
1968
+ interface FluentAccountDrawerProps {
1969
+ accountOpen: boolean;
1970
+ setAccountOpen: (open: boolean | ((current: boolean) => boolean)) => void;
1971
+ hasConnectedAccount: boolean;
1972
+ isMobile: boolean;
1973
+ connectButton: ReactNode;
1974
+ accountMenuAddress?: string;
1975
+ onAccountMenuAction: (value: string | null) => void;
1976
+ settingsOpen?: boolean;
1977
+ onCloseSettings?: () => void;
1978
+ /** Preview harnesses relax these to keep the drawer pinned open; the widget keeps the modal defaults. */
1979
+ modal?: boolean | "trap-focus";
1980
+ disablePointerDismissal?: boolean;
1981
+ children: ReactNode;
1982
+ userLogoUrl?: string | null;
1983
+ /** Shown instead of the Fluent mark when there is no `userLogoUrl` — a URL or a data URI. */
1984
+ defaultLogoUrl?: string | null;
1985
+ }
1986
+ /**
1987
+ * The connected-account drawer shell: the connect-button trigger, the account
1988
+ * header/actions menu (explorer / copy / settings / disconnect), and a slot
1989
+ * (`children`) for the wallet menu card. Rendered whenever the widget has a
1990
+ * connected account.
1991
+ */
1992
+ declare function FluentAccountDrawer({ accountOpen, setAccountOpen, hasConnectedAccount, isMobile, connectButton, accountMenuAddress, onAccountMenuAction, settingsOpen, onCloseSettings, modal, disablePointerDismissal, children, userLogoUrl, defaultLogoUrl, }: FluentAccountDrawerProps): React.JSX.Element;
1993
+
1994
+ /** Colour scheme and design tokens for the widget's own UI — never around host content. */
1995
+ declare const WIDGET_STYLE_SCOPE = "fluent-root dark contents text-foreground";
1996
+ /**
1997
+ * Provides the element widget overlays portal into, so they inherit the widget's
1998
+ * scope instead of landing on a bare `<body>` outside every token definition.
1999
+ *
2000
+ * The element is attached to `document.body` rather than rendered into the React
2001
+ * tree on purpose: overlays position themselves with `position: fixed`, and a
2002
+ * host mounting `<FluentWidget>` inside an element with `transform`, `filter` or
2003
+ * `contain` would turn that ancestor into their containing block and misplace
2004
+ * every one of them.
2005
+ */
2006
+ declare function FluentPortalContainerProvider({ children }: {
2007
+ children: ReactNode;
2008
+ }): React.JSX.Element;
2009
+
2010
+ type FluentAnalyticsSendOptions = {
2011
+ /** The page is going away — this event has to leave before the tab does. */
2012
+ unload?: boolean;
2013
+ };
2014
+ type FluentAnalyticsTrack = {
2015
+ (eventName: string, properties?: Record<string, unknown>, options?: FluentAnalyticsSendOptions): void;
2016
+ /** False when analytics is off for this config, so every call is a no-op. */
2017
+ live?: boolean;
2018
+ };
2019
+
2020
+ interface WalletMenuActionCardProps {
2021
+ track: FluentAnalyticsTrack;
2022
+ session: FluentWidgetSession | null;
2023
+ smartAccountAddress?: string;
2024
+ faucetBusy: boolean;
2025
+ onFaucet: () => void;
2026
+ config: FluentWidgetConfig;
2027
+ tokens?: readonly FluentTokenDefinition[];
2028
+ gasPaymentToken: FluentGasTokenSymbol;
2029
+ onGasPaymentTokenChange: (token: FluentGasTokenSymbol) => void;
2030
+ silentSigningEnabled: boolean;
2031
+ onSilentSigningChange: (enabled: boolean) => void;
2032
+ onDisconnect: () => void;
2033
+ onConnectWithX: () => void;
2034
+ tab: string;
2035
+ onTabChange: (tab: string) => void;
2036
+ /** The connected account address shown in the header (external EOA or Fluent smart account). */
2037
+ connectedAddress?: string;
2038
+ /** Bumped after a confirmed widget transaction so balances refetch. */
2039
+ balanceRevisionCounter?: number;
2040
+ }
2041
+ declare function WalletMenuActionCard({ track, session, smartAccountAddress, faucetBusy, onFaucet, config, tokens, gasPaymentToken, onGasPaymentTokenChange, silentSigningEnabled, onSilentSigningChange, onDisconnect, onConnectWithX, tab, onTabChange, connectedAddress, balanceRevisionCounter, }: WalletMenuActionCardProps): React.JSX.Element;
2042
+
1942
2043
  declare const buttonVariants: (props?: ({
1943
2044
  variant?: "default" | "link" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
1944
2045
  size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
@@ -1946,6 +2047,8 @@ declare const buttonVariants: (props?: ({
1946
2047
  type ButtonProps = Button$1.Props & VariantProps<typeof buttonVariants> & Pick<AnchorHTMLAttributes<HTMLAnchorElement>, "href" | "target" | "rel">;
1947
2048
  declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
1948
2049
 
2050
+ declare function Label({ className, ...props }: React.ComponentProps<"label">): React.JSX.Element;
2051
+
1949
2052
  declare function Dialog({ ...props }: Dialog$1.Root.Props): React.JSX.Element;
1950
2053
  declare function DialogTrigger({ ...props }: Dialog$1.Trigger.Props): React.JSX.Element;
1951
2054
  declare function DialogPortal({ container, ...props }: Dialog$1.Portal.Props): React.JSX.Element;
@@ -1968,4 +2071,18 @@ declare function Icon({ name, className, ...props }: {
1968
2071
  name: IconName;
1969
2072
  } & SVGProps<SVGSVGElement>): React.JSX.Element;
1970
2073
 
1971
- export { type AppDefinition, type BridgeAddresses, Button, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, FLUENT_CONNECT_DEFAULT_ASSETS, FLUENT_GAS_PAYMENT_DEFAULT_ETH_RATES, FLUENT_USER_TOKEN_LIMIT, FLUENT_WIDGET_SESSION_STORAGE_KEY, FLUENT_WIDGET_USER_TOKENS_STORAGE_KEY, FLUENT_ZERODEV_ERC20_PAYMASTER_QUERY, FLUENT_ZERODEV_PAYMASTER_DEMO_RECIPIENT, type FluentAccountCapabilities, type FluentAccountType, FluentAuthError, type FluentAuthErrorCode, type FluentBatchApi, type FluentBatchCallInput, type FluentBatchConfirmationMode, type FluentBatchOperation, type FluentBatchOperationExecuteOptions, type FluentBatchOperationExecutor, type FluentBatchOperationInput, type FluentBatchOperationReview, type FluentCallPermission, type FluentChainDefinition, type FluentClient, type FluentClientConfig, type FluentEncodedBatchCall, type FluentExecuteResult, type FluentExternalWalletState, type FluentFamilies, type FluentFamiliesClient, type FluentFamiliesClientConfig, type FluentFamily, type FluentFamilyTier, type FluentFamilyType, type FluentGasPayment, type FluentGasPaymentEthRates, type FluentGasPaymentSelection, type FluentGasPaymentValueTier, type FluentGasTokenSymbol, type FluentPermissionApi, type FluentPermissionArgConstraint, type FluentPermissionArgs, type FluentPermissionBatchPolicy, type FluentPermissionBatchPolicyInput, type FluentPermissionCallInput, type FluentPermissionCallPolicy, type FluentPermissionClient, type FluentPermissionClientConfig, type FluentPermissionGrant, type FluentPermissionGrantRequest, type FluentPermissionPolicy, type FluentPermissionPolicyBuilders, type FluentPermissionPreview, type FluentPermissionSession, type FluentPermissionSessionExecutor, type FluentPermissionSessionInput, type FluentPermissionStatus, type FluentSession, type FluentSpendPeriod, type FluentSpendPermission, type FluentSponsorshipReason, type FluentTokenBalance, type FluentTokenDefinition, type FluentUserTokenAddResult, FluentWidget, type FluentWidgetAccount, type FluentWidgetAuthMode, type FluentWidgetConfig, FluentWidgetConnectButton, type FluentWidgetConnectButtonProps, type FluentWidgetConnectButtonRenderContext, type FluentWidgetExecutionStatus, type FluentWidgetGasPayment, type FluentWidgetNetwork, FluentWidgetNetworkProvider, type FluentWidgetProps, type FluentWidgetRenderContext, type FluentWidgetSession, type FluentWidgetStatus, type FluentZeroDevErc20PaymasterToken, type FluentZeroDevErc20PaymasterTokenInfo, type FluentZeroDevKernel, type FluentZeroDevPaymasterDemoResult, type FluentZeroDevPaymasterKernel, type FluentZeroDevPermissionCall, type FluentZeroDevPermissionSession, type FluentZeroDevSignerMode, Icon, type IconName, type L1ChainDefinition, type ResolvedFluentWidgetConfig, Separator, type UserTokenStore, type ZerodevIntegration, buttonVariants, clearPrivyRecentLoginMethod, createFluentBatchOp, createFluentClient, createFluentFamiliesClient, createFluentPermissionApi, createFluentPermissionClient, createFluentPermissionPolicyBuilders, createFluentPermissionSession, createFluentSponsorshipRpcUrl, createFluentUserTokenStore, createFluentZeroDevErc20Paymaster, createFluentZeroDevErc20PaymasterApprovalCall, createFluentZeroDevErc20PaymasterClient, createFluentZeroDevErc20PaymasterRpcUrl, createFluentZeroDevPermissionSession, createFluentZeroDevRpcUrl, createFluentZeroDevSponsoredPaymaster, findFluentSymbolCollisions, fluent, apps as fluentApps, fluentBridgeAbi, fluent$1 as fluentChain, fluentChains, fluentDefinitionToViemChain, integrations as fluentIntegrations, l1Chains as fluentL1Chains, fluentMainnet, fluentMainnetTokenDefaults, fluentTestnet, fluentTestnetTokenDefaults, fluentTokenIdentity, fluentZeroDevChainIds, getApp, getContractAddressFromChain, getFluentChain, getFluentChainByChainId, getFluentChainForNetwork, getFluentDefaultWidgetDisplayTokens, getFluentDefaultWidgetGasTokens, getFluentExplorerBaseUrl, getFluentGasPaymentEthValue, getFluentGasPaymentTokens, getFluentGasPaymentValueTier, getFluentGasTokenAddress, getFluentTokenDefaults, getFluentTokenDefaultsForNetwork, getFluentZeroDevErc20PaymasterTokens, getL1Chain, getL1ForFluentChain, getZeroDevRpcUrl, getZerodevIntegration, isFaucetNetwork, isFluentDefaultToken, isFluentNativeToken, isFluentZeroDevChain, l1DefinitionToViemChain, mergeFluentDisplayTokens, normalizeFluentWidgetNetwork, readFluentTokenBalances, readFluentTokenMetadata, registryVersion, resolveBridgeAddresses, resolveFluentWidgetNetworkFromEnv, resolveFluentZeroDevErc20PaymasterToken, resolveL1Definition, selectFluentGasPaymentToken, sendFluentZeroDevErc20PaymasterDemo, sortFluentGasTokens, useFluentUserTokens, useFluentWidget, useFluentWidgetNetwork, useFluentZeroDevAccount, useWidget };
2074
+ type AccountAvatarProps = {
2075
+ /** The signed-in user's X avatar, when Privy has one. Wins over `defaultLogoUrl`. */
2076
+ userLogoUrl?: string | null;
2077
+ /** Host-supplied stand-in for the Fluent mark — a URL or a data URI. */
2078
+ defaultLogoUrl?: string | null;
2079
+ className?: string;
2080
+ };
2081
+ /**
2082
+ * The 32px account tile's contents: X avatar, else the host's default logo, else
2083
+ * the Fluent mark. A logo that fails to load falls through to the next option
2084
+ * rather than leaving a broken image in the button.
2085
+ */
2086
+ declare function AccountAvatar({ userLogoUrl, defaultLogoUrl, className }: AccountAvatarProps): React.JSX.Element;
2087
+
2088
+ export { AccountAvatar, type AccountAvatarProps, type AppDefinition, type BridgeAddresses, Button, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, FLUENT_CONNECT_DEFAULT_ASSETS, FLUENT_GAS_PAYMENT_DEFAULT_ETH_RATES, FLUENT_USER_TOKEN_LIMIT, FLUENT_WIDGET_SESSION_STORAGE_KEY, FLUENT_WIDGET_USER_TOKENS_STORAGE_KEY, FLUENT_ZERODEV_ERC20_PAYMASTER_QUERY, FLUENT_ZERODEV_PAYMASTER_DEMO_RECIPIENT, type FluentAccountCapabilities, FluentAccountDrawer, type FluentAccountType, FluentAuthError, type FluentAuthErrorCode, type FluentBatchApi, type FluentBatchCallInput, type FluentBatchConfirmationMode, type FluentBatchOperation, type FluentBatchOperationExecuteOptions, type FluentBatchOperationExecutor, type FluentBatchOperationInput, type FluentBatchOperationReview, type FluentCallPermission, type FluentChainDefinition, type FluentClient, type FluentClientConfig, type FluentEncodedBatchCall, type FluentExecuteResult, type FluentExternalWalletState, type FluentFamilies, type FluentFamiliesClient, type FluentFamiliesClientConfig, type FluentFamily, type FluentFamilyTier, type FluentFamilyType, type FluentGasPayment, type FluentGasPaymentEthRates, type FluentGasPaymentSelection, type FluentGasPaymentValueTier, type FluentGasTokenSymbol, type FluentPermissionApi, type FluentPermissionArgConstraint, type FluentPermissionArgs, type FluentPermissionBatchPolicy, type FluentPermissionBatchPolicyInput, type FluentPermissionCallInput, type FluentPermissionCallPolicy, type FluentPermissionClient, type FluentPermissionClientConfig, type FluentPermissionGrant, type FluentPermissionGrantRequest, type FluentPermissionPolicy, type FluentPermissionPolicyBuilders, type FluentPermissionPreview, type FluentPermissionSession, type FluentPermissionSessionExecutor, type FluentPermissionSessionInput, type FluentPermissionStatus, FluentPortalContainerProvider, type FluentSession, type FluentSpendPeriod, type FluentSpendPermission, type FluentSponsorshipReason, type FluentTokenBalance, type FluentTokenDefinition, type FluentUserTokenAddResult, FluentWidget, type FluentWidgetAccount, type FluentWidgetAuthMode, type FluentWidgetConfig, FluentWidgetConnectButton, type FluentWidgetConnectButtonProps, type FluentWidgetConnectButtonRenderContext, type FluentWidgetExecutionStatus, type FluentWidgetGasPayment, type FluentWidgetNetwork, FluentWidgetNetworkProvider, type FluentWidgetProps, type FluentWidgetRenderContext, type FluentWidgetSession, type FluentWidgetStatus, type FluentZeroDevErc20PaymasterToken, type FluentZeroDevErc20PaymasterTokenInfo, type FluentZeroDevKernel, type FluentZeroDevPaymasterDemoResult, type FluentZeroDevPaymasterKernel, type FluentZeroDevPermissionCall, type FluentZeroDevPermissionSession, type FluentZeroDevSignerMode, Icon, type IconName, type L1ChainDefinition, Label, type ResolvedFluentWidgetConfig, Separator, type UserTokenStore, WIDGET_STYLE_SCOPE, WalletMenuActionCard, type ZerodevIntegration, buttonVariants, clearPrivyRecentLoginMethod, createFluentBatchOp, createFluentClient, createFluentFamiliesClient, createFluentPermissionApi, createFluentPermissionClient, createFluentPermissionPolicyBuilders, createFluentPermissionSession, createFluentSponsorshipRpcUrl, createFluentUserTokenStore, createFluentZeroDevErc20Paymaster, createFluentZeroDevErc20PaymasterApprovalCall, createFluentZeroDevErc20PaymasterClient, createFluentZeroDevErc20PaymasterRpcUrl, createFluentZeroDevPermissionSession, createFluentZeroDevRpcUrl, createFluentZeroDevSponsoredPaymaster, findFluentSymbolCollisions, fluent, apps as fluentApps, fluentBridgeAbi, fluent$1 as fluentChain, fluentChains, fluentDefinitionToViemChain, integrations as fluentIntegrations, l1Chains as fluentL1Chains, fluentMainnet, fluentMainnetTokenDefaults, fluentTestnet, fluentTestnetTokenDefaults, fluentTokenIdentity, fluentZeroDevChainIds, getApp, getContractAddressFromChain, getFluentChain, getFluentChainByChainId, getFluentChainForNetwork, getFluentDefaultWidgetDisplayTokens, getFluentDefaultWidgetGasTokens, getFluentExplorerBaseUrl, getFluentGasPaymentEthValue, getFluentGasPaymentTokens, getFluentGasPaymentValueTier, getFluentGasTokenAddress, getFluentTokenDefaults, getFluentTokenDefaultsForNetwork, getFluentZeroDevErc20PaymasterTokens, getL1Chain, getL1ForFluentChain, getZeroDevRpcUrl, getZerodevIntegration, isFaucetNetwork, isFluentDefaultToken, isFluentNativeToken, isFluentZeroDevChain, l1DefinitionToViemChain, mergeFluentDisplayTokens, normalizeFluentWidgetNetwork, readFluentTokenBalances, readFluentTokenMetadata, registryVersion, resolveBridgeAddresses, resolveFluentWidgetNetworkFromEnv, resolveFluentZeroDevErc20PaymasterToken, resolveL1Definition, selectFluentGasPaymentToken, sendFluentZeroDevErc20PaymasterDemo, sortFluentGasTokens, useFluentUserTokens, useFluentWidget, useFluentWidgetNetwork, useFluentZeroDevAccount, useWidget };