@fluent.xyz/connect 0.5.1 → 0.5.3

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/INTEGRATION.md CHANGED
@@ -33,7 +33,10 @@ Before writing code you need:
33
33
  Required; the widget throws without it, and throws on any other shape.
34
34
  2. **A Privy app client (`privyClientId`)** — the `client-…` value Fluent
35
35
  issued alongside. Login configuration: your allowed origins live on it.
36
- Required; the widget throws without it.
36
+ Required; the widget throws without it. The client is issued from the Privy
37
+ app of your network: the dev Privy app for `testnet`, the production Privy
38
+ app for `mainnet`, which Fluent hands out together with your production
39
+ `appId`. A client of one Privy app does not sign in on the other.
37
40
  3. **A target network** — `testnet` (default) or `mainnet`.
38
41
  4. **Your app's origin registered on that Privy app client** — Fluent's sign-in
39
42
  dialog runs in your page, and Privy refuses an origin it does not know.
@@ -164,7 +167,7 @@ routing rather than mutating `config.network` under a live session.
164
167
  | Field | Required | Default | Notes |
165
168
  |---------------|----------|--------------------|-------|
166
169
  | `appId` | ✅ | — | The App's `app_<32 hex>` id — identity for sponsorship, auth and analytics; the token `aud`. Asserted at startup. |
167
- | `privyClientId` | ✅ | — | Privy app client issued by Fluent — login configuration; allowed origins live on it. |
170
+ | `privyClientId` | ✅ | — | Privy app client issued by Fluent — login configuration; allowed origins live on it. Issued from the Privy app of the App's network: the dev Privy app for `testnet`, the production Privy app for `mainnet`; a client of one does not sign in on the other. |
168
171
  | `clientId` | ⛔ | — | Removed in 0.2.0, and still typed (as `never`) only so the error can name the fix: pass the App's id as `appId` and the Privy app client as `privyClientId`. Passing it throws at resolve time. |
169
172
  | `partnerId` | ⛔ | — | Renamed to `appId` in 0.3.0, and still typed (as `never`) only so the error can name the fix. Passing it throws at resolve time. |
170
173
  | `network` | ➖ | env → `"testnet"` | `"testnet"` or `"mainnet"` — see [Networks and chain ids](#networks-and-chain-ids). |
@@ -1344,6 +1347,31 @@ one source of wallet/account state, and you read it through `useFluentWidget()`.
1344
1347
  > widget's), that's a separate architecture — shared providers / a single
1345
1348
  > `WagmiProvider`. Not supported in phase 1; talk to the Fluent team.
1346
1349
 
1350
+ ### Your own TanStack Query client
1351
+
1352
+ Mount a `QueryClientProvider` **around** `<FluentWidget>` and everything you
1353
+ render through `renderPage` / `renderHome` keeps resolving against *your* client:
1354
+
1355
+ ```tsx
1356
+ <QueryClientProvider client={queryClient}> {/* yours */}
1357
+ <FluentWidget
1358
+ config={{ /* … */ }}
1359
+ mode="page"
1360
+ renderPage={() => <YourApp />} {/* useQueryClient() === queryClient */}
1361
+ />
1362
+ </QueryClientProvider>
1363
+ ```
1364
+
1365
+ So a query you prefetched, or hydrated from your own server render, is served
1366
+ from your cache instead of running a second time. There is no prop for it: the
1367
+ widget reads the client from the context above it.
1368
+
1369
+ The two caches stay separate. The widget's own queries stay on the widget's
1370
+ client, so a `defaultOptions` you set, an `invalidateQueries` or a `clear()` of
1371
+ yours does not reach them — and the widget's bridge queries do not appear in
1372
+ your devtools. Mount no client of your own and nothing changes: your pages
1373
+ resolve against the widget's, as before.
1374
+
1347
1375
  ---
1348
1376
 
1349
1377
  ## 9b. Debugging an integration
package/README.md CHANGED
@@ -66,7 +66,8 @@ export function App() {
66
66
  `appId` and `privyClientId` are both required and come from Fluent. `appId` is the
67
67
  App's identity — sponsorship, auth and analytics speak it — and must be the `app_<32 hex>`
68
68
  value the Fluent Dashboard shows; the widget throws on any other shape. `privyClientId` is
69
- login configuration: the Privy app client carrying your allowed origins.
69
+ login configuration: the Privy app client carrying your allowed origins, issued from the
70
+ dev Privy app for `testnet` and from the production Privy app for `mainnet`.
70
71
 
71
72
  For Capacitor social login, pass
72
73
  `customOAuthRedirectUrl: "https://app.example.com/auth/ios/callback"` in `config`.