@fluent.xyz/connect 0.2.2 → 0.3.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
@@ -39,7 +39,7 @@ export function App() {
39
39
  return (
40
40
  <FluentWidget
41
41
  config={{
42
- partnerId: "partner_<32 hex, from the Fluent console>",
42
+ appId: "app_<32 hex, from the Fluent Dashboard>",
43
43
  privyClientId: "client-<issued by Fluent>",
44
44
  network: resolveFluentWidgetNetworkFromEnv() ?? "testnet",
45
45
  appName: "My App",
@@ -56,12 +56,14 @@ export function App() {
56
56
  }
57
57
  ```
58
58
 
59
- `partnerId` and `privyClientId` are both required and come from Fluent. `partnerId` is the
60
- partner's identity — sponsorship, auth and analytics speak it. `privyClientId` is login
61
- configuration: the Privy app client carrying your allowed origins.
59
+ `appId` and `privyClientId` are both required and come from Fluent. `appId` is the
60
+ App's identity — sponsorship, auth and analytics speak it — and must be the `app_<32 hex>`
61
+ value the Fluent Dashboard shows; the widget throws on any other shape. `privyClientId` is
62
+ login configuration: the Privy app client carrying your allowed origins.
62
63
 
63
- > Migrating from `clientId`? That option is gone: the value it held is now `privyClientId`,
64
- > and `partnerId` is new. Passing `clientId` throws with the same hint.
64
+ > Upgrading from 0.2.x? `partnerId` was renamed to `appId` in 0.3.0 and the id value changed
65
+ > from `partner_…` to `app_…`; passing `partnerId` throws with the same hint. Migrating from
66
+ > `clientId`? That option is gone: the value it held is now `privyClientId`.
65
67
 
66
68
  `authMode: "direct"` requires your origin registered on the Privy app client behind your `privyClientId`. Default `authMode: "hosted"` uses the Fluent authorize popup and works on any origin.
67
69
 
@@ -70,7 +72,7 @@ configuration: the Privy app client carrying your allowed origins.
70
72
  `getAuthToken()` (render context / `useFluentWidget()`) returns a 5-minute ES256 JWT signed by
71
73
  Fluent Connect. Send it to your backend once and issue your own session; verify it with the keys
72
74
  at `<iss>/.well-known/jwks.json` — `iss` is the API host root, not `/api/v1` — and check `iss`,
73
- `aud` (your `partnerId`) and `exp`. `sub` is stable per user per app. `addresses` is present only
75
+ `aud` (your `appId`) and `exp`. `sub` is stable per user per app. `addresses` is present only
74
76
  when your app has the `addresses` scope. Direct auth only. External wallets: an EOA or a deployed
75
77
  contract wallet signs in; a counterfactual smart account cannot (no ERC-6492).
76
78
  See `apps/auth-demo` for a browser-side verifier.
@@ -85,7 +87,7 @@ By default the connect control floats top-right (`connectButton="fixed"`). To pl
85
87
  // Hide the default control and use your own CTA
86
88
  <FluentWidget
87
89
  connectButton={false}
88
- config={{ partnerId: "partner_…", privyClientId: "client-…", network: "testnet", appName: "My App" }}
90
+ config={{ appId: "app_…", privyClientId: "client-…", network: "testnet", appName: "My App" }}
89
91
  mode="page"
90
92
  renderPage={({ openConnect, openAccount, hasConnectedAccount }) => (
91
93
  <button type="button" onClick={hasConnectedAccount ? openAccount : openConnect}>
package/dist/index.d.ts CHANGED
@@ -13,6 +13,7 @@ import { SmartAccount, GetPaymasterDataParameters } from 'viem/account-abstracti
13
13
  import * as class_variance_authority_types from 'class-variance-authority/types';
14
14
  import { Button as Button$1 } from '@base-ui/react/button';
15
15
  import { VariantProps } from 'class-variance-authority';
16
+ import { Switch as Switch$1 } from '@base-ui/react/switch';
16
17
  import { Dialog as Dialog$1 } from '@base-ui/react/dialog';
17
18
  import { Separator as Separator$1 } from '@base-ui/react/separator';
18
19
  import { z } from 'zod';
@@ -1197,7 +1198,7 @@ declare const FLUENT_CONNECT_DEFAULT_ASSETS: {
1197
1198
  };
1198
1199
 
1199
1200
  type FluentWidgetSession = FluentSession & {
1200
- partnerId?: string;
1201
+ appId?: string;
1201
1202
  idToken: string;
1202
1203
  wallet: Omit<FluentSession["wallet"], "smartAccountAddress"> & {
1203
1204
  smartAccountAddress: `0x${string}`;
@@ -1214,16 +1215,18 @@ type FluentWidgetSession = FluentSession & {
1214
1215
  };
1215
1216
  type FluentWidgetAuthMode = "hosted" | "direct";
1216
1217
  type FluentWidgetConfig = {
1217
- /** The partner's id (`partner_<32 hex>`) — the same string the console shows and the token's `aud` carries. */
1218
- partnerId: string;
1218
+ /** The App's id (`app_<32 hex>`) — the same string the Fluent Dashboard shows and the token's `aud` carries. */
1219
+ appId: string;
1219
1220
  /**
1220
- * The Privy app client issued by Fluent for this partner. Login configuration, not
1221
- * identity: it carries the allowed origins for Privy login, while `partnerId` is what
1221
+ * The Privy app client issued by Fluent for this App. Login configuration, not
1222
+ * identity: it carries the allowed origins for Privy login, while `appId` is what
1222
1223
  * sponsorship, auth and analytics speak.
1223
1224
  */
1224
1225
  privyClientId: string;
1225
- /** Removed in the PartnerId cutover — the type exists only so the error names the fix. */
1226
+ /** Removed in 0.2.0 — the type exists only so the error names the fix. */
1226
1227
  clientId?: never;
1228
+ /** Renamed to `appId` in 0.3.0 — the type exists only so the error names the fix. */
1229
+ partnerId?: never;
1227
1230
  network?: FluentWidgetNetwork;
1228
1231
  appName?: string;
1229
1232
  /**
@@ -1280,7 +1283,7 @@ type FluentWidgetConfig = {
1280
1283
  };
1281
1284
  };
1282
1285
  type ResolvedFluentWidgetConfig = {
1283
- partnerId: string;
1286
+ appId: string;
1284
1287
  privyClientId: string;
1285
1288
  network: FluentWidgetNetwork;
1286
1289
  appName: string;
@@ -1371,8 +1374,8 @@ type FluentZeroDevPermissionCall = {
1371
1374
  declare function useFluentZeroDevAccount(hookOptions?: {
1372
1375
  authorizeUrl?: string;
1373
1376
  allowHostedSigner?: boolean;
1374
- /** Partner id in the sponsorship path. Sponsorship is off unless both this and the URL are set. */
1375
- partnerId?: string;
1377
+ /** App id in the sponsorship path. Sponsorship is off unless both this and the URL are set. */
1378
+ appId?: string;
1376
1379
  sponsorshipUrl?: string;
1377
1380
  authorizationSession?: {
1378
1381
  expiresAt: number;
@@ -1532,7 +1535,7 @@ type FluentExecuteResult = {
1532
1535
  /** True when all calls landed atomically (smart account), false for sequential EOA txs. */
1533
1536
  atomic: boolean;
1534
1537
  /**
1535
- * True when a partner's sponsorship paid the gas for this operation. Read back off the
1538
+ * True when an App's sponsorship paid the gas for this operation. Read back off the
1536
1539
  * settled UserOperation (which contract the EntryPoint charged), not from which client
1537
1540
  * we chose to send with: a refusal in the sponsorship proxy is a flat 403 and the
1538
1541
  * account silently pays its own gas, so an optimistic flag would report the failure
@@ -1581,7 +1584,7 @@ type FluentGasPayment = {
1581
1584
  */
1582
1585
  symbol: FluentGasTokenSymbol;
1583
1586
  /**
1584
- * Whether to ask the partner's sponsorship paymaster to pay for this operation.
1587
+ * Whether to ask the App's sponsorship paymaster to pay for this operation.
1585
1588
  *
1586
1589
  * Defaults to `"auto"`, which is what every caller got before this option existed: try
1587
1590
  * sponsorship, and if the paymaster refuses, resend with the account paying its own gas.
@@ -1590,7 +1593,7 @@ type FluentGasPayment = {
1590
1593
  *
1591
1594
  * The distinction is not cosmetic: under `"auto"` the two outcomes are indistinguishable
1592
1595
  * before the send and only the settled receipt separates them, so a caller that wants to
1593
- * *demonstrate* unsponsored execution — or to keep a partner's budget untouched — has no
1596
+ * *demonstrate* unsponsored execution — or to keep an App's budget untouched — has no
1594
1597
  * way to say so. Ignored when `symbol` names an ERC-20: that token's own paymaster pays,
1595
1598
  * and sponsorship is not in the picture.
1596
1599
  */
@@ -1700,7 +1703,7 @@ type FluentWidgetRenderContext = {
1700
1703
  refreshBalances: () => void;
1701
1704
  /**
1702
1705
  * A short-lived (5 min) Fluent-signed JWT for the connected user. Verify it on your backend
1703
- * against `<iss>/.well-known/jwks.json` (ES256), checking `iss`, `aud` (= your partnerId) and
1706
+ * against `<iss>/.well-known/jwks.json` (ES256), checking `iss`, `aud` (= your appId) and
1704
1707
  * `exp`; `sub` is stable per user per app. Reused until `authTokenRenewalOffsetSeconds`
1705
1708
  * before `exp`. Direct auth only; throws `FluentAuthError`
1706
1709
  * (`code: "hosted_not_supported"`) in hosted mode. External wallets: EOAs and deployed
@@ -1793,7 +1796,7 @@ declare function useFluentUserTokens(options?: {
1793
1796
  remove: (token: Pick<FluentTokenDefinition, "chainId" | "address">) => void;
1794
1797
  };
1795
1798
 
1796
- type FluentAuthErrorCode = "unknown_partner" | "partner_not_auth_enabled" | "origin_not_allowed" | "origin_missing" | "bad_request" | "nonce_unknown" | "nonce_used" | "nonce_expired" | "partner_mismatch" | "invalid_signature" | "signature_prefix_rejected" | "address_already_linked" | "invalid_privy_token" | "no_embedded_wallet" | "rate_limited" | "internal" | "hosted_not_supported" | "not_connected" | "privy_token_missing" | "origin_mismatch" | "request_failed";
1799
+ type FluentAuthErrorCode = "unknown_app" | "app_not_auth_enabled" | "origin_not_allowed" | "origin_missing" | "bad_request" | "nonce_unknown" | "nonce_used" | "nonce_expired" | "app_mismatch" | "invalid_signature" | "signature_prefix_rejected" | "address_already_linked" | "invalid_privy_token" | "no_embedded_wallet" | "rate_limited" | "internal" | "hosted_not_supported" | "not_connected" | "privy_token_missing" | "origin_mismatch" | "request_failed";
1797
1800
  declare class FluentAuthError extends Error {
1798
1801
  readonly code: FluentAuthErrorCode;
1799
1802
  readonly status?: number | undefined;
@@ -1854,10 +1857,10 @@ declare function createFluentZeroDevErc20PaymasterRpcUrl(params?: {
1854
1857
  chainId?: number;
1855
1858
  projectId?: string;
1856
1859
  }): string;
1857
- /** The partner travels in the path, the user in the `Authorization` header. */
1860
+ /** The App travels in the path, the user in the `Authorization` header. */
1858
1861
  declare function createFluentSponsorshipRpcUrl(params: {
1859
1862
  sponsorshipUrl: string;
1860
- partnerId: string;
1863
+ appId: string;
1861
1864
  }): string;
1862
1865
  declare function createFluentZeroDevSponsoredPaymaster(params: {
1863
1866
  chain: Chain;
@@ -2049,6 +2052,10 @@ declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> &
2049
2052
 
2050
2053
  declare function Label({ className, ...props }: React.ComponentProps<"label">): React.JSX.Element;
2051
2054
 
2055
+ declare function Switch({ className, size, ...props }: Switch$1.Root.Props & {
2056
+ size?: "sm" | "default";
2057
+ }): React.JSX.Element;
2058
+
2052
2059
  declare function Dialog({ ...props }: Dialog$1.Root.Props): React.JSX.Element;
2053
2060
  declare function DialogTrigger({ ...props }: Dialog$1.Trigger.Props): React.JSX.Element;
2054
2061
  declare function DialogPortal({ container, ...props }: Dialog$1.Portal.Props): React.JSX.Element;
@@ -2085,4 +2092,4 @@ type AccountAvatarProps = {
2085
2092
  */
2086
2093
  declare function AccountAvatar({ userLogoUrl, defaultLogoUrl, className }: AccountAvatarProps): React.JSX.Element;
2087
2094
 
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 };
2095
+ 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, Switch, 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 };
package/dist/index.js CHANGED
@@ -5262,32 +5262,40 @@ var FLUENT_FAMILY_TIER_PROGRESS = {
5262
5262
  C: 33,
5263
5263
  D: 0
5264
5264
  };
5265
+ var APP_ID_PATTERN = /^app_[0-9a-f]{32}$/;
5266
+ var APP_ID_HINT = "Pass the app_<32 hex> id from the Fluent Dashboard as appId.";
5265
5267
  function resolveFluentWidgetConfig(config) {
5266
5268
  if (config.clientId !== void 0) {
5267
5269
  throw new Error(
5268
- "FluentWidgetConfig.clientId was replaced in the PartnerId cutover. Pass partnerId (the partner_<32 hex> id from the Fluent console) and the Privy app client as privyClientId \u2014 both are required."
5270
+ `FluentWidgetConfig.clientId was removed in 0.2.0. ${APP_ID_HINT} Pass the Privy app client as privyClientId \u2014 both are required.`
5269
5271
  );
5270
5272
  }
5271
- const partnerId = (config.partnerId ?? "").trim();
5272
- if (!partnerId) {
5273
+ if (config.partnerId !== void 0) {
5274
+ throw new Error(`FluentWidgetConfig.partnerId was renamed to appId in 0.3.0. ${APP_ID_HINT}`);
5275
+ }
5276
+ const appId = (config.appId ?? "").trim();
5277
+ if (!appId) {
5278
+ throw new Error(`FluentWidgetConfig.appId is required. ${APP_ID_HINT}`);
5279
+ }
5280
+ if (appId.startsWith("client-")) {
5273
5281
  throw new Error(
5274
- "FluentWidgetConfig.partnerId is required. Pass the partner_<32 hex> id from the Fluent console."
5282
+ `FluentWidgetConfig.appId "${appId}" is a Privy app client, not an app id. Pass the app_<32 hex> id as appId and the Privy client as privyClientId.`
5275
5283
  );
5276
5284
  }
5277
- if (partnerId.startsWith("client-")) {
5285
+ if (!APP_ID_PATTERN.test(appId)) {
5278
5286
  throw new Error(
5279
- `FluentWidgetConfig.partnerId "${partnerId}" is a Privy app client, not a partner id. Pass the partner_<32 hex> id as partnerId and the Privy client as privyClientId.`
5287
+ `FluentWidgetConfig.appId "${appId}" is not an app id. Expected app_<32 hex> (lowercase), the id the Fluent Dashboard shows for the App.`
5280
5288
  );
5281
5289
  }
5282
5290
  const privyClientId = (config.privyClientId ?? "").trim();
5283
5291
  if (!privyClientId) {
5284
5292
  throw new Error(
5285
- "FluentWidgetConfig.privyClientId is required. Pass the Privy app client issued by Fluent for this partner."
5293
+ "FluentWidgetConfig.privyClientId is required. Pass the Privy app client issued by Fluent for this App."
5286
5294
  );
5287
5295
  }
5288
- if (privyClientId.startsWith("partner_")) {
5296
+ if (privyClientId.startsWith("app_")) {
5289
5297
  throw new Error(
5290
- `FluentWidgetConfig.privyClientId "${privyClientId}" is a partner id, not a Privy app client. Swap the two: partnerId takes the partner_<32 hex> id, privyClientId the client-\u2026 value.`
5298
+ `FluentWidgetConfig.privyClientId "${privyClientId}" is an app id, not a Privy app client. Swap the two: appId takes the app_<32 hex> id, privyClientId the client-\u2026 value.`
5291
5299
  );
5292
5300
  }
5293
5301
  if (!privyClientId.startsWith("client-")) {
@@ -5300,7 +5308,7 @@ function resolveFluentWidgetConfig(config) {
5300
5308
  return {
5301
5309
  network,
5302
5310
  appName: config.appName ?? "Fluent Connect Demo",
5303
- partnerId,
5311
+ appId,
5304
5312
  privyClientId,
5305
5313
  authMode: config.authMode ?? "hosted",
5306
5314
  authorizeUrl: endpoints.authorizeUrl,
@@ -5572,7 +5580,7 @@ function toAuthError(err) {
5572
5580
  async function exchangePrivyAuthToken(params) {
5573
5581
  try {
5574
5582
  const { token } = await postJson(`${params.publicApiUrl}/auth/exchange/privy`, {
5575
- partnerId: params.partnerId,
5583
+ appId: params.appId,
5576
5584
  accessToken: params.accessToken,
5577
5585
  identityToken: params.identityToken
5578
5586
  });
@@ -5584,7 +5592,7 @@ async function exchangePrivyAuthToken(params) {
5584
5592
  async function exchangeWalletAuthToken(params) {
5585
5593
  const attempt = async () => {
5586
5594
  const challenge = await postJson(`${params.publicApiUrl}/auth/challenge`, {
5587
- partnerId: params.partnerId,
5595
+ appId: params.appId,
5588
5596
  address: params.address
5589
5597
  });
5590
5598
  if (challenge.typedData.message.origin !== params.origin) {
@@ -5598,7 +5606,7 @@ async function exchangeWalletAuthToken(params) {
5598
5606
  ...challenge.typedData
5599
5607
  });
5600
5608
  const { token } = await postJson(`${params.publicApiUrl}/auth/exchange/wallet`, {
5601
- partnerId: params.partnerId,
5609
+ appId: params.appId,
5602
5610
  nonce: challenge.nonce,
5603
5611
  signature
5604
5612
  });
@@ -5950,7 +5958,7 @@ function createFluentZeroDevErc20PaymasterRpcUrl(params = {}) {
5950
5958
  }
5951
5959
  function createFluentSponsorshipRpcUrl(params) {
5952
5960
  const base = params.sponsorshipUrl.replace(/\/+$/, "");
5953
- return `${base}/paymaster/${encodeURIComponent(params.partnerId)}`;
5961
+ return `${base}/paymaster/${encodeURIComponent(params.appId)}`;
5954
5962
  }
5955
5963
  function createFluentZeroDevSponsoredPaymaster(params) {
5956
5964
  const paymasterClient = createZeroDevPaymasterClient({
@@ -6313,7 +6321,7 @@ function useFluentZeroDevAccount(hookOptions = {}) {
6313
6321
  [authenticated, embeddedWallet, error, hostedSigner, initialize2, kernels.prompt, ready]
6314
6322
  );
6315
6323
  const createSponsoredClient = useCallback(async (kernel) => {
6316
- if (!hookOptions.sponsorshipUrl || !hookOptions.partnerId) return null;
6324
+ if (!hookOptions.sponsorshipUrl || !hookOptions.appId) return null;
6317
6325
  if (sponsorshipUnavailable.current) return null;
6318
6326
  const accessToken = await getAccessToken();
6319
6327
  if (!accessToken) return null;
@@ -6327,11 +6335,11 @@ function useFluentZeroDevAccount(hookOptions = {}) {
6327
6335
  accessToken,
6328
6336
  rpcUrl: createFluentSponsorshipRpcUrl({
6329
6337
  sponsorshipUrl: hookOptions.sponsorshipUrl,
6330
- partnerId: hookOptions.partnerId
6338
+ appId: hookOptions.appId
6331
6339
  })
6332
6340
  })
6333
6341
  });
6334
- }, [getAccessToken, hookOptions.partnerId, hookOptions.sponsorshipUrl]);
6342
+ }, [getAccessToken, hookOptions.appId, hookOptions.sponsorshipUrl]);
6335
6343
  const sendCalls = useCallback(
6336
6344
  async (calls, options) => {
6337
6345
  const signerMode = confirmationToSignerMode(options?.confirmation ?? "always");
@@ -6382,7 +6390,7 @@ function useFluentZeroDevAccount(hookOptions = {}) {
6382
6390
  let sponsorshipReason;
6383
6391
  if (sponsorshipRefused) {
6384
6392
  sponsorshipReason = "not_requested";
6385
- } else if (!gasToken && !sponsoredClient && hookOptions.sponsorshipUrl && hookOptions.partnerId) {
6393
+ } else if (!gasToken && !sponsoredClient && hookOptions.sponsorshipUrl && hookOptions.appId) {
6386
6394
  sponsorshipReason = sponsorshipUnavailable.current ? "unauthorized" : "no_token";
6387
6395
  }
6388
6396
  let settlementClient = executionClient;
@@ -6439,7 +6447,7 @@ function useFluentZeroDevAccount(hookOptions = {}) {
6439
6447
  error,
6440
6448
  hostedSigner,
6441
6449
  hookOptions.authorizationSession,
6442
- hookOptions.partnerId,
6450
+ hookOptions.appId,
6443
6451
  hookOptions.sponsorshipUrl,
6444
6452
  initialize2,
6445
6453
  kernels,
@@ -6950,7 +6958,7 @@ function toUnixSeconds(value) {
6950
6958
  }
6951
6959
 
6952
6960
  // package.json
6953
- var version = "0.2.2";
6961
+ var version = "0.3.0";
6954
6962
 
6955
6963
  // src/core/analytics.ts
6956
6964
  var INSTANCE_NAME = "fluent";
@@ -7032,7 +7040,7 @@ function createTracker(config, getContext) {
7032
7040
  const enabled = analyticsEnabled(config);
7033
7041
  if (enabled) initFluentAnalytics(config);
7034
7042
  const base = {
7035
- partner_id: config.partnerId,
7043
+ app_id: config.appId,
7036
7044
  network: config.network,
7037
7045
  auth_mode: config.authMode,
7038
7046
  source: config.source,
@@ -7355,7 +7363,7 @@ function createLocalFluentSession(params) {
7355
7363
  const issuedAt = Math.floor(Date.now() / 1e3);
7356
7364
  const payload = {
7357
7365
  iss: typeof location !== "undefined" ? location.origin : "fluent-local",
7358
- aud: params.partnerId,
7366
+ aud: params.appId,
7359
7367
  sub: params.userId,
7360
7368
  app: params.app,
7361
7369
  scopes: params.scopes,
@@ -7363,7 +7371,7 @@ function createLocalFluentSession(params) {
7363
7371
  };
7364
7372
  return {
7365
7373
  app: params.app,
7366
- partnerId: params.partnerId,
7374
+ appId: params.appId,
7367
7375
  idToken: `mock.${btoa(JSON.stringify(payload))}.signature`,
7368
7376
  user: {
7369
7377
  id: params.userId,
@@ -10147,7 +10155,7 @@ function useHostedConnect(params) {
10147
10155
  const {
10148
10156
  fluentConnect,
10149
10157
  authorizeUrl,
10150
- partnerId,
10158
+ appId,
10151
10159
  appName,
10152
10160
  authMode,
10153
10161
  setSession,
@@ -10169,10 +10177,10 @@ function useHostedConnect(params) {
10169
10177
  } catch {
10170
10178
  }
10171
10179
  const url = fluentConnect.buildAuthorizeUrl(state).toString();
10172
- debugLog("[fluent widget] open connect", { state, authorizeUrl: url, partnerId, appName, authMode });
10180
+ debugLog("[fluent widget] open connect", { state, authorizeUrl: url, appId, appName, authMode });
10173
10181
  setHostedAuthorizeUrl(url);
10174
10182
  setConnectOpen(true);
10175
- }, [appName, authMode, partnerId, fluentConnect, setConnectOpen]);
10183
+ }, [appName, authMode, appId, fluentConnect, setConnectOpen]);
10176
10184
  const acceptHostedResult = useCallback(
10177
10185
  (data) => {
10178
10186
  if (!data || typeof data !== "object") return;
@@ -10323,12 +10331,12 @@ function useAccountMenu(params) {
10323
10331
  return { openAccountMenu, handleAccountMenuAction };
10324
10332
  }
10325
10333
  function authTokenCacheKey(params) {
10326
- return `${params.publicApiUrl}|${params.partnerId}|${params.subject}`;
10334
+ return `${params.publicApiUrl}|${params.appId}|${params.subject}`;
10327
10335
  }
10328
10336
  function useAuthToken(params) {
10329
10337
  const {
10330
10338
  publicApiUrl,
10331
- partnerId,
10339
+ appId,
10332
10340
  authMode,
10333
10341
  renewalOffsetSeconds,
10334
10342
  accountType,
@@ -10351,7 +10359,7 @@ function useAuthToken(params) {
10351
10359
  if (!subject) {
10352
10360
  throw new FluentAuthError("not_connected", "Connect a Fluent ID or an external wallet first.");
10353
10361
  }
10354
- const key = authTokenCacheKey({ publicApiUrl, partnerId, subject });
10362
+ const key = authTokenCacheKey({ publicApiUrl, appId, subject });
10355
10363
  const cached = cache.current;
10356
10364
  if (cached?.key === key && cached.expiresAt - renewalOffsetSeconds * 1e3 > Date.now()) {
10357
10365
  return cached.token;
@@ -10367,14 +10375,14 @@ function useAuthToken(params) {
10367
10375
  "Privy session is not ready; sign in again."
10368
10376
  );
10369
10377
  }
10370
- token = await exchangePrivyAuthToken({ publicApiUrl, partnerId, accessToken, identityToken });
10378
+ token = await exchangePrivyAuthToken({ publicApiUrl, appId, accessToken, identityToken });
10371
10379
  } else {
10372
10380
  if (!walletClient) {
10373
10381
  throw new FluentAuthError("not_connected", "External wallet has no signer.");
10374
10382
  }
10375
10383
  token = await exchangeWalletAuthToken({
10376
10384
  publicApiUrl,
10377
- partnerId,
10385
+ appId,
10378
10386
  walletClient,
10379
10387
  address: walletAddress,
10380
10388
  origin: window.location.origin
@@ -10394,7 +10402,7 @@ function useAuthToken(params) {
10394
10402
  accountType,
10395
10403
  authMode,
10396
10404
  renewalOffsetSeconds,
10397
- partnerId,
10405
+ appId,
10398
10406
  getAccessToken,
10399
10407
  identityToken,
10400
10408
  privyUserId,
@@ -10793,7 +10801,7 @@ function FluentWidgetContent({
10793
10801
  const resolvedConfig = useMemo(() => resolveFluentWidgetConfig(config), [config]);
10794
10802
  const smartAccount = useFluentZeroDevAccount({
10795
10803
  login: requestPrivyLogin,
10796
- partnerId: resolvedConfig.partnerId,
10804
+ appId: resolvedConfig.appId,
10797
10805
  sponsorshipUrl: resolvedConfig.sponsorshipUrl
10798
10806
  });
10799
10807
  const { authenticated, getAccessToken, login, logout, ready: privyReady, user } = usePrivy();
@@ -10876,7 +10884,7 @@ function FluentWidgetContent({
10876
10884
  const { hostedAuthorizeUrl, beginHostedConnect } = useHostedConnect({
10877
10885
  fluentConnect,
10878
10886
  authorizeUrl: resolvedConfig.authorizeUrl,
10879
- partnerId: resolvedConfig.partnerId,
10887
+ appId: resolvedConfig.appId,
10880
10888
  appName: resolvedConfig.appName,
10881
10889
  authMode: resolvedConfig.authMode,
10882
10890
  setSession,
@@ -10996,7 +11004,7 @@ function FluentWidgetContent({
10996
11004
  const app = fluentConnect.status().app;
10997
11005
  const nextSession = createLocalFluentSession({
10998
11006
  app,
10999
- partnerId: resolvedConfig.partnerId,
11007
+ appId: resolvedConfig.appId,
11000
11008
  scopes: resolvedConfig.scopes,
11001
11009
  userId: user.id,
11002
11010
  email: typeof user.email?.address === "string" ? user.email.address : void 0,
@@ -11097,7 +11105,7 @@ function FluentWidgetContent({
11097
11105
  });
11098
11106
  const getAuthToken = useAuthToken({
11099
11107
  publicApiUrl: resolvedConfig.publicApiUrl,
11100
- partnerId: resolvedConfig.partnerId,
11108
+ appId: resolvedConfig.appId,
11101
11109
  authMode: resolvedConfig.authMode,
11102
11110
  renewalOffsetSeconds: resolvedConfig.authTokenRenewalOffsetSeconds,
11103
11111
  accountType: widgetAccount.type,
@@ -11431,6 +11439,6 @@ function FluentWidget(props) {
11431
11439
  ) });
11432
11440
  }
11433
11441
 
11434
- export { AccountAvatar, 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, FluentAccountDrawer, FluentAuthError, FluentPortalContainerProvider, FluentWidget, FluentWidgetConnectButton, FluentWidgetNetworkProvider, Icon, Label, Separator, WIDGET_STYLE_SCOPE, WalletMenuActionCard, buttonVariants, clearPrivyRecentLoginMethod, createFluentBatchOp, createFluentClient, createFluentFamiliesClient, createFluentPermissionApi, createFluentPermissionClient, createFluentPermissionPolicyBuilders, createFluentPermissionSession, createFluentSponsorshipRpcUrl, createFluentUserTokenStore, createFluentZeroDevErc20Paymaster, createFluentZeroDevErc20PaymasterApprovalCall, createFluentZeroDevErc20PaymasterClient, createFluentZeroDevErc20PaymasterRpcUrl, createFluentZeroDevPermissionSession, createFluentZeroDevRpcUrl, createFluentZeroDevSponsoredPaymaster, findFluentSymbolCollisions, fluent2 as fluent, apps as fluentApps, fluentBridgeAbi, fluent 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 };
11442
+ export { AccountAvatar, 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, FluentAccountDrawer, FluentAuthError, FluentPortalContainerProvider, FluentWidget, FluentWidgetConnectButton, FluentWidgetNetworkProvider, Icon, Label, Separator, Switch, WIDGET_STYLE_SCOPE, WalletMenuActionCard, buttonVariants, clearPrivyRecentLoginMethod, createFluentBatchOp, createFluentClient, createFluentFamiliesClient, createFluentPermissionApi, createFluentPermissionClient, createFluentPermissionPolicyBuilders, createFluentPermissionSession, createFluentSponsorshipRpcUrl, createFluentUserTokenStore, createFluentZeroDevErc20Paymaster, createFluentZeroDevErc20PaymasterApprovalCall, createFluentZeroDevErc20PaymasterClient, createFluentZeroDevErc20PaymasterRpcUrl, createFluentZeroDevPermissionSession, createFluentZeroDevRpcUrl, createFluentZeroDevSponsoredPaymaster, findFluentSymbolCollisions, fluent2 as fluent, apps as fluentApps, fluentBridgeAbi, fluent 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 };
11435
11443
  //# sourceMappingURL=index.js.map
11436
11444
  //# sourceMappingURL=index.js.map