@foir/sdk 0.5.0 → 0.8.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/CHANGELOG.md +1126 -0
- package/README.md +94 -0
- package/dist/auth/auth.d.ts +243 -0
- package/dist/auth/hosted.d.ts +40 -0
- package/dist/auth/index.d.ts +21 -0
- package/dist/auth/operations.d.ts +144 -0
- package/dist/auth/ops.d.ts +99 -0
- package/dist/auth/session-client.d.ts +76 -0
- package/dist/auth-session.js +137 -0
- package/dist/auth.js +973 -92
- package/dist/chunk-IGNLWT3H.js +35 -0
- package/dist/chunk-OHYVKTGB.js +45 -0
- package/dist/chunk-TAL5H6VA.js +39 -0
- package/dist/client/platform-client.d.ts +29 -0
- package/dist/client.js +275 -37
- package/dist/codegen/block-registry.d.ts +13 -23
- package/dist/codegen/block-registry.js +3 -31
- package/dist/codegen/block-scaffold.d.ts +12 -25
- package/dist/codegen/block-scaffold.js +3 -41
- package/dist/codegen/index.d.ts +12 -61
- package/dist/codegen/index.js +7 -11
- package/dist/codegen/item-registry.d.ts +28 -0
- package/dist/codegen/item-registry.js +7 -0
- package/dist/codegen/item-scaffold.d.ts +29 -0
- package/dist/codegen/item-scaffold.js +7 -0
- package/dist/codegen/preset.d.ts +67 -0
- package/dist/codegen/shared.d.ts +36 -0
- package/dist/components/EditorProvider.d.ts +36 -0
- package/dist/content/content-renderer.d.ts +113 -0
- package/dist/content/index.d.ts +18 -0
- package/dist/content/richtext.d.ts +118 -0
- package/dist/content.js +227 -80
- package/dist/data/builtins.d.ts +506 -0
- package/dist/data/client.d.ts +166 -0
- package/dist/data/document.d.ts +251 -0
- package/dist/data/index.d.ts +73 -0
- package/dist/data/manifest.d.ts +424 -0
- package/dist/data/schema.d.ts +313 -0
- package/dist/data/selection.d.ts +524 -0
- package/dist/data/subjects.d.ts +221 -0
- package/dist/data/subscription-document.d.ts +75 -0
- package/dist/data/subscriptions.d.ts +181 -0
- package/dist/data/transport.d.ts +325 -0
- package/dist/data/ws-transport.d.ts +197 -0
- package/dist/data.js +1683 -0
- package/dist/graphql/cdn-route.d.ts +26 -0
- package/dist/graphql/client.d.ts +30 -0
- package/dist/graphql/content-client.d.ts +66 -0
- package/dist/graphql/foir-request.d.ts +47 -0
- package/dist/hooks/useAutoResize.d.ts +22 -0
- package/dist/hooks/useEditor.d.ts +16 -0
- package/dist/index.d.ts +10 -394
- package/dist/media/BlurhashCanvas.d.ts +10 -0
- package/dist/media/ProgressiveMedia.d.ts +56 -0
- package/dist/media/index.d.ts +18 -0
- package/dist/media/media.d.ts +139 -0
- package/dist/media/screen-capture.d.ts +81 -0
- package/dist/media/useProgressiveLoad.d.ts +23 -0
- package/dist/media.js +102 -0
- package/dist/next/cookieAdapter.d.ts +26 -0
- package/dist/next/index.d.ts +15 -0
- package/dist/next/middleware.d.ts +49 -0
- package/dist/next/session.d.ts +53 -0
- package/dist/next.js +763 -78
- package/dist/protocol/constants.d.ts +6 -0
- package/dist/protocol/messages.d.ts +155 -0
- package/dist/protocol/validation.d.ts +8 -0
- package/dist/push/index.d.ts +14 -0
- package/dist/push/operations.d.ts +22 -0
- package/dist/push/web-push.d.ts +39 -0
- package/dist/push.js +892 -78
- package/dist/react/FoirFeedback.d.ts +62 -0
- package/dist/react/FoirProvider.d.ts +116 -0
- package/dist/react/OAuthButtons.d.ts +20 -0
- package/dist/react/SignIn.d.ts +22 -0
- package/dist/react/UserButton.d.ts +13 -0
- package/dist/react/feedback-notes.d.ts +101 -0
- package/dist/react/index.d.ts +25 -0
- package/dist/react/localStorageAdapter.d.ts +10 -0
- package/dist/react.js +1373 -91
- package/dist/{realtime.d.ts → realtime/index.d.ts} +35 -16
- package/dist/realtime.js +1 -1
- package/dist/server/callback-client.d.ts +92 -0
- package/dist/server/events-client.d.ts +279 -0
- package/dist/server/index.d.ts +12 -0
- package/dist/server/operation-types.d.ts +134 -0
- package/dist/server/require-scoped-token.d.ts +76 -0
- package/dist/server/server-client.d.ts +34 -0
- package/dist/server/types.d.ts +54 -0
- package/dist/server/verify-scoped-token.d.ts +100 -0
- package/dist/server/webhook-helpers.d.ts +36 -0
- package/dist/server.js +298 -0
- package/dist/transport/foir-http.d.ts +234 -0
- package/dist/transport/persisted-query.d.ts +68 -0
- package/dist/transport/retry.d.ts +61 -0
- package/dist/types/index.d.ts +124 -0
- package/package.json +35 -13
- package/dist/auth.d.ts +0 -382
- package/dist/chunk-ADO5FJNM.js +0 -30
- package/dist/client.d.ts +0 -135
- package/dist/content.d.ts +0 -96
- package/dist/media.d.ts +0 -234
- package/dist/next.d.ts +0 -178
- package/dist/push.d.ts +0 -109
- package/dist/react.d.ts +0 -319
- package/dist/server.d.ts +0 -534
- package/dist/shared-DkWlEd2Z.d.ts +0 -18
package/dist/react.d.ts
DELETED
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Foir GraphQL client — a single typed fetch wrapper for SSR/edge loaders.
|
|
6
|
-
*
|
|
7
|
-
* No GraphQL client (Apollo/urql) required: the Foir public API is a plain
|
|
8
|
-
* `POST` with an `x-api-key` header, and the dominant consumers (Hydrogen on
|
|
9
|
-
* Oxygen, React Router loaders, TanStack Start on CF Workers) fetch in
|
|
10
|
-
* server-only loaders and render — so Apollo's `InMemoryCache`/`useQuery`
|
|
11
|
-
* reactivity is dead weight, and a shared cache on a stateless multi-tenant
|
|
12
|
-
* edge worker is a cross-tenant hazard. This helper carries only the
|
|
13
|
-
* Foir-specific transport concerns (auth header, preview schema channel,
|
|
14
|
-
* error shape). Consumers on a GraphQL client (Apollo / urql / react-query /
|
|
15
|
-
* graphql-request) use the generated `TypedDocumentNode`s directly with their
|
|
16
|
-
* own client and replicate the two Foir-specific headers below — the
|
|
17
|
-
* `x-api-key` and, in preview, `X-Foir-Schema-Channel: draft`.
|
|
18
|
-
*
|
|
19
|
-
* Deduplicates the hand-copied `lib/foir/client.ts` that shipped identically
|
|
20
|
-
* across the Foir storefronts.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
interface FoirEnv {
|
|
24
|
-
PLATFORM_API_URL?: string;
|
|
25
|
-
PLATFORM_API_KEY?: string;
|
|
26
|
-
PLATFORM_PREVIEW_API_KEY?: string;
|
|
27
|
-
FOIR_PREVIEW?: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Foir customer-auth GraphQL operations + result types.
|
|
32
|
-
*
|
|
33
|
-
* These are PLATFORM-STABLE primitives — `customerLogin`/`customerRegister`/
|
|
34
|
-
* `customerRefreshToken`/OTP/provider login are fixed-shape operations served
|
|
35
|
-
* by api-public for every project (gated per-project by the password/OTP/
|
|
36
|
-
* provider flags, but identical in shape when present). Unlike per-project
|
|
37
|
-
* model types, they don't vary by configured models, so the SDK owns the
|
|
38
|
-
* documents directly rather than relying on the consumer's codegen.
|
|
39
|
-
*
|
|
40
|
-
* The project-specific customer PROFILE (e.g. `myProfile.isAdmin`) is NOT here
|
|
41
|
-
* — that shape varies per project, so it stays consumer-injected (see
|
|
42
|
-
* `requireAuth`'s `resolveUser`).
|
|
43
|
-
*/
|
|
44
|
-
|
|
45
|
-
/** A configured auth provider, as exposed to unauthenticated callers. */
|
|
46
|
-
interface AuthProviderPublic {
|
|
47
|
-
key: string;
|
|
48
|
-
name: string;
|
|
49
|
-
/** OAUTH2 | TOKEN_SSO | SAML | OIDC | EXTERNAL */
|
|
50
|
-
type: string;
|
|
51
|
-
isDefault: boolean | null;
|
|
52
|
-
}
|
|
53
|
-
interface ProviderLoginInput {
|
|
54
|
-
providerKey: string;
|
|
55
|
-
email?: string;
|
|
56
|
-
returnTo?: string;
|
|
57
|
-
/** Override the provider's default redirect_uri (must be allow-listed). */
|
|
58
|
-
redirectUri?: string;
|
|
59
|
-
}
|
|
60
|
-
interface ProviderCallbackInput {
|
|
61
|
-
providerKey: string;
|
|
62
|
-
code?: string;
|
|
63
|
-
state?: string;
|
|
64
|
-
email?: string;
|
|
65
|
-
idToken?: string;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Foir customer auth — framework-agnostic flows, token lifecycle, and guards.
|
|
70
|
-
*
|
|
71
|
-
* Session I/O is injected via {@link SessionAdapter} (no Hydrogen/React-Router
|
|
72
|
-
* coupling). Pre-login flows authenticate with the project `x-api-key`;
|
|
73
|
-
* post-login reads add the customer bearer. The project-specific profile (e.g.
|
|
74
|
-
* `isAdmin`) is resolved by a consumer-supplied `resolveUser` — the SDK never
|
|
75
|
-
* hardcodes the per-project customer profile shape.
|
|
76
|
-
*/
|
|
77
|
-
|
|
78
|
-
/** The customer identity carried by an auth result. */
|
|
79
|
-
interface FoirCustomer {
|
|
80
|
-
id: string;
|
|
81
|
-
email: string;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Injected session store. Methods may be sync or async so consumers can plug
|
|
85
|
-
* in a cookie session (Hydrogen/Remix), a KV store, etc.
|
|
86
|
-
*/
|
|
87
|
-
interface SessionAdapter {
|
|
88
|
-
get(key: string): string | null | undefined | Promise<string | null | undefined>;
|
|
89
|
-
set(key: string, value: string): void | Promise<void>;
|
|
90
|
-
unset(key: string): void | Promise<void>;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Foir-hosted first-party sessions, from the browser — the model for a
|
|
95
|
-
* backend-less SPA (Vite, CRA, a static site) that wants no tokens in JS.
|
|
96
|
-
*
|
|
97
|
-
* The sibling `fetchHostedSession` in ./hosted does the same exchange from a
|
|
98
|
-
* SERVER: it reads the cookie off an incoming request and forwards it by hand.
|
|
99
|
-
* A browser cannot set a `Cookie` header, so that function is unusable from an
|
|
100
|
-
* SPA by construction. This one lets the browser send the cookie the only way it
|
|
101
|
-
* can — `credentials: 'include'` — and keeps the resulting bearer in memory.
|
|
102
|
-
*
|
|
103
|
-
* How the pieces divide:
|
|
104
|
-
*
|
|
105
|
-
* cookie — long-lived (30d), HttpOnly, first-party on your registrable
|
|
106
|
-
* domain, set by Foir when hosted login finalizes. JS cannot read
|
|
107
|
-
* it, so XSS cannot exfiltrate it.
|
|
108
|
-
* bearer — 15 minutes, held in a closure here. Never written to
|
|
109
|
-
* localStorage/sessionStorage/IndexedDB, never in a cookie of ours.
|
|
110
|
-
*
|
|
111
|
-
* There is no refresh token in this flow. Re-exchanging the cookie IS the
|
|
112
|
-
* refresh, which is why nothing here needs rotation or reuse-detection: the
|
|
113
|
-
* durable credential is an opaque server-side session handle, revocable at any
|
|
114
|
-
* time from the admin panel or `signOut()`.
|
|
115
|
-
*
|
|
116
|
-
* REQUIRES a verified custom login domain that shares a registrable domain with
|
|
117
|
-
* your app (app.acme.com + login.acme.com). That is what makes the cookie
|
|
118
|
-
* first-party and lets `SameSite=Lax` send it. The same endpoints exist on
|
|
119
|
-
* api.foir.dev but a browser cannot reach them there — the cookie would be
|
|
120
|
-
* cross-site, and that CORS surface deliberately refuses credentials.
|
|
121
|
-
*/
|
|
122
|
-
interface FoirSessionConfig {
|
|
123
|
-
/**
|
|
124
|
-
* Your verified custom login domain, e.g. `https://login.acme.com`. Must share
|
|
125
|
-
* a registrable domain with the app calling it.
|
|
126
|
-
*/
|
|
127
|
-
loginOrigin: string;
|
|
128
|
-
/** Session-exchange path. Default `/session/token`. */
|
|
129
|
-
sessionPath?: string;
|
|
130
|
-
/** Logout path. Default `/session/logout`. */
|
|
131
|
-
logoutPath?: string;
|
|
132
|
-
/** Seconds before expiry to re-exchange. Default 60. */
|
|
133
|
-
refreshSkewSeconds?: number;
|
|
134
|
-
/**
|
|
135
|
-
* Called when the session goes away — the cookie expired, was revoked, or
|
|
136
|
-
* `signOut()` ran. Use it to redirect to `signInUrl()`.
|
|
137
|
-
*/
|
|
138
|
-
onSignOut?: () => void;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/** Where the session hydration stands. */
|
|
142
|
-
type FoirStatus = 'loading' | 'authenticated' | 'unauthenticated';
|
|
143
|
-
/** The full context value. Read it through the hooks below, not directly. */
|
|
144
|
-
interface FoirContextValue {
|
|
145
|
-
status: FoirStatus;
|
|
146
|
-
customer: FoirCustomer | null;
|
|
147
|
-
/** The API config; exposed so advanced consumers can call `@foir/sdk/auth` directly. */
|
|
148
|
-
env: FoirEnv;
|
|
149
|
-
/** The session store backing this provider. */
|
|
150
|
-
adapter: SessionAdapter;
|
|
151
|
-
signIn(vars: {
|
|
152
|
-
email: string;
|
|
153
|
-
password: string;
|
|
154
|
-
}): Promise<FoirCustomer>;
|
|
155
|
-
register(vars: {
|
|
156
|
-
email: string;
|
|
157
|
-
password: string;
|
|
158
|
-
}): Promise<FoirCustomer>;
|
|
159
|
-
requestOtp(email: string): Promise<boolean>;
|
|
160
|
-
signInWithOtp(vars: {
|
|
161
|
-
email: string;
|
|
162
|
-
otp: string;
|
|
163
|
-
}): Promise<FoirCustomer>;
|
|
164
|
-
/** Start a provider (OAuth/OIDC) login. Redirect providers navigate away. */
|
|
165
|
-
signInWithProvider(providerKey: string, opts?: Omit<ProviderLoginInput, 'providerKey'>): Promise<void>;
|
|
166
|
-
/** Complete a provider login from your callback route (code + state). */
|
|
167
|
-
completeProviderLogin(input: Omit<ProviderCallbackInput, 'providerKey'> & {
|
|
168
|
-
providerKey: string;
|
|
169
|
-
}): Promise<FoirCustomer>;
|
|
170
|
-
signOut(): Promise<void>;
|
|
171
|
-
/** Rotate the access token; returns false (and signs out) if it can't. */
|
|
172
|
-
refresh(): Promise<boolean>;
|
|
173
|
-
/** The current access token, or null when signed out. */
|
|
174
|
-
getToken(): Promise<string | null>;
|
|
175
|
-
/** The project's configured auth providers (for OAuth buttons). */
|
|
176
|
-
getProviders(): Promise<AuthProviderPublic[]>;
|
|
177
|
-
/**
|
|
178
|
-
* In `hostedSession` mode, where to send the browser to sign in — sign-in is a
|
|
179
|
-
* redirect to your Foir login domain, not an in-page form. Null in token mode,
|
|
180
|
-
* where you call {@link FoirContextValue.signIn} instead.
|
|
181
|
-
*/
|
|
182
|
-
hostedSignInUrl: ((returnTo?: string) => string) | null;
|
|
183
|
-
}
|
|
184
|
-
interface FoirProviderProps {
|
|
185
|
-
/** API config: `{ PLATFORM_API_URL, PLATFORM_API_KEY }` (a publishable `pk_` key). */
|
|
186
|
-
env: FoirEnv;
|
|
187
|
-
/** Session store for token mode. Defaults to a browser localStorage adapter. */
|
|
188
|
-
adapter?: SessionAdapter;
|
|
189
|
-
/**
|
|
190
|
-
* Opt into Foir-hosted first-party sessions: the durable credential is an
|
|
191
|
-
* HttpOnly cookie on your own domain and the access token lives only in
|
|
192
|
-
* memory, so nothing authentication-related is reachable from JS. This is the
|
|
193
|
-
* secure default for a backend-less SPA, and it REPLACES `adapter` — pass one
|
|
194
|
-
* or the other, not both.
|
|
195
|
-
*
|
|
196
|
-
* Requires a verified custom login domain sharing a registrable domain with
|
|
197
|
-
* your app (`app.acme.com` + `login.acme.com`). Sign-in becomes a redirect to
|
|
198
|
-
* {@link FoirContextValue.hostedSignInUrl}; the password/OTP/provider actions
|
|
199
|
-
* do not apply and will throw.
|
|
200
|
-
*/
|
|
201
|
-
hostedSession?: Omit<FoirSessionConfig, 'onSignOut'>;
|
|
202
|
-
children: ReactNode;
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Provides Foir customer auth to a React tree. Hydrates the session on mount,
|
|
206
|
-
* then exposes the current customer and sign-in/out actions through
|
|
207
|
-
* {@link useFoirSession}, {@link useFoirUser}, and {@link useFoirAuth}.
|
|
208
|
-
*
|
|
209
|
-
* Two session models:
|
|
210
|
-
*
|
|
211
|
-
* default tokens in a `SessionAdapter` (localStorage unless you pass
|
|
212
|
-
* your own). Simple, but a refresh token sits in JS.
|
|
213
|
-
* `hostedSession` Foir-hosted first-party cookie; the bearer never leaves
|
|
214
|
-
* memory. Needs a custom login domain. Prefer this.
|
|
215
|
-
*/
|
|
216
|
-
declare function FoirProvider({ env, adapter, hostedSession, children, }: FoirProviderProps): react_jsx_runtime.JSX.Element;
|
|
217
|
-
/** The current session state. */
|
|
218
|
-
interface FoirSession {
|
|
219
|
-
status: FoirStatus;
|
|
220
|
-
customer: FoirCustomer | null;
|
|
221
|
-
isLoading: boolean;
|
|
222
|
-
isAuthenticated: boolean;
|
|
223
|
-
}
|
|
224
|
-
/** Read the current session status and customer. */
|
|
225
|
-
declare function useFoirSession(): FoirSession;
|
|
226
|
-
/** The signed-in customer (`{ id, email }`), or null. */
|
|
227
|
-
declare function useFoirUser(): FoirCustomer | null;
|
|
228
|
-
/** The sign-in / sign-out actions. */
|
|
229
|
-
declare function useFoirAuth(): {
|
|
230
|
-
signIn: (vars: {
|
|
231
|
-
email: string;
|
|
232
|
-
password: string;
|
|
233
|
-
}) => Promise<FoirCustomer>;
|
|
234
|
-
register: (vars: {
|
|
235
|
-
email: string;
|
|
236
|
-
password: string;
|
|
237
|
-
}) => Promise<FoirCustomer>;
|
|
238
|
-
requestOtp: (email: string) => Promise<boolean>;
|
|
239
|
-
signInWithOtp: (vars: {
|
|
240
|
-
email: string;
|
|
241
|
-
otp: string;
|
|
242
|
-
}) => Promise<FoirCustomer>;
|
|
243
|
-
signInWithProvider: (providerKey: string, opts?: Omit<ProviderLoginInput, "providerKey">) => Promise<void>;
|
|
244
|
-
completeProviderLogin: (input: Omit<ProviderCallbackInput, "providerKey"> & {
|
|
245
|
-
providerKey: string;
|
|
246
|
-
}) => Promise<FoirCustomer>;
|
|
247
|
-
signOut: () => Promise<void>;
|
|
248
|
-
refresh: () => Promise<boolean>;
|
|
249
|
-
getToken: () => Promise<string | null>;
|
|
250
|
-
getProviders: () => Promise<AuthProviderPublic[]>;
|
|
251
|
-
hostedSignInUrl: ((returnTo?: string) => string) | null;
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
interface SignInProps {
|
|
255
|
-
/** `password` (default) or `otp` (email one-time code). Ignored when `hostedUrl` is set. */
|
|
256
|
-
method?: 'password' | 'otp';
|
|
257
|
-
/** Render a single button that redirects to a hosted login page instead of an embedded form. */
|
|
258
|
-
hostedUrl?: string;
|
|
259
|
-
/** Show OAuth provider buttons below the form. Default true. */
|
|
260
|
-
oauth?: boolean;
|
|
261
|
-
/** Navigate here after a successful sign-in. */
|
|
262
|
-
afterSignInUrl?: string;
|
|
263
|
-
/** Called with the customer on a successful sign-in (before any redirect). */
|
|
264
|
-
onSignIn?(customer: FoirCustomer): void;
|
|
265
|
-
className?: string;
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* A drop-in customer sign-in. Renders an email/password (or OTP) form and,
|
|
269
|
-
* unless disabled, OAuth provider buttons. Set `hostedUrl` to instead render a
|
|
270
|
-
* button that redirects to a hosted login page. All state is handled through
|
|
271
|
-
* {@link FoirProvider}; on success it calls `onSignIn` and optionally navigates
|
|
272
|
-
* to `afterSignInUrl`.
|
|
273
|
-
*/
|
|
274
|
-
declare function SignIn({ method, hostedUrl, oauth, afterSignInUrl, onSignIn, className, }: SignInProps): react_jsx_runtime.JSX.Element;
|
|
275
|
-
|
|
276
|
-
interface OAuthButtonsProps {
|
|
277
|
-
/** Passed to the provider login (where the callback returns the user). */
|
|
278
|
-
returnTo?: string;
|
|
279
|
-
/** Override the provider's default redirect URI (must be allow-listed). */
|
|
280
|
-
redirectUri?: string;
|
|
281
|
-
/** Filter which providers render (defaults to every redirect-capable one). */
|
|
282
|
-
filter?(provider: AuthProviderPublic): boolean;
|
|
283
|
-
/** Render your own button. Receives the provider and a click handler. */
|
|
284
|
-
children?(provider: AuthProviderPublic, signIn: () => void): ReactNode;
|
|
285
|
-
className?: string;
|
|
286
|
-
onError?(error: unknown): void;
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Renders a sign-in button per configured OAuth/OIDC/SAML provider. Clicking a
|
|
290
|
-
* button starts the provider login and (for redirect flows) navigates away.
|
|
291
|
-
* Pass a `children` render prop to fully control the button markup.
|
|
292
|
-
*/
|
|
293
|
-
declare function OAuthButtons({ returnTo, redirectUri, filter, children, className, onError, }: OAuthButtonsProps): react_jsx_runtime.JSX.Element | null;
|
|
294
|
-
|
|
295
|
-
interface UserButtonProps {
|
|
296
|
-
/** Called after a successful sign-out. */
|
|
297
|
-
afterSignOut?(): void;
|
|
298
|
-
/** Navigate here after sign-out. */
|
|
299
|
-
afterSignOutUrl?: string;
|
|
300
|
-
className?: string;
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* A minimal signed-in affordance: the customer's email plus a sign-out button.
|
|
304
|
-
* Renders nothing when signed out. Style it via `className` (the default is an
|
|
305
|
-
* unopinionated inline layout).
|
|
306
|
-
*/
|
|
307
|
-
declare function UserButton({ afterSignOut, afterSignOutUrl, className }: UserButtonProps): react_jsx_runtime.JSX.Element | null;
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* A {@link SessionAdapter} backed by the browser's `localStorage`.
|
|
311
|
-
*
|
|
312
|
-
* SSR-safe: with no `window` (server render) reads return `null` and writes are
|
|
313
|
-
* no-ops, so {@link FoirProvider} starts in `loading` and hydrates the real
|
|
314
|
-
* session on the client after mount. This is the default adapter when you don't
|
|
315
|
-
* pass one to `FoirProvider`.
|
|
316
|
-
*/
|
|
317
|
-
declare function createLocalStorageAdapter(): SessionAdapter;
|
|
318
|
-
|
|
319
|
-
export { type AuthProviderPublic, type FoirContextValue, type FoirCustomer, type FoirEnv, FoirProvider, type FoirProviderProps, type FoirSession, type FoirStatus, OAuthButtons, type OAuthButtonsProps, type SessionAdapter, SignIn, type SignInProps, UserButton, type UserButtonProps, createLocalStorageAdapter, useFoirAuth, useFoirSession, useFoirUser };
|