@buildspacestudio/sdk 0.2.2 → 0.4.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 +126 -0
- package/dist/auth/index.cjs +259 -0
- package/dist/auth/index.cjs.map +1 -0
- package/dist/auth/index.d.cts +3 -0
- package/dist/auth/index.d.ts +3 -5
- package/dist/auth/index.js +255 -2
- package/dist/auth/index.js.map +1 -1
- package/dist/billing/index.cjs +226 -0
- package/dist/billing/index.cjs.map +1 -0
- package/dist/billing/index.d.cts +60 -0
- package/dist/billing/index.d.ts +60 -0
- package/dist/billing/index.js +222 -0
- package/dist/billing/index.js.map +1 -0
- package/dist/client/index.cjs +558 -0
- package/dist/client/index.cjs.map +1 -0
- package/dist/client/index.d.cts +89 -0
- package/dist/client/index.d.ts +12 -7
- package/dist/client/index.js +546 -105
- package/dist/client/index.js.map +1 -1
- package/dist/client-BYUWUiGZ.d.cts +143 -0
- package/dist/{auth/client.d.ts → client-ByNR5EZz.d.ts} +7 -5
- package/dist/client-D0vypxWb.d.cts +58 -0
- package/dist/{auth/client.js → client-D7bqvGJv.d.cts} +27 -30
- package/dist/{events/client.d.ts → client-DbGRRMt7.d.ts} +5 -3
- package/dist/client-d7kX5WfR.d.ts +143 -0
- package/dist/events/index.cjs +131 -0
- package/dist/events/index.cjs.map +1 -0
- package/dist/events/{server.d.ts → index.d.cts} +7 -4
- package/dist/events/index.d.ts +59 -4
- package/dist/events/index.js +127 -2
- package/dist/events/index.js.map +1 -1
- package/dist/http-D2gXpNpr.d.cts +100 -0
- package/dist/http-D2gXpNpr.d.ts +100 -0
- package/dist/index.cjs +1029 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +92 -0
- package/dist/index.d.ts +21 -15
- package/dist/index.js +1010 -106
- package/dist/index.js.map +1 -1
- package/dist/next/index.cjs +183 -0
- package/dist/next/index.cjs.map +1 -0
- package/dist/next/index.d.cts +164 -0
- package/dist/next/index.d.ts +164 -0
- package/dist/next/index.js +172 -0
- package/dist/next/index.js.map +1 -0
- package/dist/notifications/index.cjs +56 -0
- package/dist/notifications/index.cjs.map +1 -0
- package/dist/notifications/{server.d.ts → index.d.cts} +8 -6
- package/dist/notifications/index.d.ts +79 -3
- package/dist/notifications/index.js +53 -1
- package/dist/notifications/index.js.map +1 -1
- package/dist/react/index.cjs +120 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.cts +567 -0
- package/dist/react/index.d.ts +567 -0
- package/dist/react/index.js +92 -0
- package/dist/react/index.js.map +1 -0
- package/dist/server-CoPDzSUP.d.cts +117 -0
- package/dist/{auth/server.d.ts → server-Suq3tZZC.d.ts} +8 -6
- package/dist/storage/index.cjs +213 -0
- package/dist/storage/index.cjs.map +1 -0
- package/dist/storage/index.d.cts +195 -0
- package/dist/storage/index.d.ts +195 -5
- package/dist/storage/index.js +209 -2
- package/dist/storage/index.js.map +1 -1
- package/package.json +124 -16
- package/dist/auth/client.d.ts.map +0 -1
- package/dist/auth/client.js.map +0 -1
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/server.d.ts.map +0 -1
- package/dist/auth/server.js +0 -148
- package/dist/auth/server.js.map +0 -1
- package/dist/client/index.d.ts.map +0 -1
- package/dist/config.d.ts +0 -40
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -27
- package/dist/config.js.map +0 -1
- package/dist/errors.d.ts +0 -31
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -30
- package/dist/errors.js.map +0 -1
- package/dist/events/client.d.ts.map +0 -1
- package/dist/events/client.js +0 -97
- package/dist/events/client.js.map +0 -1
- package/dist/events/index.d.ts.map +0 -1
- package/dist/events/server.d.ts.map +0 -1
- package/dist/events/server.js +0 -65
- package/dist/events/server.js.map +0 -1
- package/dist/http.d.ts +0 -39
- package/dist/http.d.ts.map +0 -1
- package/dist/http.js +0 -74
- package/dist/http.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/notifications/index.d.ts.map +0 -1
- package/dist/notifications/server.d.ts.map +0 -1
- package/dist/notifications/server.js +0 -73
- package/dist/notifications/server.js.map +0 -1
- package/dist/storage/client.d.ts +0 -91
- package/dist/storage/client.d.ts.map +0 -1
- package/dist/storage/client.js +0 -117
- package/dist/storage/client.js.map +0 -1
- package/dist/storage/index.d.ts.map +0 -1
- package/dist/storage/server.d.ts +0 -104
- package/dist/storage/server.d.ts.map +0 -1
- package/dist/storage/server.js +0 -104
- package/dist/storage/server.js.map +0 -1
|
@@ -0,0 +1,567 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type ClientMode = "server" | "client";
|
|
5
|
+
/** Configuration options for the server SDK (`new Buildspace()`). */
|
|
6
|
+
interface BuildspaceConfig {
|
|
7
|
+
/** Base URL of the Buildspace API. Defaults to `"https://api.buildspace.studio"`. */
|
|
8
|
+
baseUrl?: string;
|
|
9
|
+
/** Custom `fetch` implementation (useful for testing or edge runtimes). */
|
|
10
|
+
fetch?: typeof fetch;
|
|
11
|
+
/** Base URL of the Buildspace login service. Defaults to `"https://login.buildspace.studio"`. */
|
|
12
|
+
loginUrl?: string;
|
|
13
|
+
/** API version string sent via the `X-Buildspace-Version` header. Defaults to `"2025-06-01"`. */
|
|
14
|
+
version?: string;
|
|
15
|
+
}
|
|
16
|
+
/** Configuration for client-side event batching behavior. */
|
|
17
|
+
interface EventsBatchingConfig {
|
|
18
|
+
/** How often queued events are flushed to the API, in milliseconds. Defaults to `5000`. */
|
|
19
|
+
flushInterval?: number;
|
|
20
|
+
/** Maximum number of events to queue before an automatic flush. Defaults to `20`. */
|
|
21
|
+
maxBatchSize?: number;
|
|
22
|
+
}
|
|
23
|
+
/** Configuration options for the client SDK (`createClient()`). */
|
|
24
|
+
interface BuildspaceClientConfig extends BuildspaceConfig {
|
|
25
|
+
/** Options for client-side event batching. */
|
|
26
|
+
events?: EventsBatchingConfig;
|
|
27
|
+
}
|
|
28
|
+
interface ResolvedConfig {
|
|
29
|
+
baseUrl: string;
|
|
30
|
+
fetch: typeof fetch;
|
|
31
|
+
loginUrl: string;
|
|
32
|
+
mode: ClientMode;
|
|
33
|
+
version: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Services available in the Buildspace platform. */
|
|
37
|
+
type BuildspaceService = "auth" | "billing" | "events" | "notifications" | "storage";
|
|
38
|
+
|
|
39
|
+
interface RequestOptions {
|
|
40
|
+
body?: unknown;
|
|
41
|
+
headers?: Record<string, string>;
|
|
42
|
+
keepalive?: boolean;
|
|
43
|
+
method?: string;
|
|
44
|
+
path: string;
|
|
45
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
46
|
+
service: BuildspaceService;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Low-level HTTP transport used internally by all SDK namespaces.
|
|
50
|
+
*
|
|
51
|
+
* Handles authentication headers, API versioning, session tokens,
|
|
52
|
+
* and consistent error mapping to {@link BuildspaceError}.
|
|
53
|
+
*/
|
|
54
|
+
declare class HttpTransport {
|
|
55
|
+
readonly baseUrl: string;
|
|
56
|
+
readonly fetcher: typeof fetch;
|
|
57
|
+
readonly key: string;
|
|
58
|
+
readonly loginUrl: string;
|
|
59
|
+
readonly mode: ClientMode;
|
|
60
|
+
readonly version: string;
|
|
61
|
+
private sessionToken;
|
|
62
|
+
constructor({ key, resolvedConfig }: {
|
|
63
|
+
key: string;
|
|
64
|
+
resolvedConfig: ResolvedConfig;
|
|
65
|
+
});
|
|
66
|
+
/** Remove the stored session token. */
|
|
67
|
+
clearSession(): void;
|
|
68
|
+
/** Return the current session token, or `null` if none is set. */
|
|
69
|
+
getSessionToken(): string | null;
|
|
70
|
+
/** Store a session token that will be sent as `X-Session-Token` on subsequent requests. */
|
|
71
|
+
setSession(sessionToken: string): void;
|
|
72
|
+
request<T>({ service, path, method, query, body, headers, keepalive, }: RequestOptions): Promise<T>;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Options for generating a sign-in URL. */
|
|
76
|
+
interface SignInUrlOptions {
|
|
77
|
+
/** App slug to scope the login to a specific creator app. */
|
|
78
|
+
appSlug?: string;
|
|
79
|
+
/** Environment to authenticate against. */
|
|
80
|
+
env?: "dev" | "prod";
|
|
81
|
+
/** URL to redirect the user to after authentication completes. */
|
|
82
|
+
redirectUri: string;
|
|
83
|
+
}
|
|
84
|
+
/** Options for generating a sign-up URL. */
|
|
85
|
+
interface SignUpUrlOptions {
|
|
86
|
+
/** App slug to scope the registration to a specific creator app. */
|
|
87
|
+
appSlug?: string;
|
|
88
|
+
/** Environment to authenticate against. */
|
|
89
|
+
env?: "dev" | "prod";
|
|
90
|
+
/** URL to redirect the user to after registration completes. */
|
|
91
|
+
redirectUri: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Client-side authentication methods for generating login URLs.
|
|
95
|
+
*
|
|
96
|
+
* Access via `buildspace.auth` on the client SDK, or `buildspace.authClient`
|
|
97
|
+
* on the server SDK when you need to generate URLs from server-side code.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* import { createClient } from "@buildspacestudio/sdk/client";
|
|
102
|
+
*
|
|
103
|
+
* const buildspace = createClient(process.env.NEXT_PUBLIC_BUILDSPACE_KEY!);
|
|
104
|
+
*
|
|
105
|
+
* const signInUrl = buildspace.auth.getSignInUrl({
|
|
106
|
+
* redirectUri: "https://yourapp.com/auth/callback",
|
|
107
|
+
* });
|
|
108
|
+
*
|
|
109
|
+
* // Use in a link or redirect
|
|
110
|
+
* window.location.href = signInUrl;
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
declare class AuthClientNamespace {
|
|
114
|
+
private readonly transport;
|
|
115
|
+
constructor(transport: HttpTransport);
|
|
116
|
+
/**
|
|
117
|
+
* Build a URL that redirects the user to the Buildspace sign-in page.
|
|
118
|
+
*
|
|
119
|
+
* After the user authenticates, they are redirected back to `redirectUri`
|
|
120
|
+
* with a `?code=` parameter that can be exchanged for tokens via
|
|
121
|
+
* `buildspace.auth.handleCallback()` on the server.
|
|
122
|
+
*
|
|
123
|
+
* @param opts - Sign-in URL options.
|
|
124
|
+
* @returns The full sign-in URL as a string.
|
|
125
|
+
*/
|
|
126
|
+
getSignInUrl(opts: SignInUrlOptions): string;
|
|
127
|
+
/**
|
|
128
|
+
* Build a URL that redirects the user to the Buildspace sign-up page.
|
|
129
|
+
*
|
|
130
|
+
* Works identically to {@link getSignInUrl} but directs the user to the
|
|
131
|
+
* registration flow instead.
|
|
132
|
+
*
|
|
133
|
+
* @param opts - Sign-up URL options.
|
|
134
|
+
* @returns The full sign-up URL as a string.
|
|
135
|
+
*/
|
|
136
|
+
getSignUpUrl(opts: SignUpUrlOptions): string;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** A Buildspace user returned from auth endpoints. */
|
|
140
|
+
interface AuthUser {
|
|
141
|
+
/** The user's email address. */
|
|
142
|
+
email: string;
|
|
143
|
+
/** Unique user identifier. */
|
|
144
|
+
id: string;
|
|
145
|
+
/** The user's display name, or `null` if not set. */
|
|
146
|
+
name: string | null;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
interface BillingProduct {
|
|
150
|
+
active: boolean;
|
|
151
|
+
createdAt: string;
|
|
152
|
+
description: string | null;
|
|
153
|
+
id: string;
|
|
154
|
+
name: string;
|
|
155
|
+
}
|
|
156
|
+
interface BillingPrice {
|
|
157
|
+
active: boolean;
|
|
158
|
+
amountCents: number | null;
|
|
159
|
+
createdAt: string;
|
|
160
|
+
currency: string;
|
|
161
|
+
id: string;
|
|
162
|
+
interval: string | null;
|
|
163
|
+
lookupKey: string | null;
|
|
164
|
+
productId: string;
|
|
165
|
+
productName: string;
|
|
166
|
+
type: "one_time" | "recurring" | "metered";
|
|
167
|
+
}
|
|
168
|
+
interface CreateClientCheckoutOptions {
|
|
169
|
+
cancelUrl: string;
|
|
170
|
+
checkoutRequestId?: string;
|
|
171
|
+
lookupKey?: string;
|
|
172
|
+
metadata?: Record<string, string>;
|
|
173
|
+
priceId?: string;
|
|
174
|
+
quantity?: number;
|
|
175
|
+
successUrl: string;
|
|
176
|
+
}
|
|
177
|
+
interface BillingSubscriptionResponse {
|
|
178
|
+
subscription: {
|
|
179
|
+
cancelAtPeriodEnd: boolean;
|
|
180
|
+
currentPeriodEnd: string | null;
|
|
181
|
+
id: string;
|
|
182
|
+
status: string;
|
|
183
|
+
} | null;
|
|
184
|
+
}
|
|
185
|
+
interface BillingEntitlementsResponse {
|
|
186
|
+
active: boolean;
|
|
187
|
+
subscription: {
|
|
188
|
+
currentPeriodEnd: string | null;
|
|
189
|
+
id: string;
|
|
190
|
+
status: string;
|
|
191
|
+
} | null;
|
|
192
|
+
}
|
|
193
|
+
type BillingMode = "test" | "live";
|
|
194
|
+
type BillingConfigStatus = "disabled" | "setup_required" | "active" | "paused";
|
|
195
|
+
interface BillingStatusResponse {
|
|
196
|
+
enabled: boolean;
|
|
197
|
+
mode: BillingMode | null;
|
|
198
|
+
status: BillingConfigStatus | null;
|
|
199
|
+
testMode: boolean;
|
|
200
|
+
}
|
|
201
|
+
interface CreateClientPortalSessionOptions {
|
|
202
|
+
returnUrl: string;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
declare class BillingClientNamespace {
|
|
206
|
+
private readonly transport;
|
|
207
|
+
constructor(transport: HttpTransport);
|
|
208
|
+
/**
|
|
209
|
+
* Read whether billing is enabled for the app environment tied to this
|
|
210
|
+
* publishable key, and whether the connected Stripe account is in test or
|
|
211
|
+
* live mode.
|
|
212
|
+
*
|
|
213
|
+
* Render a "Test mode" banner in your app whenever `testMode` is true.
|
|
214
|
+
*/
|
|
215
|
+
getStatus(): Promise<BillingStatusResponse>;
|
|
216
|
+
/**
|
|
217
|
+
* List the active billing products for the app environment tied to this
|
|
218
|
+
* publishable key.
|
|
219
|
+
*/
|
|
220
|
+
listProducts(): Promise<{
|
|
221
|
+
products: BillingProduct[];
|
|
222
|
+
}>;
|
|
223
|
+
/**
|
|
224
|
+
* List the active billing prices for the app environment tied to this
|
|
225
|
+
* publishable key.
|
|
226
|
+
*/
|
|
227
|
+
listPrices(): Promise<{
|
|
228
|
+
prices: BillingPrice[];
|
|
229
|
+
}>;
|
|
230
|
+
/**
|
|
231
|
+
* Create a Checkout Session for the signed-in browser user and redirect to
|
|
232
|
+
* the Stripe-hosted Checkout page.
|
|
233
|
+
*
|
|
234
|
+
* This method depends on a Buildspace session being available through
|
|
235
|
+
* `setSession()` or your app's authenticated request context.
|
|
236
|
+
*/
|
|
237
|
+
redirectToCheckout(opts: CreateClientCheckoutOptions): Promise<void>;
|
|
238
|
+
/**
|
|
239
|
+
* Open the Stripe-hosted customer portal for the signed-in browser user.
|
|
240
|
+
*/
|
|
241
|
+
redirectToPortal(opts: CreateClientPortalSessionOptions): Promise<void>;
|
|
242
|
+
/**
|
|
243
|
+
* Discoverable alias for redirectToPortal — opens the Stripe-hosted customer
|
|
244
|
+
* portal so the signed-in user can manage their subscription, payment method,
|
|
245
|
+
* and invoices.
|
|
246
|
+
*/
|
|
247
|
+
manageSubscription(opts: CreateClientPortalSessionOptions): Promise<void>;
|
|
248
|
+
/**
|
|
249
|
+
* Read the current subscription state for the signed-in browser user.
|
|
250
|
+
*/
|
|
251
|
+
getSubscription(): Promise<BillingSubscriptionResponse>;
|
|
252
|
+
/**
|
|
253
|
+
* Read the current paid entitlement state for the signed-in browser user.
|
|
254
|
+
*/
|
|
255
|
+
getEntitlements(): Promise<BillingEntitlementsResponse>;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Client-side event tracking with automatic batching.
|
|
260
|
+
*
|
|
261
|
+
* Events are queued in memory and flushed to the API in batches,
|
|
262
|
+
* either on a timer or when the batch size limit is reached.
|
|
263
|
+
*
|
|
264
|
+
* Access via `buildspace.events` on the client SDK.
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* ```ts
|
|
268
|
+
* // Fire and forget — events are queued automatically
|
|
269
|
+
* buildspace.events.track("button.clicked", { label: "upgrade" });
|
|
270
|
+
*
|
|
271
|
+
* // Flush before page unload
|
|
272
|
+
* await buildspace.events.flush();
|
|
273
|
+
*
|
|
274
|
+
* // Graceful shutdown (clears timer, flushes remaining)
|
|
275
|
+
* await buildspace.events.shutdown();
|
|
276
|
+
* ```
|
|
277
|
+
*/
|
|
278
|
+
declare class EventsClientNamespace {
|
|
279
|
+
private readonly queue;
|
|
280
|
+
private readonly transport;
|
|
281
|
+
private timer;
|
|
282
|
+
constructor(transport: HttpTransport, config?: {
|
|
283
|
+
flushInterval?: number;
|
|
284
|
+
maxBatchSize?: number;
|
|
285
|
+
});
|
|
286
|
+
private readonly maxBatchSize;
|
|
287
|
+
/**
|
|
288
|
+
* Queue an event for batched delivery.
|
|
289
|
+
*
|
|
290
|
+
* This method is synchronous and returns immediately. Events are
|
|
291
|
+
* automatically flushed when the batch size is reached or on the
|
|
292
|
+
* configured interval.
|
|
293
|
+
*
|
|
294
|
+
* @param event - Event name, e.g. `"button.clicked"`.
|
|
295
|
+
* @param properties - Arbitrary key-value data to attach.
|
|
296
|
+
* @param actorId - Identifier of the user or entity that triggered the event.
|
|
297
|
+
*/
|
|
298
|
+
track(event: string, properties?: Record<string, unknown>, actorId?: string): void;
|
|
299
|
+
/**
|
|
300
|
+
* Send all queued events to the API immediately.
|
|
301
|
+
*
|
|
302
|
+
* If the flush fails, events are re-queued for the next attempt.
|
|
303
|
+
*/
|
|
304
|
+
flush(): Promise<void>;
|
|
305
|
+
/**
|
|
306
|
+
* Stop the automatic flush timer and send any remaining events.
|
|
307
|
+
*
|
|
308
|
+
* Call this during app shutdown or cleanup to ensure no events are lost.
|
|
309
|
+
*/
|
|
310
|
+
shutdown(): Promise<void>;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/** Metadata for a stored object. */
|
|
314
|
+
interface StorageObject {
|
|
315
|
+
/** MIME type of the stored file. */
|
|
316
|
+
contentType: string;
|
|
317
|
+
/** ISO 8601 timestamp of when the object was created. */
|
|
318
|
+
createdAt: string;
|
|
319
|
+
/** Unique object identifier. */
|
|
320
|
+
id: string;
|
|
321
|
+
/** Storage key/path of the object. */
|
|
322
|
+
key: string;
|
|
323
|
+
/** File size in bytes. */
|
|
324
|
+
size: number;
|
|
325
|
+
/** ID of the user who uploaded the object, or `null` if uploaded via server key. */
|
|
326
|
+
uploadedBy: string | null;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/** Options for uploading a file from the client. */
|
|
330
|
+
interface UploadOptions {
|
|
331
|
+
/** MIME type override. If omitted, inferred from the `File` object or defaults to `"application/octet-stream"`. */
|
|
332
|
+
contentType?: string;
|
|
333
|
+
/** Storage path/key for the file, e.g. `"avatars/user-123.png"`. */
|
|
334
|
+
path: string;
|
|
335
|
+
}
|
|
336
|
+
/** Result of a successful client-side file upload. */
|
|
337
|
+
interface UploadResponse {
|
|
338
|
+
/** The resolved storage key. */
|
|
339
|
+
key: string;
|
|
340
|
+
/** File size in bytes. */
|
|
341
|
+
size: number;
|
|
342
|
+
/** Signed download URL for the uploaded file. */
|
|
343
|
+
url: string;
|
|
344
|
+
}
|
|
345
|
+
/** Result of requesting a signed download URL. */
|
|
346
|
+
interface GetUrlResponse {
|
|
347
|
+
/** URL lifetime in seconds, if applicable. */
|
|
348
|
+
expiresIn?: number;
|
|
349
|
+
/** The storage key of the object. */
|
|
350
|
+
key: string;
|
|
351
|
+
/** The signed download URL. */
|
|
352
|
+
url: string;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Client-side storage methods for uploading and managing files.
|
|
356
|
+
*
|
|
357
|
+
* Access via `buildspace.storage` on the client SDK.
|
|
358
|
+
*
|
|
359
|
+
* @example
|
|
360
|
+
* ```ts
|
|
361
|
+
* // Upload a file (handles signed URL + PUT automatically)
|
|
362
|
+
* const { key, url } = await buildspace.storage.upload(file, {
|
|
363
|
+
* path: "avatars/user-123.png",
|
|
364
|
+
* });
|
|
365
|
+
*
|
|
366
|
+
* // Get a download URL for an existing file
|
|
367
|
+
* const { url } = await buildspace.storage.getUrl(key);
|
|
368
|
+
* ```
|
|
369
|
+
*/
|
|
370
|
+
declare class StorageClientNamespace {
|
|
371
|
+
private readonly transport;
|
|
372
|
+
constructor(transport: HttpTransport);
|
|
373
|
+
/**
|
|
374
|
+
* Upload a `File` or `Blob` to Buildspace storage.
|
|
375
|
+
*
|
|
376
|
+
* This method handles the full upload flow:
|
|
377
|
+
* 1. Requests a pre-signed upload URL from the API
|
|
378
|
+
* 2. Uploads the file directly to the storage provider
|
|
379
|
+
* 3. Returns a signed download URL for the uploaded file
|
|
380
|
+
*
|
|
381
|
+
* @param file - The file or blob to upload.
|
|
382
|
+
* @param opts - Upload options including the storage path.
|
|
383
|
+
* @returns The storage key, file size, and a signed download URL.
|
|
384
|
+
*
|
|
385
|
+
* @throws {BuildspaceError} If the upload URL request or the direct upload fails.
|
|
386
|
+
*/
|
|
387
|
+
upload(file: File | Blob, opts: UploadOptions): Promise<UploadResponse>;
|
|
388
|
+
/**
|
|
389
|
+
* Get a time-limited signed URL for downloading a stored file.
|
|
390
|
+
*
|
|
391
|
+
* @param key - The storage key of the object.
|
|
392
|
+
* @param opts - Optional settings.
|
|
393
|
+
* @param opts.expiresIn - URL lifetime in seconds.
|
|
394
|
+
*/
|
|
395
|
+
getUrl(key: string, opts?: {
|
|
396
|
+
expiresIn?: number;
|
|
397
|
+
}): Promise<GetUrlResponse>;
|
|
398
|
+
/**
|
|
399
|
+
* List stored objects, optionally filtered by key prefix.
|
|
400
|
+
*
|
|
401
|
+
* @param prefix - Only return objects whose key starts with this prefix.
|
|
402
|
+
* @param opts - Pagination options.
|
|
403
|
+
*/
|
|
404
|
+
list(prefix?: string, opts?: {
|
|
405
|
+
limit?: number;
|
|
406
|
+
offset?: number;
|
|
407
|
+
}): Promise<{
|
|
408
|
+
objects: StorageObject[];
|
|
409
|
+
}>;
|
|
410
|
+
/**
|
|
411
|
+
* Delete a stored object by key.
|
|
412
|
+
*
|
|
413
|
+
* @param key - The storage key of the object to delete.
|
|
414
|
+
*/
|
|
415
|
+
delete(key: string): Promise<void>;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Buildspace client SDK — use with a publishable key (`bs_pub_*`).
|
|
420
|
+
*
|
|
421
|
+
* Provides client-safe access to auth URL generation, event tracking
|
|
422
|
+
* (with automatic batching), and file uploads. For server-side usage
|
|
423
|
+
* with full API access, use `new Buildspace()` from `@buildspacestudio/sdk`.
|
|
424
|
+
*
|
|
425
|
+
* @example
|
|
426
|
+
* ```ts
|
|
427
|
+
* import { createClient } from "@buildspacestudio/sdk/client";
|
|
428
|
+
*
|
|
429
|
+
* const buildspace = createClient(process.env.NEXT_PUBLIC_BUILDSPACE_KEY!);
|
|
430
|
+
*
|
|
431
|
+
* // Generate a sign-in URL
|
|
432
|
+
* const url = buildspace.auth.getSignInUrl({
|
|
433
|
+
* redirectUri: "https://yourapp.com/auth/callback",
|
|
434
|
+
* });
|
|
435
|
+
*
|
|
436
|
+
* // Track an event (fire and forget)
|
|
437
|
+
* buildspace.events.track("button.clicked", { label: "upgrade" });
|
|
438
|
+
*
|
|
439
|
+
* // Upload a file
|
|
440
|
+
* const { key, url } = await buildspace.storage.upload(file, {
|
|
441
|
+
* path: "avatars/user-123.png",
|
|
442
|
+
* });
|
|
443
|
+
* ```
|
|
444
|
+
*/
|
|
445
|
+
declare class BuildspaceClient {
|
|
446
|
+
private readonly transport;
|
|
447
|
+
private readonly config;
|
|
448
|
+
private _auth;
|
|
449
|
+
private _billing;
|
|
450
|
+
private _events;
|
|
451
|
+
private _storage;
|
|
452
|
+
/**
|
|
453
|
+
* Create a new client SDK instance.
|
|
454
|
+
*
|
|
455
|
+
* @param publishableKey - Your Buildspace publishable key (starts with `bs_pub_`).
|
|
456
|
+
* @param config - Optional configuration overrides.
|
|
457
|
+
*/
|
|
458
|
+
constructor(publishableKey: string, config?: BuildspaceClientConfig);
|
|
459
|
+
/** Client-side auth: sign-in and sign-up URL generation. */
|
|
460
|
+
get auth(): AuthClientNamespace;
|
|
461
|
+
/** Client-side event tracking with automatic batching. */
|
|
462
|
+
get events(): EventsClientNamespace;
|
|
463
|
+
/** Client-side billing: list prices and redirect to Checkout or Portal. */
|
|
464
|
+
get billing(): BillingClientNamespace;
|
|
465
|
+
/** Client-side file storage: uploads, downloads, listing, deletion. */
|
|
466
|
+
get storage(): StorageClientNamespace;
|
|
467
|
+
/**
|
|
468
|
+
* Notifications are server-only and not available on the client SDK.
|
|
469
|
+
*
|
|
470
|
+
* @throws {BuildspaceError} Always throws — use the server SDK for notifications.
|
|
471
|
+
*/
|
|
472
|
+
get notifications(): never;
|
|
473
|
+
/** Clear the stored session token. */
|
|
474
|
+
clearSession(): void;
|
|
475
|
+
/**
|
|
476
|
+
* Set a session token that will be sent as `X-Session-Token` on all
|
|
477
|
+
* subsequent API requests.
|
|
478
|
+
*
|
|
479
|
+
* @param sessionToken - The session token to attach to requests.
|
|
480
|
+
*/
|
|
481
|
+
setSession(sessionToken: string): void;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* React bindings for the Buildspace client SDK.
|
|
486
|
+
*
|
|
487
|
+
* Wrap your app in {@link BuildspaceProvider} (pass a client created with
|
|
488
|
+
* `createClient()` from `@buildspacestudio/sdk/client` and, optionally, the
|
|
489
|
+
* server-resolved user for a flash-free first paint), then read auth state
|
|
490
|
+
* with {@link useAuth}/{@link useSession} and track events with
|
|
491
|
+
* {@link useTrack}.
|
|
492
|
+
*
|
|
493
|
+
* @example
|
|
494
|
+
* ```tsx
|
|
495
|
+
* // app/layout.tsx (Server Component)
|
|
496
|
+
* const session = await getSession(getServerClient(), await cookies());
|
|
497
|
+
* <Providers initialUser={session?.user ?? null}>{children}</Providers>
|
|
498
|
+
*
|
|
499
|
+
* // components/providers.tsx ("use client")
|
|
500
|
+
* <BuildspaceProvider client={getBrowserClient()} initialUser={initialUser}>
|
|
501
|
+
* {children}
|
|
502
|
+
* </BuildspaceProvider>
|
|
503
|
+
* ```
|
|
504
|
+
*/
|
|
505
|
+
/** Auth state and actions exposed by {@link useAuth}. */
|
|
506
|
+
interface BuildspaceAuthState {
|
|
507
|
+
/** True while the session is being resolved client-side. */
|
|
508
|
+
loading: boolean;
|
|
509
|
+
/** Redirect the browser to the Buildspace sign-in page. */
|
|
510
|
+
signIn: () => void;
|
|
511
|
+
/** Log out: POST the logout route, clear local state, and go home. */
|
|
512
|
+
signOut: () => Promise<void>;
|
|
513
|
+
/** Redirect the browser to the Buildspace sign-up page. */
|
|
514
|
+
signUp: () => void;
|
|
515
|
+
/** The signed-in user, or `null`. */
|
|
516
|
+
user: AuthUser | null;
|
|
517
|
+
}
|
|
518
|
+
interface BuildspaceContextValue extends BuildspaceAuthState {
|
|
519
|
+
client: BuildspaceClient | null;
|
|
520
|
+
}
|
|
521
|
+
/** Options for {@link BuildspaceProvider}. */
|
|
522
|
+
interface BuildspaceProviderProps {
|
|
523
|
+
/** Path of your OAuth callback route. Defaults to `/api/auth/callback`. */
|
|
524
|
+
callbackPath?: string;
|
|
525
|
+
children: ReactNode;
|
|
526
|
+
/** A client SDK instance (`createClient("bs_pub_...")`). */
|
|
527
|
+
client: BuildspaceClient;
|
|
528
|
+
/**
|
|
529
|
+
* The server-resolved user (from `getSession()` in a Server Component).
|
|
530
|
+
* Pass it so the first client render already knows who is signed in.
|
|
531
|
+
*/
|
|
532
|
+
initialUser?: AuthUser | null;
|
|
533
|
+
/** Path of your logout route. Defaults to `/api/auth/logout`. */
|
|
534
|
+
logoutPath?: string;
|
|
535
|
+
/** Where to send the user after sign-out. Defaults to `/`. */
|
|
536
|
+
signedOutRedirect?: string;
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Provides Buildspace auth state and the client SDK to the React tree.
|
|
540
|
+
*
|
|
541
|
+
* Must render inside a client boundary (`"use client"`).
|
|
542
|
+
*/
|
|
543
|
+
declare function BuildspaceProvider({ callbackPath, children, client, initialUser, logoutPath, signedOutRedirect, }: BuildspaceProviderProps): react.FunctionComponentElement<react.ProviderProps<BuildspaceContextValue>>;
|
|
544
|
+
/** Auth state and actions: `{ user, loading, signIn, signUp, signOut }`. */
|
|
545
|
+
declare function useAuth(): BuildspaceAuthState;
|
|
546
|
+
/** The current session's user: `{ user, loading }`. */
|
|
547
|
+
declare function useSession(): {
|
|
548
|
+
loading: boolean;
|
|
549
|
+
user: AuthUser | null;
|
|
550
|
+
};
|
|
551
|
+
/** The client SDK instance passed to {@link BuildspaceProvider}. */
|
|
552
|
+
declare function useBuildspaceClient(): BuildspaceClient;
|
|
553
|
+
/**
|
|
554
|
+
* Fire-and-forget analytics tracking bound to the signed-in user.
|
|
555
|
+
*
|
|
556
|
+
* Wraps the batched client events namespace; analytics never throw and never
|
|
557
|
+
* block the UI.
|
|
558
|
+
*
|
|
559
|
+
* @example
|
|
560
|
+
* ```tsx
|
|
561
|
+
* const track = useTrack();
|
|
562
|
+
* <button onClick={() => track("upgrade.clicked", { plan: "pro" })} />
|
|
563
|
+
* ```
|
|
564
|
+
*/
|
|
565
|
+
declare function useTrack(): (event: string, properties?: Record<string, unknown>) => void;
|
|
566
|
+
|
|
567
|
+
export { type BuildspaceAuthState, BuildspaceProvider, type BuildspaceProviderProps, useAuth, useBuildspaceClient, useSession, useTrack };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/react/index.ts
|
|
4
|
+
import { createContext, createElement, useCallback, useContext, useMemo, useState } from "react";
|
|
5
|
+
var BuildspaceContext = createContext({
|
|
6
|
+
client: null,
|
|
7
|
+
loading: false,
|
|
8
|
+
signIn: () => void 0,
|
|
9
|
+
signOut: () => Promise.resolve(),
|
|
10
|
+
signUp: () => void 0,
|
|
11
|
+
user: null
|
|
12
|
+
});
|
|
13
|
+
function browserLocation() {
|
|
14
|
+
const location = globalThis.location;
|
|
15
|
+
return location ?? null;
|
|
16
|
+
}
|
|
17
|
+
function BuildspaceProvider({
|
|
18
|
+
callbackPath = "/api/auth/callback",
|
|
19
|
+
children,
|
|
20
|
+
client,
|
|
21
|
+
initialUser = null,
|
|
22
|
+
logoutPath = "/api/auth/logout",
|
|
23
|
+
signedOutRedirect = "/"
|
|
24
|
+
}) {
|
|
25
|
+
const [user, setUser] = useState(initialUser);
|
|
26
|
+
const signIn = useCallback(() => {
|
|
27
|
+
const location = browserLocation();
|
|
28
|
+
if (!location) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
location.href = client.auth.getSignInUrl({
|
|
32
|
+
redirectUri: `${location.origin}${callbackPath}`
|
|
33
|
+
});
|
|
34
|
+
}, [client, callbackPath]);
|
|
35
|
+
const signUp = useCallback(() => {
|
|
36
|
+
const location = browserLocation();
|
|
37
|
+
if (!location) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
location.href = client.auth.getSignUpUrl({
|
|
41
|
+
redirectUri: `${location.origin}${callbackPath}`
|
|
42
|
+
});
|
|
43
|
+
}, [client, callbackPath]);
|
|
44
|
+
const signOut = useCallback(async () => {
|
|
45
|
+
await fetch(logoutPath, { method: "POST" });
|
|
46
|
+
setUser(null);
|
|
47
|
+
const location = browserLocation();
|
|
48
|
+
if (location) {
|
|
49
|
+
location.href = signedOutRedirect;
|
|
50
|
+
}
|
|
51
|
+
}, [logoutPath, signedOutRedirect]);
|
|
52
|
+
const value = useMemo(
|
|
53
|
+
() => ({ client, loading: false, signIn, signOut, signUp, user }),
|
|
54
|
+
[client, signIn, signOut, signUp, user]
|
|
55
|
+
);
|
|
56
|
+
return createElement(BuildspaceContext, { value }, children);
|
|
57
|
+
}
|
|
58
|
+
function useAuth() {
|
|
59
|
+
const { client: _client, ...auth } = useContext(BuildspaceContext);
|
|
60
|
+
return auth;
|
|
61
|
+
}
|
|
62
|
+
function useSession() {
|
|
63
|
+
const { loading, user } = useContext(BuildspaceContext);
|
|
64
|
+
return { loading, user };
|
|
65
|
+
}
|
|
66
|
+
function useBuildspaceClient() {
|
|
67
|
+
const { client } = useContext(BuildspaceContext);
|
|
68
|
+
if (!client) {
|
|
69
|
+
throw new Error("useBuildspaceClient must be used inside <BuildspaceProvider>.");
|
|
70
|
+
}
|
|
71
|
+
return client;
|
|
72
|
+
}
|
|
73
|
+
function useTrack() {
|
|
74
|
+
const { client, user } = useContext(BuildspaceContext);
|
|
75
|
+
return useCallback(
|
|
76
|
+
(event, properties) => {
|
|
77
|
+
try {
|
|
78
|
+
client?.events.track(event, properties, user?.id);
|
|
79
|
+
} catch {
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
[client, user?.id]
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
export {
|
|
86
|
+
BuildspaceProvider,
|
|
87
|
+
useAuth,
|
|
88
|
+
useBuildspaceClient,
|
|
89
|
+
useSession,
|
|
90
|
+
useTrack
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/react/index.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { createContext, createElement, useCallback, useContext, useMemo, useState } from \"react\";\nimport type { AuthUser } from \"../auth\";\nimport type { BuildspaceClient } from \"../client\";\n\n/**\n * React bindings for the Buildspace client SDK.\n *\n * Wrap your app in {@link BuildspaceProvider} (pass a client created with\n * `createClient()` from `@buildspacestudio/sdk/client` and, optionally, the\n * server-resolved user for a flash-free first paint), then read auth state\n * with {@link useAuth}/{@link useSession} and track events with\n * {@link useTrack}.\n *\n * @example\n * ```tsx\n * // app/layout.tsx (Server Component)\n * const session = await getSession(getServerClient(), await cookies());\n * <Providers initialUser={session?.user ?? null}>{children}</Providers>\n *\n * // components/providers.tsx (\"use client\")\n * <BuildspaceProvider client={getBrowserClient()} initialUser={initialUser}>\n * {children}\n * </BuildspaceProvider>\n * ```\n */\n\n/** Auth state and actions exposed by {@link useAuth}. */\nexport interface BuildspaceAuthState {\n /** True while the session is being resolved client-side. */\n loading: boolean;\n /** Redirect the browser to the Buildspace sign-in page. */\n signIn: () => void;\n /** Log out: POST the logout route, clear local state, and go home. */\n signOut: () => Promise<void>;\n /** Redirect the browser to the Buildspace sign-up page. */\n signUp: () => void;\n /** The signed-in user, or `null`. */\n user: AuthUser | null;\n}\n\ninterface BuildspaceContextValue extends BuildspaceAuthState {\n client: BuildspaceClient | null;\n}\n\nconst BuildspaceContext = createContext<BuildspaceContextValue>({\n client: null,\n loading: false,\n signIn: () => undefined,\n signOut: () => Promise.resolve(),\n signUp: () => undefined,\n user: null,\n});\n\nfunction browserLocation(): { href: string; origin: string } | null {\n const location = (globalThis as { location?: { href: string; origin: string } }).location;\n return location ?? null;\n}\n\n/** Options for {@link BuildspaceProvider}. */\nexport interface BuildspaceProviderProps {\n /** Path of your OAuth callback route. Defaults to `/api/auth/callback`. */\n callbackPath?: string;\n children: ReactNode;\n /** A client SDK instance (`createClient(\"bs_pub_...\")`). */\n client: BuildspaceClient;\n /**\n * The server-resolved user (from `getSession()` in a Server Component).\n * Pass it so the first client render already knows who is signed in.\n */\n initialUser?: AuthUser | null;\n /** Path of your logout route. Defaults to `/api/auth/logout`. */\n logoutPath?: string;\n /** Where to send the user after sign-out. Defaults to `/`. */\n signedOutRedirect?: string;\n}\n\n/**\n * Provides Buildspace auth state and the client SDK to the React tree.\n *\n * Must render inside a client boundary (`\"use client\"`).\n */\nexport function BuildspaceProvider({\n callbackPath = \"/api/auth/callback\",\n children,\n client,\n initialUser = null,\n logoutPath = \"/api/auth/logout\",\n signedOutRedirect = \"/\",\n}: BuildspaceProviderProps) {\n const [user, setUser] = useState<AuthUser | null>(initialUser);\n\n const signIn = useCallback(() => {\n const location = browserLocation();\n if (!location) {\n return;\n }\n\n location.href = client.auth.getSignInUrl({\n redirectUri: `${location.origin}${callbackPath}`,\n });\n }, [client, callbackPath]);\n\n const signUp = useCallback(() => {\n const location = browserLocation();\n if (!location) {\n return;\n }\n\n location.href = client.auth.getSignUpUrl({\n redirectUri: `${location.origin}${callbackPath}`,\n });\n }, [client, callbackPath]);\n\n const signOut = useCallback(async () => {\n await fetch(logoutPath, { method: \"POST\" });\n setUser(null);\n const location = browserLocation();\n if (location) {\n location.href = signedOutRedirect;\n }\n }, [logoutPath, signedOutRedirect]);\n\n const value = useMemo<BuildspaceContextValue>(\n () => ({ client, loading: false, signIn, signOut, signUp, user }),\n [client, signIn, signOut, signUp, user]\n );\n\n return createElement(BuildspaceContext, { value }, children);\n}\n\n/** Auth state and actions: `{ user, loading, signIn, signUp, signOut }`. */\nexport function useAuth(): BuildspaceAuthState {\n const { client: _client, ...auth } = useContext(BuildspaceContext);\n return auth;\n}\n\n/** The current session's user: `{ user, loading }`. */\nexport function useSession(): { loading: boolean; user: AuthUser | null } {\n const { loading, user } = useContext(BuildspaceContext);\n return { loading, user };\n}\n\n/** The client SDK instance passed to {@link BuildspaceProvider}. */\nexport function useBuildspaceClient(): BuildspaceClient {\n const { client } = useContext(BuildspaceContext);\n if (!client) {\n throw new Error(\"useBuildspaceClient must be used inside <BuildspaceProvider>.\");\n }\n\n return client;\n}\n\n/**\n * Fire-and-forget analytics tracking bound to the signed-in user.\n *\n * Wraps the batched client events namespace; analytics never throw and never\n * block the UI.\n *\n * @example\n * ```tsx\n * const track = useTrack();\n * <button onClick={() => track(\"upgrade.clicked\", { plan: \"pro\" })} />\n * ```\n */\nexport function useTrack(): (event: string, properties?: Record<string, unknown>) => void {\n const { client, user } = useContext(BuildspaceContext);\n\n return useCallback(\n (event: string, properties?: Record<string, unknown>) => {\n try {\n client?.events.track(event, properties, user?.id);\n } catch {\n // Analytics must never break the app.\n }\n },\n [client, user?.id]\n );\n}\n"],"mappings":";;;AACA,SAAS,eAAe,eAAe,aAAa,YAAY,SAAS,gBAAgB;AA4CzF,IAAM,oBAAoB,cAAsC;AAAA,EAC9D,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ,MAAM;AAAA,EACd,SAAS,MAAM,QAAQ,QAAQ;AAAA,EAC/B,QAAQ,MAAM;AAAA,EACd,MAAM;AACR,CAAC;AAED,SAAS,kBAA2D;AAClE,QAAM,WAAY,WAA+D;AACjF,SAAO,YAAY;AACrB;AAyBO,SAAS,mBAAmB;AAAA,EACjC,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd,aAAa;AAAA,EACb,oBAAoB;AACtB,GAA4B;AAC1B,QAAM,CAAC,MAAM,OAAO,IAAI,SAA0B,WAAW;AAE7D,QAAM,SAAS,YAAY,MAAM;AAC/B,UAAM,WAAW,gBAAgB;AACjC,QAAI,CAAC,UAAU;AACb;AAAA,IACF;AAEA,aAAS,OAAO,OAAO,KAAK,aAAa;AAAA,MACvC,aAAa,GAAG,SAAS,MAAM,GAAG,YAAY;AAAA,IAChD,CAAC;AAAA,EACH,GAAG,CAAC,QAAQ,YAAY,CAAC;AAEzB,QAAM,SAAS,YAAY,MAAM;AAC/B,UAAM,WAAW,gBAAgB;AACjC,QAAI,CAAC,UAAU;AACb;AAAA,IACF;AAEA,aAAS,OAAO,OAAO,KAAK,aAAa;AAAA,MACvC,aAAa,GAAG,SAAS,MAAM,GAAG,YAAY;AAAA,IAChD,CAAC;AAAA,EACH,GAAG,CAAC,QAAQ,YAAY,CAAC;AAEzB,QAAM,UAAU,YAAY,YAAY;AACtC,UAAM,MAAM,YAAY,EAAE,QAAQ,OAAO,CAAC;AAC1C,YAAQ,IAAI;AACZ,UAAM,WAAW,gBAAgB;AACjC,QAAI,UAAU;AACZ,eAAS,OAAO;AAAA,IAClB;AAAA,EACF,GAAG,CAAC,YAAY,iBAAiB,CAAC;AAElC,QAAM,QAAQ;AAAA,IACZ,OAAO,EAAE,QAAQ,SAAS,OAAO,QAAQ,SAAS,QAAQ,KAAK;AAAA,IAC/D,CAAC,QAAQ,QAAQ,SAAS,QAAQ,IAAI;AAAA,EACxC;AAEA,SAAO,cAAc,mBAAmB,EAAE,MAAM,GAAG,QAAQ;AAC7D;AAGO,SAAS,UAA+B;AAC7C,QAAM,EAAE,QAAQ,SAAS,GAAG,KAAK,IAAI,WAAW,iBAAiB;AACjE,SAAO;AACT;AAGO,SAAS,aAA0D;AACxE,QAAM,EAAE,SAAS,KAAK,IAAI,WAAW,iBAAiB;AACtD,SAAO,EAAE,SAAS,KAAK;AACzB;AAGO,SAAS,sBAAwC;AACtD,QAAM,EAAE,OAAO,IAAI,WAAW,iBAAiB;AAC/C,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI,MAAM,+DAA+D;AAAA,EACjF;AAEA,SAAO;AACT;AAcO,SAAS,WAA0E;AACxF,QAAM,EAAE,QAAQ,KAAK,IAAI,WAAW,iBAAiB;AAErD,SAAO;AAAA,IACL,CAAC,OAAe,eAAyC;AACvD,UAAI;AACF,gBAAQ,OAAO,MAAM,OAAO,YAAY,MAAM,EAAE;AAAA,MAClD,QAAQ;AAAA,MAER;AAAA,IACF;AAAA,IACA,CAAC,QAAQ,MAAM,EAAE;AAAA,EACnB;AACF;","names":[]}
|