@01.software/sdk 0.29.0 → 0.31.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 +331 -77
- package/dist/analytics/react.cjs +4 -1
- package/dist/analytics/react.cjs.map +1 -1
- package/dist/analytics/react.js +4 -1
- package/dist/analytics/react.js.map +1 -1
- package/dist/analytics.cjs +4 -1
- package/dist/analytics.cjs.map +1 -1
- package/dist/analytics.js +4 -1
- package/dist/analytics.js.map +1 -1
- package/dist/client.cjs +1541 -0
- package/dist/client.cjs.map +1 -0
- package/dist/client.d.cts +28 -0
- package/dist/client.d.ts +28 -0
- package/dist/client.js +1518 -0
- package/dist/client.js.map +1 -0
- package/dist/collection-client-ByzY3hWK.d.ts +218 -0
- package/dist/collection-client-DFXXz0vk.d.cts +218 -0
- package/dist/{const-DAjQYNuM.d.ts → const-AytzliEu.d.cts} +5 -7
- package/dist/{const-Dsixdi6z.d.cts → const-BGCP-OJL.d.ts} +5 -7
- package/dist/index-BGEhoDUs.d.cts +106 -0
- package/dist/index-BGEhoDUs.d.ts +106 -0
- package/dist/index.cjs +1006 -1615
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -115
- package/dist/index.d.ts +11 -115
- package/dist/index.js +932 -1559
- package/dist/index.js.map +1 -1
- package/dist/metadata.cjs +91 -0
- package/dist/metadata.cjs.map +1 -0
- package/dist/metadata.d.cts +58 -0
- package/dist/metadata.d.ts +58 -0
- package/dist/metadata.js +68 -0
- package/dist/metadata.js.map +1 -0
- package/dist/{payload-types-Ci-ZA7aM.d.cts → payload-types-Wa4-eC6x.d.cts} +794 -532
- package/dist/{payload-types-Ci-ZA7aM.d.ts → payload-types-Wa4-eC6x.d.ts} +794 -532
- package/dist/query.cjs +1841 -0
- package/dist/query.cjs.map +1 -0
- package/dist/query.d.cts +244 -0
- package/dist/query.d.ts +244 -0
- package/dist/query.js +1836 -0
- package/dist/query.js.map +1 -0
- package/dist/realtime.cjs +4 -1
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.d.cts +2 -2
- package/dist/realtime.d.ts +2 -2
- package/dist/realtime.js +4 -1
- package/dist/realtime.js.map +1 -1
- package/dist/{server-BINWywT8.d.cts → server-CrsPyqEc.d.cts} +14 -31
- package/dist/{server-BINWywT8.d.ts → server-CrsPyqEc.d.ts} +14 -31
- package/dist/server.cjs +430 -846
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +137 -7
- package/dist/server.d.ts +137 -7
- package/dist/server.js +430 -864
- package/dist/server.js.map +1 -1
- package/dist/{server-Cv0Q4dPQ.d.ts → types-BX2mqDf6.d.ts} +270 -743
- package/dist/{types-BWq_WlbB.d.ts → types-CVA10VC-.d.ts} +6 -2
- package/dist/{types-zKjATmDK.d.cts → types-CmLG-7RL.d.cts} +6 -2
- package/dist/{server-C0C8dtms.d.cts → types-DChFjQGz.d.cts} +270 -743
- package/dist/ui/canvas/server.cjs +7 -6
- package/dist/ui/canvas/server.cjs.map +1 -1
- package/dist/ui/canvas/server.d.cts +1 -3
- package/dist/ui/canvas/server.d.ts +1 -3
- package/dist/ui/canvas/server.js +7 -6
- package/dist/ui/canvas/server.js.map +1 -1
- package/dist/ui/canvas.cjs +11 -10
- package/dist/ui/canvas.cjs.map +1 -1
- package/dist/ui/canvas.d.cts +29 -6
- package/dist/ui/canvas.d.ts +29 -6
- package/dist/ui/canvas.js +11 -10
- package/dist/ui/canvas.js.map +1 -1
- package/dist/ui/form.d.cts +1 -1
- package/dist/ui/form.d.ts +1 -1
- package/dist/ui/video.d.cts +1 -1
- package/dist/ui/video.d.ts +1 -1
- package/dist/webhook.d.cts +3 -3
- package/dist/webhook.d.ts +3 -3
- package/package.json +84 -15
|
@@ -1,489 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { O as Order,
|
|
4
|
-
import { Sort, Where } from 'payload';
|
|
5
|
-
import { Metadata } from 'next';
|
|
6
|
-
import { C as CollectionType } from './types-BWq_WlbB.js';
|
|
7
|
-
import { P as PublicCollection, d as ServerCollection } from './const-DAjQYNuM.js';
|
|
8
|
-
|
|
9
|
-
declare function resolveApiUrl(): string;
|
|
10
|
-
interface ClientConfig {
|
|
11
|
-
publishableKey: string;
|
|
12
|
-
/**
|
|
13
|
-
* Customer authentication options.
|
|
14
|
-
* Used to initialize CustomerAuth on Client.
|
|
15
|
-
*/
|
|
16
|
-
customer?: {
|
|
17
|
-
/**
|
|
18
|
-
* Persist token in localStorage. Defaults to `true`.
|
|
19
|
-
* - `true` (default): uses key `'customer-token'`
|
|
20
|
-
* - `string`: uses the given string as localStorage key
|
|
21
|
-
* - `false`: disables persistence (token/onTokenChange used instead)
|
|
22
|
-
*
|
|
23
|
-
* Handles SSR safely (no-op on server).
|
|
24
|
-
* When enabled, `token` and `onTokenChange` are ignored.
|
|
25
|
-
*/
|
|
26
|
-
persist?: boolean | string;
|
|
27
|
-
/** Initial token (e.g. from SSR cookie) */
|
|
28
|
-
token?: string;
|
|
29
|
-
/** Called when token changes (login/logout) — use to persist in localStorage/cookie */
|
|
30
|
-
onTokenChange?: (token: string | null) => void;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
interface ClientServerConfig extends ClientConfig {
|
|
34
|
-
secretKey: string;
|
|
35
|
-
}
|
|
36
|
-
interface ClientMetadata {
|
|
37
|
-
userAgent?: string;
|
|
38
|
-
timestamp: number;
|
|
39
|
-
}
|
|
40
|
-
interface ClientState {
|
|
41
|
-
metadata: ClientMetadata;
|
|
42
|
-
}
|
|
43
|
-
interface PaginationMeta {
|
|
44
|
-
page: number;
|
|
45
|
-
limit: number;
|
|
46
|
-
totalDocs: number;
|
|
47
|
-
totalPages: number;
|
|
48
|
-
hasNextPage: boolean;
|
|
49
|
-
hasPrevPage: boolean;
|
|
50
|
-
pagingCounter: number;
|
|
51
|
-
prevPage: number | null;
|
|
52
|
-
nextPage: number | null;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Payload CMS Find (List) Response
|
|
56
|
-
* GET /api/{collection}
|
|
57
|
-
*/
|
|
58
|
-
interface PayloadFindResponse<T = unknown> {
|
|
59
|
-
docs: T[];
|
|
60
|
-
totalDocs: number;
|
|
61
|
-
limit: number;
|
|
62
|
-
totalPages: number;
|
|
63
|
-
page: number;
|
|
64
|
-
pagingCounter: number;
|
|
65
|
-
hasPrevPage: boolean;
|
|
66
|
-
hasNextPage: boolean;
|
|
67
|
-
prevPage: number | null;
|
|
68
|
-
nextPage: number | null;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Payload CMS Create/Update Response
|
|
72
|
-
* POST /api/{collection}
|
|
73
|
-
* PATCH /api/{collection}/{id}
|
|
74
|
-
*/
|
|
75
|
-
interface PayloadMutationResponse<T = unknown> {
|
|
76
|
-
message: string;
|
|
77
|
-
doc: T;
|
|
78
|
-
errors?: unknown[];
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Do NOT replace with `Pick<FindOptions>` from `payload`. Payload's generic
|
|
82
|
-
* types (`JoinQuery<TSlug>`, `PopulateType`) depend on `PayloadTypes` module
|
|
83
|
-
* augmentation; external SDK consumers who skip that get degenerate types
|
|
84
|
-
* (`never` / `{}`). Only non-generic `Sort`/`Where` are safe to import.
|
|
85
|
-
* Excluded vs native: Local-API-only fields, `locale`/`fallbackLocale`.
|
|
86
|
-
*/
|
|
87
|
-
interface ApiQueryOptions {
|
|
88
|
-
page?: number;
|
|
89
|
-
limit?: number;
|
|
90
|
-
sort?: Sort;
|
|
91
|
-
/**
|
|
92
|
-
* Filter documents. Id-based relation filters (`where: { product: { equals: id } }`) are the
|
|
93
|
-
* most reliable pattern. Dotted-path relation filters (`where: { 'product.slug': { equals } }`)
|
|
94
|
-
* are Payload-native but may silently return empty when access control restricts the related
|
|
95
|
-
* document or when the relation is polymorphic. String shorthand (`where: { slug: 'x' }`)
|
|
96
|
-
* silently matches nothing — always use `{ slug: { equals: 'x' } }`.
|
|
97
|
-
*/
|
|
98
|
-
where?: Where;
|
|
99
|
-
/**
|
|
100
|
-
* Controls how deeply relationship fields are populated. This is the primary control for
|
|
101
|
-
* populating relationships like `category`, `images`, `brand`. The configured Payload default
|
|
102
|
-
* applies when unset.
|
|
103
|
-
*/
|
|
104
|
-
depth?: number;
|
|
105
|
-
select?: Record<string, boolean>;
|
|
106
|
-
/**
|
|
107
|
-
* Controls which fields are returned for already-populated relationships, keyed by collection
|
|
108
|
-
* slug. Does NOT control which relationships to populate — that is `depth`.
|
|
109
|
-
*
|
|
110
|
-
* @example
|
|
111
|
-
* // depth: 2 populates category; populate trims which fields come back
|
|
112
|
-
* populate: { categories: { title: true, slug: true } }
|
|
113
|
-
*/
|
|
114
|
-
populate?: Record<string, boolean | Record<string, boolean>>;
|
|
115
|
-
/**
|
|
116
|
-
* Controls Payload `type: 'join'` virtual reverse-relation fields only (pagination, sort,
|
|
117
|
-
* filter, count per join field, or `false` to disable all join-field population).
|
|
118
|
-
*
|
|
119
|
-
* Does NOT populate normal relationship fields like `category`, `images`, or `brand`.
|
|
120
|
-
* For normal relationship population use `depth` (and optionally `populate` for field
|
|
121
|
-
* selection).
|
|
122
|
-
*
|
|
123
|
-
* Pass `joins: false` to disable all join-field population — useful for lightweight list
|
|
124
|
-
* queries where join fields are not needed.
|
|
125
|
-
*
|
|
126
|
-
* @example
|
|
127
|
-
* // `article-authors` has a `type: 'join'` field `articles` (reverse-relation)
|
|
128
|
-
* joins: { articles: { limit: 10, sort: '-publishedAt' } }
|
|
129
|
-
*
|
|
130
|
-
* // depth: 2 populates product.category — joins has no effect on this
|
|
131
|
-
* depth: 2
|
|
132
|
-
*
|
|
133
|
-
* // Disable all join-field population
|
|
134
|
-
* joins: false
|
|
135
|
-
*/
|
|
136
|
-
joins?: Record<string, {
|
|
137
|
-
limit?: number;
|
|
138
|
-
page?: number;
|
|
139
|
-
sort?: string;
|
|
140
|
-
where?: Where;
|
|
141
|
-
count?: boolean;
|
|
142
|
-
} | false> | false;
|
|
143
|
-
/** Set to `false` to skip the count query — returns docs without totalDocs/totalPages */
|
|
144
|
-
pagination?: boolean;
|
|
145
|
-
/** Include draft versions (access control still applies on the server) */
|
|
146
|
-
draft?: boolean;
|
|
147
|
-
/** Include soft-deleted documents (requires `trash` enabled on the collection) */
|
|
148
|
-
trash?: boolean;
|
|
149
|
-
}
|
|
150
|
-
interface DebugConfig {
|
|
151
|
-
logRequests?: boolean;
|
|
152
|
-
logResponses?: boolean;
|
|
153
|
-
logErrors?: boolean;
|
|
154
|
-
}
|
|
155
|
-
interface RetryConfig {
|
|
156
|
-
maxRetries?: number;
|
|
157
|
-
retryableStatuses?: number[];
|
|
158
|
-
retryDelay?: (attempt: number) => number;
|
|
159
|
-
}
|
|
160
|
-
type DeepPartial<T> = {
|
|
161
|
-
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
162
|
-
};
|
|
163
|
-
type ExtractArrayType<T> = T extends (infer U)[] ? U : never;
|
|
164
|
-
|
|
165
|
-
interface GenerateMetadataOptions {
|
|
166
|
-
siteName?: string;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
declare class SDKError extends Error {
|
|
170
|
-
readonly code: string;
|
|
171
|
-
readonly status?: number;
|
|
172
|
-
readonly details?: unknown;
|
|
173
|
-
readonly userMessage?: string;
|
|
174
|
-
readonly suggestion?: string;
|
|
175
|
-
readonly requestId?: string;
|
|
176
|
-
constructor(code: string, message: string, status?: number, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string);
|
|
177
|
-
getUserMessage(): string;
|
|
178
|
-
toJSON(): {
|
|
179
|
-
requestId?: string | undefined;
|
|
180
|
-
name: string;
|
|
181
|
-
code: string;
|
|
182
|
-
message: string;
|
|
183
|
-
status: number | undefined;
|
|
184
|
-
details: unknown;
|
|
185
|
-
userMessage: string | undefined;
|
|
186
|
-
suggestion: string | undefined;
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
declare class NetworkError extends SDKError {
|
|
190
|
-
constructor(message: string, status?: number, details?: unknown, userMessage?: string, suggestion?: string);
|
|
191
|
-
}
|
|
192
|
-
declare class ValidationError extends SDKError {
|
|
193
|
-
constructor(message: string, details?: unknown, userMessage?: string, suggestion?: string, status?: number);
|
|
194
|
-
}
|
|
195
|
-
declare class ApiError extends SDKError {
|
|
196
|
-
constructor(message: string, status: number, details?: unknown, userMessage?: string, suggestion?: string);
|
|
197
|
-
}
|
|
198
|
-
declare class ConfigError extends SDKError {
|
|
199
|
-
constructor(message: string, details?: unknown, userMessage?: string, suggestion?: string);
|
|
200
|
-
}
|
|
201
|
-
declare class TimeoutError extends SDKError {
|
|
202
|
-
constructor(message?: string, details?: unknown, userMessage?: string, suggestion?: string);
|
|
203
|
-
}
|
|
204
|
-
declare class GoneError extends SDKError {
|
|
205
|
-
constructor(message?: string, details?: unknown, userMessage?: string, suggestion?: string);
|
|
206
|
-
}
|
|
207
|
-
declare class ServiceUnavailableError extends SDKError {
|
|
208
|
-
readonly retryAfter?: number;
|
|
209
|
-
constructor(message?: string, retryAfter?: number, details?: unknown, userMessage?: string, suggestion?: string);
|
|
210
|
-
}
|
|
211
|
-
declare class UsageLimitError extends SDKError {
|
|
212
|
-
readonly usage: {
|
|
213
|
-
limit: number;
|
|
214
|
-
current: number;
|
|
215
|
-
remaining: number;
|
|
216
|
-
};
|
|
217
|
-
constructor(message: string, usage: {
|
|
218
|
-
limit: number;
|
|
219
|
-
current: number;
|
|
220
|
-
remaining: number;
|
|
221
|
-
}, details?: unknown, userMessage?: string, suggestion?: string);
|
|
222
|
-
toJSON(): {
|
|
223
|
-
usage: {
|
|
224
|
-
limit: number;
|
|
225
|
-
current: number;
|
|
226
|
-
remaining: number;
|
|
227
|
-
};
|
|
228
|
-
requestId?: string | undefined;
|
|
229
|
-
name: string;
|
|
230
|
-
code: string;
|
|
231
|
-
message: string;
|
|
232
|
-
status: number | undefined;
|
|
233
|
-
details: unknown;
|
|
234
|
-
userMessage: string | undefined;
|
|
235
|
-
suggestion: string | undefined;
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
declare class AuthError extends SDKError {
|
|
239
|
-
constructor(message: string, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string);
|
|
240
|
-
}
|
|
241
|
-
declare class PermissionError extends SDKError {
|
|
242
|
-
constructor(message: string, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string);
|
|
243
|
-
}
|
|
244
|
-
declare class NotFoundError extends SDKError {
|
|
245
|
-
constructor(message: string, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string);
|
|
246
|
-
}
|
|
247
|
-
declare class ConflictError extends SDKError {
|
|
248
|
-
constructor(message: string, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string);
|
|
249
|
-
}
|
|
250
|
-
declare class RateLimitError extends SDKError {
|
|
251
|
-
readonly retryAfter?: number;
|
|
252
|
-
constructor(message: string, retryAfter?: number, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string);
|
|
253
|
-
}
|
|
254
|
-
declare function isSDKError(error: unknown): error is SDKError;
|
|
255
|
-
declare function isNetworkError(error: unknown): error is NetworkError;
|
|
256
|
-
declare function isValidationError(error: unknown): error is ValidationError;
|
|
257
|
-
declare function isApiError(error: unknown): error is ApiError;
|
|
258
|
-
declare function isConfigError(error: unknown): error is ConfigError;
|
|
259
|
-
declare function isTimeoutError(error: unknown): error is TimeoutError;
|
|
260
|
-
declare function isGoneError(error: unknown): error is GoneError;
|
|
261
|
-
declare function isServiceUnavailableError(error: unknown): error is ServiceUnavailableError;
|
|
262
|
-
declare function isUsageLimitError(error: unknown): error is UsageLimitError;
|
|
263
|
-
declare function isAuthError(error: unknown): error is AuthError;
|
|
264
|
-
declare function isPermissionError(error: unknown): error is PermissionError;
|
|
265
|
-
declare function isNotFoundError(error: unknown): error is NotFoundError;
|
|
266
|
-
declare function isConflictError(error: unknown): error is ConflictError;
|
|
267
|
-
declare function isRateLimitError(error: unknown): error is RateLimitError;
|
|
268
|
-
declare const createAuthError: (message: string, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string) => AuthError;
|
|
269
|
-
declare const createPermissionError: (message: string, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string) => PermissionError;
|
|
270
|
-
declare const createNotFoundError: (message: string, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string) => NotFoundError;
|
|
271
|
-
declare const createConflictError: (message: string, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string) => ConflictError;
|
|
272
|
-
declare const createRateLimitError: (message: string, retryAfter?: number, details?: unknown, userMessage?: string, suggestion?: string, requestId?: string) => RateLimitError;
|
|
273
|
-
|
|
274
|
-
interface FetchOptions extends RequestInit {
|
|
275
|
-
publishableKey?: string;
|
|
276
|
-
secretKey?: string;
|
|
277
|
-
customerToken?: string;
|
|
278
|
-
timeout?: number;
|
|
279
|
-
debug?: boolean | DebugConfig;
|
|
280
|
-
retry?: RetryConfig;
|
|
281
|
-
/** Called on 401 when customerToken is set and reason=token_expired. Return a new token to retry, or null to fail. */
|
|
282
|
-
onUnauthorized?: () => Promise<string | null>;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
declare class HttpClient {
|
|
286
|
-
protected publishableKey: string;
|
|
287
|
-
protected secretKey?: string;
|
|
288
|
-
private getCustomerToken?;
|
|
289
|
-
private onUnauthorized?;
|
|
290
|
-
private onRequestId?;
|
|
291
|
-
constructor(publishableKey: string, secretKey?: string, getCustomerToken?: () => string | null, onUnauthorized?: () => Promise<string | null>, onRequestId?: (id: string | null) => void);
|
|
292
|
-
protected get defaultOptions(): FetchOptions;
|
|
293
|
-
protected fetchWithTracking(url: string, opts: FetchOptions): Promise<Response>;
|
|
294
|
-
protected buildUrl(endpoint: string, options?: ApiQueryOptions): string;
|
|
295
|
-
protected assertJsonResponse(response: Response): void;
|
|
296
|
-
/**
|
|
297
|
-
* Parse Payload CMS find response (list query)
|
|
298
|
-
* Returns native Payload response structure
|
|
299
|
-
*/
|
|
300
|
-
protected parseFindResponse<T>(response: Response): Promise<PayloadFindResponse<T>>;
|
|
301
|
-
/**
|
|
302
|
-
* Parse Payload CMS mutation response (create/update)
|
|
303
|
-
* Returns native Payload response structure
|
|
304
|
-
*/
|
|
305
|
-
protected parseMutationResponse<T>(response: Response): Promise<PayloadMutationResponse<T>>;
|
|
306
|
-
/**
|
|
307
|
-
* Parse Payload CMS document response (findById/delete)
|
|
308
|
-
* Returns document directly without wrapper
|
|
309
|
-
*/
|
|
310
|
-
protected parseDocumentResponse<T>(response: Response): Promise<T>;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
declare class CollectionClient<TCollection extends string = PublicCollection> extends HttpClient {
|
|
314
|
-
from<T extends TCollection>(collection: T): CollectionQueryBuilder<T>;
|
|
315
|
-
/**
|
|
316
|
-
* Find documents (list query)
|
|
317
|
-
* GET /api/{collection}
|
|
318
|
-
*/
|
|
319
|
-
requestFind<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<PayloadFindResponse<T>>;
|
|
320
|
-
/**
|
|
321
|
-
* Find-like response from a custom endpoint
|
|
322
|
-
* POST /api/...custom-endpoint
|
|
323
|
-
*/
|
|
324
|
-
requestFindEndpoint<T = unknown>(endpoint: string, data?: unknown): Promise<PayloadFindResponse<T>>;
|
|
325
|
-
/**
|
|
326
|
-
* Find document by ID
|
|
327
|
-
* GET /api/{collection}/{id}
|
|
328
|
-
*/
|
|
329
|
-
requestFindById<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<T>;
|
|
330
|
-
/**
|
|
331
|
-
* Create document
|
|
332
|
-
* POST /api/{collection}
|
|
333
|
-
*/
|
|
334
|
-
requestCreate<T = unknown>(endpoint: string, data?: unknown): Promise<PayloadMutationResponse<T>>;
|
|
335
|
-
/**
|
|
336
|
-
* Update document
|
|
337
|
-
* PATCH /api/{collection}/{id}
|
|
338
|
-
*/
|
|
339
|
-
requestUpdate<T = unknown>(endpoint: string, data?: unknown): Promise<PayloadMutationResponse<T>>;
|
|
340
|
-
/**
|
|
341
|
-
* Count documents
|
|
342
|
-
* GET /api/{collection}/count
|
|
343
|
-
*/
|
|
344
|
-
requestCount(endpoint: string, options?: ApiQueryOptions): Promise<{
|
|
345
|
-
totalDocs: number;
|
|
346
|
-
}>;
|
|
347
|
-
/**
|
|
348
|
-
* Update multiple documents (bulk update)
|
|
349
|
-
* PATCH /api/{collection}
|
|
350
|
-
*/
|
|
351
|
-
requestUpdateMany<T = unknown>(endpoint: string, data: {
|
|
352
|
-
where?: unknown;
|
|
353
|
-
data: unknown;
|
|
354
|
-
}): Promise<PayloadFindResponse<T>>;
|
|
355
|
-
/**
|
|
356
|
-
* Delete document
|
|
357
|
-
* DELETE /api/{collection}/{id}
|
|
358
|
-
*/
|
|
359
|
-
requestDelete<T = unknown>(endpoint: string): Promise<T>;
|
|
360
|
-
/**
|
|
361
|
-
* Delete multiple documents (bulk delete)
|
|
362
|
-
* DELETE /api/{collection}
|
|
363
|
-
*/
|
|
364
|
-
requestDeleteMany<T = unknown>(endpoint: string, data: {
|
|
365
|
-
where?: unknown;
|
|
366
|
-
}): Promise<PayloadFindResponse<T>>;
|
|
367
|
-
/**
|
|
368
|
-
* Create document with file upload
|
|
369
|
-
* POST /api/{collection} (multipart/form-data)
|
|
370
|
-
*/
|
|
371
|
-
requestCreateWithFile<T = unknown>(endpoint: string, data: unknown, file: File | Blob, filename?: string): Promise<PayloadMutationResponse<T>>;
|
|
372
|
-
/**
|
|
373
|
-
* Update document with file upload
|
|
374
|
-
* PATCH /api/{collection}/{id} (multipart/form-data)
|
|
375
|
-
*/
|
|
376
|
-
requestUpdateWithFile<T = unknown>(endpoint: string, data: unknown, file: File | Blob, filename?: string): Promise<PayloadMutationResponse<T>>;
|
|
377
|
-
}
|
|
378
|
-
declare class ServerCollectionClient extends CollectionClient<ServerCollection> {
|
|
379
|
-
from<T extends ServerCollection>(collection: T): ServerCollectionQueryBuilder<T>;
|
|
380
|
-
}
|
|
381
|
-
declare class ReadOnlyCollectionClient extends HttpClient {
|
|
382
|
-
from<T extends PublicCollection>(collection: T): ReadOnlyQueryBuilder<T>;
|
|
383
|
-
requestFind<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<PayloadFindResponse<T>>;
|
|
384
|
-
requestFindById<T = unknown>(endpoint: string, options?: ApiQueryOptions): Promise<T>;
|
|
385
|
-
requestCount(endpoint: string, options?: ApiQueryOptions): Promise<{
|
|
386
|
-
totalDocs: number;
|
|
387
|
-
}>;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
type ReadOnlyCollectionApi = Pick<CollectionClient, 'requestFind' | 'requestFindById' | 'requestCount'>;
|
|
391
|
-
/**
|
|
392
|
-
* Read-only subset of CollectionQueryBuilder.
|
|
393
|
-
* Client.from() returns this type to prevent write operations at compile time.
|
|
394
|
-
*/
|
|
395
|
-
type ReadOnlyQueryBuilder<T extends PublicCollection> = ReadOnlyCollectionQueryBuilder<T>;
|
|
396
|
-
declare class ReadOnlyCollectionQueryBuilder<T extends PublicCollection> {
|
|
397
|
-
private api;
|
|
398
|
-
private collection;
|
|
399
|
-
constructor(api: ReadOnlyCollectionApi, collection: T);
|
|
400
|
-
find(options?: ApiQueryOptions): Promise<PayloadFindResponse<CollectionType<T>>>;
|
|
401
|
-
findById(id: string | number, options?: ApiQueryOptions): Promise<CollectionType<T>>;
|
|
402
|
-
count(options?: ApiQueryOptions): Promise<{
|
|
403
|
-
totalDocs: number;
|
|
404
|
-
}>;
|
|
405
|
-
findMetadata(options?: ApiQueryOptions, metadataOptions?: GenerateMetadataOptions): Promise<Metadata | null>;
|
|
406
|
-
findMetadataById(id: string, metadataOptions?: GenerateMetadataOptions): Promise<Metadata>;
|
|
407
|
-
}
|
|
408
|
-
declare class CollectionQueryBuilder<T extends string> {
|
|
409
|
-
private api;
|
|
410
|
-
private collection;
|
|
411
|
-
constructor(api: CollectionClient, collection: T);
|
|
412
|
-
/**
|
|
413
|
-
* Find documents (list query)
|
|
414
|
-
* GET /api/{collection}
|
|
415
|
-
* @returns Payload CMS find response with docs array and pagination
|
|
416
|
-
*/
|
|
417
|
-
find(options?: ApiQueryOptions): Promise<PayloadFindResponse<CollectionType<T>>>;
|
|
418
|
-
/**
|
|
419
|
-
* Find document by ID
|
|
420
|
-
* GET /api/{collection}/{id}
|
|
421
|
-
* @returns Document object directly (no wrapper)
|
|
422
|
-
*/
|
|
423
|
-
findById(id: string | number, options?: ApiQueryOptions): Promise<CollectionType<T>>;
|
|
424
|
-
/**
|
|
425
|
-
* Create a new document
|
|
426
|
-
* POST /api/{collection}
|
|
427
|
-
* @returns Payload CMS mutation response with doc and message
|
|
428
|
-
*/
|
|
429
|
-
create(data: Partial<CollectionType<T>>, options?: {
|
|
430
|
-
file?: File | Blob;
|
|
431
|
-
filename?: string;
|
|
432
|
-
}): Promise<PayloadMutationResponse<CollectionType<T>>>;
|
|
433
|
-
/**
|
|
434
|
-
* Update a document by ID
|
|
435
|
-
* PATCH /api/{collection}/{id}
|
|
436
|
-
* @returns Payload CMS mutation response with doc and message
|
|
437
|
-
*/
|
|
438
|
-
update(id: string, data: Partial<CollectionType<T>>, options?: {
|
|
439
|
-
file?: File | Blob;
|
|
440
|
-
filename?: string;
|
|
441
|
-
}): Promise<PayloadMutationResponse<CollectionType<T>>>;
|
|
442
|
-
/**
|
|
443
|
-
* Count documents
|
|
444
|
-
* GET /api/{collection}/count
|
|
445
|
-
* @returns Count response with totalDocs
|
|
446
|
-
*/
|
|
447
|
-
count(options?: ApiQueryOptions): Promise<{
|
|
448
|
-
totalDocs: number;
|
|
449
|
-
}>;
|
|
450
|
-
/**
|
|
451
|
-
* Find first matching document and return its Next.js Metadata.
|
|
452
|
-
* Applies depth: 1 (SEO image populate) and limit: 1 automatically.
|
|
453
|
-
* @returns Metadata or null if no document matches
|
|
454
|
-
*/
|
|
455
|
-
findMetadata(options?: ApiQueryOptions, metadataOptions?: GenerateMetadataOptions): Promise<Metadata | null>;
|
|
456
|
-
/**
|
|
457
|
-
* Find document by ID and return its Next.js Metadata.
|
|
458
|
-
* Applies depth: 1 (SEO image populate) automatically.
|
|
459
|
-
* @returns Metadata (throws on 404)
|
|
460
|
-
*/
|
|
461
|
-
findMetadataById(id: string, metadataOptions?: GenerateMetadataOptions): Promise<Metadata>;
|
|
462
|
-
/**
|
|
463
|
-
* Update multiple documents (bulk update)
|
|
464
|
-
* PATCH /api/{collection}
|
|
465
|
-
* @returns Payload CMS find response with updated docs
|
|
466
|
-
*/
|
|
467
|
-
updateMany(where: ApiQueryOptions['where'], data: Partial<CollectionType<T>>): Promise<PayloadFindResponse<CollectionType<T>>>;
|
|
468
|
-
/**
|
|
469
|
-
* Delete a document by ID
|
|
470
|
-
* DELETE /api/{collection}/{id}
|
|
471
|
-
* @returns Deleted document object directly (no wrapper)
|
|
472
|
-
*/
|
|
473
|
-
remove(id: string): Promise<CollectionType<T>>;
|
|
474
|
-
/**
|
|
475
|
-
* Delete multiple documents (bulk delete)
|
|
476
|
-
* DELETE /api/{collection}
|
|
477
|
-
* @returns Payload CMS find response with deleted docs
|
|
478
|
-
*/
|
|
479
|
-
removeMany(where: ApiQueryOptions['where']): Promise<PayloadFindResponse<CollectionType<T>>>;
|
|
480
|
-
}
|
|
481
|
-
declare class ServerCollectionQueryBuilder<T extends ServerCollection> extends CollectionQueryBuilder<T> {
|
|
482
|
-
}
|
|
1
|
+
import { P as PublicCollection } from './const-BGCP-OJL.js';
|
|
2
|
+
import { P as PublicProduct, C as CollectionType } from './types-CVA10VC-.js';
|
|
3
|
+
import { O as Order, i as Cart, j as CartItem, m as OrderItem, n as Transaction, o as Fulfillment, p as Return } from './payload-types-Wa4-eC6x.js';
|
|
483
4
|
|
|
484
5
|
interface CommunityClientOptions {
|
|
485
6
|
publishableKey?: string;
|
|
486
7
|
secretKey?: string;
|
|
8
|
+
apiUrl?: string;
|
|
487
9
|
customerToken?: string | (() => string | null);
|
|
488
10
|
onUnauthorized?: () => Promise<string | null>;
|
|
489
11
|
onRequestId?: (id: string | null) => void;
|
|
@@ -551,6 +73,7 @@ interface PaginatedResponse<T> {
|
|
|
551
73
|
declare class CommunityClient {
|
|
552
74
|
private readonly publishableKey;
|
|
553
75
|
private readonly secretKey?;
|
|
76
|
+
private readonly apiUrl?;
|
|
554
77
|
private readonly customerToken?;
|
|
555
78
|
private readonly onUnauthorized?;
|
|
556
79
|
private readonly onRequestId?;
|
|
@@ -652,6 +175,7 @@ declare class CommunityClient {
|
|
|
652
175
|
interface ServerApiOptions {
|
|
653
176
|
publishableKey?: string;
|
|
654
177
|
secretKey: string;
|
|
178
|
+
apiUrl?: string;
|
|
655
179
|
onRequestId?: (id: string | null) => void;
|
|
656
180
|
}
|
|
657
181
|
interface RequestOptions {
|
|
@@ -661,39 +185,12 @@ interface RequestOptions {
|
|
|
661
185
|
declare abstract class BaseApi {
|
|
662
186
|
protected readonly publishableKey: string;
|
|
663
187
|
protected readonly secretKey: string;
|
|
188
|
+
protected readonly apiUrl?: string;
|
|
664
189
|
protected readonly onRequestId?: (id: string | null) => void;
|
|
665
190
|
constructor(apiName: string, options: ServerApiOptions);
|
|
666
191
|
protected request<T>(endpoint: string, body: unknown, options?: RequestOptions): Promise<T>;
|
|
667
192
|
}
|
|
668
193
|
|
|
669
|
-
type ModerationApiOptions = ServerApiOptions;
|
|
670
|
-
interface CommunityBan {
|
|
671
|
-
id: string;
|
|
672
|
-
customer: string;
|
|
673
|
-
isPermanent?: boolean;
|
|
674
|
-
bannedUntil?: string;
|
|
675
|
-
reason?: string;
|
|
676
|
-
createdAt?: string;
|
|
677
|
-
updatedAt?: string;
|
|
678
|
-
[key: string]: unknown;
|
|
679
|
-
}
|
|
680
|
-
type BanCustomerParams = {
|
|
681
|
-
customerId: string;
|
|
682
|
-
isPermanent?: boolean;
|
|
683
|
-
bannedUntil?: string;
|
|
684
|
-
reason?: string;
|
|
685
|
-
};
|
|
686
|
-
type UnbanCustomerParams = {
|
|
687
|
-
customerId: string;
|
|
688
|
-
};
|
|
689
|
-
declare class ModerationApi extends BaseApi {
|
|
690
|
-
constructor(options: ModerationApiOptions);
|
|
691
|
-
banCustomer(params: BanCustomerParams): Promise<CommunityBan>;
|
|
692
|
-
unbanCustomer(params: UnbanCustomerParams): Promise<{
|
|
693
|
-
success: true;
|
|
694
|
-
}>;
|
|
695
|
-
}
|
|
696
|
-
|
|
697
194
|
interface CustomerAuthResponse {
|
|
698
195
|
token: string;
|
|
699
196
|
customer: CustomerProfile;
|
|
@@ -768,7 +265,7 @@ declare class CustomerAuth {
|
|
|
768
265
|
private token;
|
|
769
266
|
private onTokenChange?;
|
|
770
267
|
private refreshPromise;
|
|
771
|
-
constructor(publishableKey: string, options?: CustomerAuthOptions);
|
|
268
|
+
constructor(publishableKey: string, options?: CustomerAuthOptions, apiUrl?: string);
|
|
772
269
|
/**
|
|
773
270
|
* Register a new customer account
|
|
774
271
|
*/
|
|
@@ -836,6 +333,7 @@ declare class CustomerAuth {
|
|
|
836
333
|
interface CartApiOptions {
|
|
837
334
|
publishableKey?: string;
|
|
838
335
|
secretKey?: string;
|
|
336
|
+
apiUrl?: string;
|
|
839
337
|
customerToken?: string | (() => string | null);
|
|
840
338
|
onUnauthorized?: () => Promise<string | null>;
|
|
841
339
|
onRequestId?: (id: string | null) => void;
|
|
@@ -867,6 +365,7 @@ type ClearCartParams = {
|
|
|
867
365
|
declare class CartApi {
|
|
868
366
|
private readonly publishableKey;
|
|
869
367
|
private readonly secretKey?;
|
|
368
|
+
private readonly apiUrl?;
|
|
870
369
|
private readonly customerToken?;
|
|
871
370
|
private readonly onUnauthorized?;
|
|
872
371
|
private readonly onRequestId?;
|
|
@@ -989,6 +488,31 @@ type ProductListingGroup<TVariant extends ProductVariantShape = ProductVariantSh
|
|
|
989
488
|
variants: TVariant[];
|
|
990
489
|
listing: ProductListingProjection;
|
|
991
490
|
};
|
|
491
|
+
type ProductListingCardPriceRange = {
|
|
492
|
+
minPrice: number | null;
|
|
493
|
+
maxPrice: number | null;
|
|
494
|
+
minCompareAtPrice: number | null;
|
|
495
|
+
maxCompareAtPrice: number | null;
|
|
496
|
+
isPriceRange: boolean;
|
|
497
|
+
};
|
|
498
|
+
type ProductListingSwatch = {
|
|
499
|
+
optionId: EntityID;
|
|
500
|
+
optionValueId: EntityID;
|
|
501
|
+
label: string;
|
|
502
|
+
swatchColor: string | null;
|
|
503
|
+
thumbnail: ProductDetailMedia | null;
|
|
504
|
+
href: string;
|
|
505
|
+
availableForSale: boolean;
|
|
506
|
+
};
|
|
507
|
+
type ProductListingCard = {
|
|
508
|
+
id: EntityID;
|
|
509
|
+
href: string;
|
|
510
|
+
title: string;
|
|
511
|
+
primaryImage: ProductDetailMedia | null;
|
|
512
|
+
priceRange: ProductListingCardPriceRange;
|
|
513
|
+
availableForSale: boolean;
|
|
514
|
+
swatches: ProductListingSwatch[];
|
|
515
|
+
};
|
|
992
516
|
type ProductSelectionByOptionValue = string | number | null | undefined | {
|
|
993
517
|
valueId?: string | number | null;
|
|
994
518
|
valueSlug?: string | null;
|
|
@@ -1006,21 +530,31 @@ type NormalizedProductSelection = {
|
|
|
1006
530
|
valueIds: string[];
|
|
1007
531
|
variantId: string | null;
|
|
1008
532
|
};
|
|
1009
|
-
type
|
|
533
|
+
type CompatibilityProductSelectionParamEvent = {
|
|
1010
534
|
optionId: string;
|
|
1011
535
|
optionSlug: string;
|
|
1012
536
|
valueSlug: string;
|
|
1013
537
|
searchParam: string;
|
|
1014
538
|
};
|
|
539
|
+
type LegacyProductSelectionParamEvent = CompatibilityProductSelectionParamEvent;
|
|
1015
540
|
type ProductSelectionCodecOptions = {
|
|
541
|
+
onCompatibilityOptionIdParam?: (event: CompatibilityProductSelectionParamEvent) => void;
|
|
1016
542
|
onLegacyOptionIdParam?: (event: LegacyProductSelectionParamEvent) => void;
|
|
1017
543
|
};
|
|
544
|
+
type ProductSelectionResolutionContext = {
|
|
545
|
+
detail?: Pick<ProductDetail, 'images' | 'listing'>;
|
|
546
|
+
images?: ProductDetail['images'];
|
|
547
|
+
listing?: ProductDetail['listing'];
|
|
548
|
+
};
|
|
1018
549
|
type ProductSelectionAvailableValue = {
|
|
1019
550
|
valueId: string;
|
|
1020
551
|
value: string;
|
|
1021
552
|
slug: string;
|
|
1022
553
|
selected: boolean;
|
|
1023
554
|
available: boolean;
|
|
555
|
+
availableForSale: boolean;
|
|
556
|
+
isUnlimited: boolean;
|
|
557
|
+
availableStock: number | null;
|
|
1024
558
|
swatchColor?: string | null;
|
|
1025
559
|
thumbnail?: MediaValue;
|
|
1026
560
|
images?: MediaValue[] | null;
|
|
@@ -1066,14 +600,49 @@ declare function normalizeSelectedValueIds<TVariant extends ProductVariantShape
|
|
|
1066
600
|
declare function getAvailableOptionValues<TVariant extends ProductVariantShape = ProductVariantShape>(matrix: ProductOptionMatrix<TVariant>, optionId: string, selectedValueIds: Iterable<unknown>): ProductOptionMatrixValue[];
|
|
1067
601
|
declare function resolveVariantForSelection<TVariant extends ProductVariantShape = ProductVariantShape>(matrix: ProductOptionMatrix<TVariant>, selectedValueIds: Iterable<unknown>): ProductOptionMatrixVariant<TVariant> | undefined;
|
|
1068
602
|
declare function normalizeProductSelection(detail: ProductDetail, selection?: ProductSelectionInput, options?: ProductSelectionCodecOptions): NormalizedProductSelection;
|
|
603
|
+
declare function normalizeProductSelectionFromMatrix(matrix: ProductOptionMatrix<ProductDetailVariant>, selection?: ProductSelectionInput, options?: ProductSelectionCodecOptions): NormalizedProductSelection;
|
|
1069
604
|
declare function parseProductSelection(detail: ProductDetail, search: string | URLSearchParams | URL | null | undefined, options?: ProductSelectionCodecOptions): NormalizedProductSelection;
|
|
1070
605
|
declare function stringifyProductSelection(detail: ProductDetail, selection?: ProductSelectionInput, options?: ProductSelectionCodecOptions): string;
|
|
1071
606
|
declare function createProductSelectionCodec(detail: ProductDetail, options?: ProductSelectionCodecOptions): {
|
|
1072
607
|
parse: (search: string | URLSearchParams | URL | null | undefined) => NormalizedProductSelection;
|
|
1073
608
|
stringify: (selection?: ProductSelectionInput) => string;
|
|
1074
609
|
};
|
|
610
|
+
declare function resolveProductSelectionFromMatrix(matrix: ProductOptionMatrix<ProductDetailVariant>, selection?: ProductSelectionInput, options?: ProductSelectionCodecOptions, context?: ProductSelectionResolutionContext): ProductSelectionResolution;
|
|
1075
611
|
declare function resolveProductSelection(detail: ProductDetail, selection?: ProductSelectionInput, options?: ProductSelectionCodecOptions): ProductSelectionResolution;
|
|
612
|
+
type ProductDetailImageMedia = Extract<ProductDetailMedia, {
|
|
613
|
+
id?: string | number | null;
|
|
614
|
+
url?: string | null;
|
|
615
|
+
}>;
|
|
616
|
+
declare function getProductSelectionImages(resolution: Pick<ProductSelectionResolution, 'media'>): ProductDetailImageMedia[];
|
|
617
|
+
type ProductHrefProduct = ProductDetail | {
|
|
618
|
+
slug?: string | null;
|
|
619
|
+
product?: {
|
|
620
|
+
slug?: string | null;
|
|
621
|
+
} | null;
|
|
622
|
+
};
|
|
623
|
+
type ProductHrefGroup = {
|
|
624
|
+
optionId?: string | number | null;
|
|
625
|
+
optionSlug?: string | null;
|
|
626
|
+
optionValueId?: string | number | null;
|
|
627
|
+
optionValueSlug?: string | null;
|
|
628
|
+
variantId?: string | number | null;
|
|
629
|
+
listing?: {
|
|
630
|
+
selectionHintVariant?: string | number | null;
|
|
631
|
+
} | null;
|
|
632
|
+
};
|
|
633
|
+
type ProductHrefOptions = {
|
|
634
|
+
basePath?: string;
|
|
635
|
+
detail?: ProductDetail;
|
|
636
|
+
matrix?: ProductOptionMatrix<ProductDetailVariant>;
|
|
637
|
+
selection?: ProductSelectionInput;
|
|
638
|
+
trailingSlash?: boolean;
|
|
639
|
+
};
|
|
640
|
+
declare function buildProductHref(product: ProductHrefProduct, group?: ProductHrefGroup | null, options?: ProductHrefOptions): string;
|
|
1076
641
|
declare function buildProductListingProjection(product: ProductListingProductShape | null | undefined, variants: ProductVariantShape[]): ProductListingProjection;
|
|
642
|
+
declare function buildProductListingCard(item: ProductListingGroupsItem, options?: {
|
|
643
|
+
basePath?: string;
|
|
644
|
+
trailingSlash?: boolean;
|
|
645
|
+
}): ProductListingCard;
|
|
1077
646
|
/**
|
|
1078
647
|
* Builds product-first listing groups for one primary option.
|
|
1079
648
|
*
|
|
@@ -1110,8 +679,13 @@ type ListingGroupsParams = {
|
|
|
1110
679
|
productIds: string[];
|
|
1111
680
|
};
|
|
1112
681
|
type ProductListingGroupSummary = Omit<ProductListingGroup, 'variants'>;
|
|
682
|
+
type ProductListingGroupsProduct = PublicProduct & {
|
|
683
|
+
id: string;
|
|
684
|
+
slug: string;
|
|
685
|
+
title: string;
|
|
686
|
+
};
|
|
1113
687
|
type ProductListingGroupsItem = {
|
|
1114
|
-
product:
|
|
688
|
+
product: ProductListingGroupsProduct;
|
|
1115
689
|
primaryOptionId: string | null;
|
|
1116
690
|
groups: ProductListingGroupSummary[];
|
|
1117
691
|
};
|
|
@@ -1123,6 +697,12 @@ type ProductDetailParams = {
|
|
|
1123
697
|
} | {
|
|
1124
698
|
id: string;
|
|
1125
699
|
};
|
|
700
|
+
type ProductDetailPreviewParams = {
|
|
701
|
+
id: string;
|
|
702
|
+
};
|
|
703
|
+
type ProductDetailPreviewOptions = {
|
|
704
|
+
previewToken: string;
|
|
705
|
+
};
|
|
1126
706
|
interface ProductDetailVariantOptionValue {
|
|
1127
707
|
optionId: string | number;
|
|
1128
708
|
optionSlug: string;
|
|
@@ -1275,7 +855,7 @@ type ProductUpsertParams = {
|
|
|
1275
855
|
};
|
|
1276
856
|
type ProductUpsertResponse = {
|
|
1277
857
|
ok: true;
|
|
1278
|
-
product:
|
|
858
|
+
product: PublicProduct;
|
|
1279
859
|
} | {
|
|
1280
860
|
ok: false;
|
|
1281
861
|
failedEntity: 'product' | 'option' | 'option-value' | 'variant';
|
|
@@ -1485,17 +1065,19 @@ declare class OrderApi extends BaseApi {
|
|
|
1485
1065
|
updateReturn(params: UpdateReturnParams): Promise<Return>;
|
|
1486
1066
|
}
|
|
1487
1067
|
|
|
1488
|
-
interface
|
|
1489
|
-
publishableKey
|
|
1490
|
-
|
|
1068
|
+
interface CommerceClientOptions {
|
|
1069
|
+
publishableKey: string;
|
|
1070
|
+
apiUrl?: string;
|
|
1071
|
+
customerToken: () => string | null;
|
|
1072
|
+
onUnauthorized?: () => Promise<string | null>;
|
|
1491
1073
|
onRequestId?: (id: string | null) => void;
|
|
1074
|
+
customerAuth: CustomerAuth;
|
|
1492
1075
|
}
|
|
1493
|
-
declare class
|
|
1076
|
+
declare class CommerceClient {
|
|
1494
1077
|
readonly product: {
|
|
1495
1078
|
stockCheck: (params: StockCheckParams) => Promise<StockCheckResponse>;
|
|
1496
1079
|
listingGroups: (params: ListingGroupsParams) => Promise<ProductListingGroupsResponse>;
|
|
1497
1080
|
detail: (params: ProductDetailParams) => Promise<ProductDetail | null>;
|
|
1498
|
-
upsert: (params: ProductUpsertParams) => Promise<ProductUpsertResponse>;
|
|
1499
1081
|
};
|
|
1500
1082
|
readonly cart: {
|
|
1501
1083
|
get: (cartId: string) => Promise<Cart>;
|
|
@@ -1512,19 +1094,11 @@ declare class ServerCommerceClient {
|
|
|
1512
1094
|
};
|
|
1513
1095
|
readonly orders: {
|
|
1514
1096
|
checkout: (params: CheckoutParams) => Promise<Order>;
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
updateFulfillment: (params: UpdateFulfillmentParams) => Promise<Fulfillment>;
|
|
1521
|
-
bulkImportFulfillments: (params: BulkImportFulfillmentsParams) => Promise<BulkImportFulfillmentsResponse>;
|
|
1522
|
-
createReturn: (params: CreateReturnParams) => Promise<Return>;
|
|
1523
|
-
updateReturn: (params: UpdateReturnParams) => Promise<Return>;
|
|
1524
|
-
returnWithRefund: (params: ReturnWithRefundParams) => Promise<{
|
|
1525
|
-
return: Return;
|
|
1526
|
-
transaction: Transaction | null;
|
|
1527
|
-
}>;
|
|
1097
|
+
listMine: (options?: {
|
|
1098
|
+
page?: number;
|
|
1099
|
+
limit?: number;
|
|
1100
|
+
status?: string;
|
|
1101
|
+
}) => Promise<PayloadFindResponse<Order>>;
|
|
1528
1102
|
};
|
|
1529
1103
|
readonly discounts: {
|
|
1530
1104
|
validate: (params: ValidateDiscountParams) => Promise<ValidateDiscountResult>;
|
|
@@ -1532,231 +1106,184 @@ declare class ServerCommerceClient {
|
|
|
1532
1106
|
readonly shipping: {
|
|
1533
1107
|
calculate: (params: CalculateShippingParams) => Promise<CalculateShippingResult>;
|
|
1534
1108
|
};
|
|
1535
|
-
constructor(options:
|
|
1109
|
+
constructor(options: CommerceClientOptions);
|
|
1536
1110
|
}
|
|
1537
1111
|
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
options?: ApiQueryOptions;
|
|
1546
|
-
}
|
|
1547
|
-
interface CollectionInfiniteQueryParams<T extends PublicCollection> {
|
|
1548
|
-
collection: T;
|
|
1549
|
-
options?: Omit<ApiQueryOptions, 'page'>;
|
|
1550
|
-
pageSize?: number;
|
|
1112
|
+
/**
|
|
1113
|
+
* Customer namespace. Currently exposes .auth; reserved for future customer-
|
|
1114
|
+
* scoped capabilities (addresses, preferences, etc.).
|
|
1115
|
+
*/
|
|
1116
|
+
declare class CustomerNamespace {
|
|
1117
|
+
readonly auth: CustomerAuth;
|
|
1118
|
+
constructor(publishableKey: string, options?: CustomerAuthOptions, apiUrl?: string);
|
|
1551
1119
|
}
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1120
|
+
|
|
1121
|
+
interface ClientConfig {
|
|
1122
|
+
publishableKey: string;
|
|
1123
|
+
/** API base URL for staging, self-hosted, preview, or proxy deployments. */
|
|
1124
|
+
apiUrl?: string;
|
|
1125
|
+
/**
|
|
1126
|
+
* Customer authentication options.
|
|
1127
|
+
* Used to initialize CustomerAuth on Client.
|
|
1128
|
+
*/
|
|
1129
|
+
customer?: {
|
|
1130
|
+
/**
|
|
1131
|
+
* Persist token in localStorage. Defaults to `true`.
|
|
1132
|
+
* - `true` (default): uses key `'customer-token'`
|
|
1133
|
+
* - `string`: uses the given string as localStorage key
|
|
1134
|
+
* - `false`: disables persistence (token/onTokenChange used instead)
|
|
1135
|
+
*
|
|
1136
|
+
* Handles SSR safely (no-op on server).
|
|
1137
|
+
* When enabled, `token` and `onTokenChange` are ignored.
|
|
1138
|
+
*/
|
|
1139
|
+
persist?: boolean | string;
|
|
1140
|
+
/** Initial token (e.g. from SSR cookie) */
|
|
1141
|
+
token?: string;
|
|
1142
|
+
/** Called when token changes (login/logout) — use to persist in localStorage/cookie */
|
|
1143
|
+
onTokenChange?: (token: string | null) => void;
|
|
1144
|
+
};
|
|
1564
1145
|
}
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
enabled?: boolean;
|
|
1568
|
-
staleTime?: number;
|
|
1569
|
-
gcTime?: number;
|
|
1570
|
-
refetchOnWindowFocus?: boolean;
|
|
1571
|
-
refetchOnMount?: boolean | 'always';
|
|
1572
|
-
refetchInterval?: number | false;
|
|
1573
|
-
retry?: boolean | number;
|
|
1574
|
-
select?: (data: InfiniteData<TQueryFnData>) => TData;
|
|
1146
|
+
interface ClientServerConfig extends ClientConfig {
|
|
1147
|
+
secretKey: string;
|
|
1575
1148
|
}
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
onError?: (error: SDKError) => void;
|
|
1580
|
-
onSettled?: () => void;
|
|
1149
|
+
interface ClientMetadata {
|
|
1150
|
+
userAgent?: string;
|
|
1151
|
+
timestamp: number;
|
|
1581
1152
|
}
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
protected collectionClient: CollectionClient;
|
|
1585
|
-
constructor(queryClient: QueryClient, collectionClient: CollectionClient);
|
|
1586
|
-
useQuery<T extends PublicCollection, TData = PayloadFindResponse<CollectionType<T>>>(params: CollectionQueryParams<T>, options?: QueryOptions<PayloadFindResponse<CollectionType<T>>, TData>): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<TData>, Error>;
|
|
1587
|
-
useSuspenseQuery<T extends PublicCollection, TData = PayloadFindResponse<CollectionType<T>>>(params: CollectionQueryParams<T>, options?: SuspenseQueryOptions<PayloadFindResponse<CollectionType<T>>, TData>): _tanstack_react_query.UseSuspenseQueryResult<TData, Error>;
|
|
1588
|
-
useQueryById<T extends PublicCollection, TData = CollectionType<T>>(params: CollectionDetailQueryParams<T>, options?: QueryOptions<CollectionType<T>, TData>): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<TData>, Error>;
|
|
1589
|
-
useSuspenseQueryById<T extends PublicCollection, TData = CollectionType<T>>(params: CollectionDetailQueryParams<T>, options?: SuspenseQueryOptions<CollectionType<T>, TData>): _tanstack_react_query.UseSuspenseQueryResult<TData, Error>;
|
|
1590
|
-
useInfiniteQuery<T extends PublicCollection, TData = InfiniteData<PayloadFindResponse<CollectionType<T>>>>(params: CollectionInfiniteQueryParams<T>, options?: InfiniteQueryOptions<PayloadFindResponse<CollectionType<T>>, TData>): _tanstack_react_query.UseInfiniteQueryResult<TData, Error>;
|
|
1591
|
-
useSuspenseInfiniteQuery<T extends PublicCollection, TData = InfiniteData<PayloadFindResponse<CollectionType<T>>>>(params: CollectionInfiniteQueryParams<T>, options?: SuspenseInfiniteQueryOptions<PayloadFindResponse<CollectionType<T>>, TData>): _tanstack_react_query.UseSuspenseInfiniteQueryResult<TData, Error>;
|
|
1592
|
-
prefetchQuery<T extends PublicCollection>(params: CollectionQueryParams<T>, options?: {
|
|
1593
|
-
staleTime?: number;
|
|
1594
|
-
}): Promise<void>;
|
|
1595
|
-
prefetchQueryById<T extends PublicCollection>(params: CollectionDetailQueryParams<T>, options?: {
|
|
1596
|
-
staleTime?: number;
|
|
1597
|
-
}): Promise<void>;
|
|
1598
|
-
prefetchInfiniteQuery<T extends PublicCollection>(params: CollectionInfiniteQueryParams<T>, options?: {
|
|
1599
|
-
pages?: number;
|
|
1600
|
-
staleTime?: number;
|
|
1601
|
-
}): Promise<void>;
|
|
1602
|
-
useCreate<T extends PublicCollection>(params: {
|
|
1603
|
-
collection: T;
|
|
1604
|
-
}, options?: MutationCallbacks$1<PayloadMutationResponse<CollectionType<T>>>): _tanstack_react_query.UseMutationResult<PayloadMutationResponse<CollectionType<T>>, SDKError, {
|
|
1605
|
-
data: Partial<CollectionType<T>>;
|
|
1606
|
-
file?: File | Blob;
|
|
1607
|
-
filename?: string;
|
|
1608
|
-
}, unknown>;
|
|
1609
|
-
useUpdate<T extends PublicCollection>(params: {
|
|
1610
|
-
collection: T;
|
|
1611
|
-
}, options?: MutationCallbacks$1<PayloadMutationResponse<CollectionType<T>>>): _tanstack_react_query.UseMutationResult<PayloadMutationResponse<CollectionType<T>>, SDKError, {
|
|
1612
|
-
id: string;
|
|
1613
|
-
data: Partial<CollectionType<T>>;
|
|
1614
|
-
file?: File | Blob;
|
|
1615
|
-
filename?: string;
|
|
1616
|
-
}, unknown>;
|
|
1617
|
-
useRemove<T extends PublicCollection>(params: {
|
|
1618
|
-
collection: T;
|
|
1619
|
-
}, options?: MutationCallbacks$1<CollectionType<T>>): _tanstack_react_query.UseMutationResult<CollectionType<T>, SDKError, string, unknown>;
|
|
1620
|
-
invalidateQueries<T extends PublicCollection>(collection: T, type?: 'list' | 'detail' | 'infinite'): Promise<void>;
|
|
1621
|
-
getQueryData<T extends PublicCollection>(collection: T, type: 'list', options?: ApiQueryOptions): PayloadFindResponse<CollectionType<T>> | undefined;
|
|
1622
|
-
getQueryData<T extends PublicCollection>(collection: T, type: 'detail', id: string, options?: ApiQueryOptions): CollectionType<T> | null | undefined;
|
|
1623
|
-
setQueryData<T extends PublicCollection>(collection: T, type: 'list', data: PayloadFindResponse<CollectionType<T>>, options?: ApiQueryOptions): void;
|
|
1624
|
-
setQueryData<T extends PublicCollection>(collection: T, type: 'detail', id: string, data: CollectionType<T> | null, options?: ApiQueryOptions): void;
|
|
1153
|
+
interface ClientState {
|
|
1154
|
+
metadata: ClientMetadata;
|
|
1625
1155
|
}
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1156
|
+
/**
|
|
1157
|
+
* Payload CMS Find (List) Response
|
|
1158
|
+
* GET /api/{collection}
|
|
1159
|
+
*/
|
|
1160
|
+
interface PayloadFindResponse<T = unknown> {
|
|
1161
|
+
docs: T[];
|
|
1162
|
+
totalDocs: number;
|
|
1163
|
+
limit: number;
|
|
1164
|
+
totalPages: number;
|
|
1165
|
+
page: number;
|
|
1166
|
+
pagingCounter: number;
|
|
1167
|
+
hasPrevPage: boolean;
|
|
1168
|
+
hasNextPage: boolean;
|
|
1169
|
+
prevPage: number | null;
|
|
1170
|
+
nextPage: number | null;
|
|
1631
1171
|
}
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
gcTime?: number;
|
|
1642
|
-
refetchOnWindowFocus?: boolean;
|
|
1643
|
-
refetchOnMount?: boolean | 'always';
|
|
1644
|
-
refetchInterval?: number | false;
|
|
1645
|
-
retry?: boolean | number;
|
|
1646
|
-
}): _tanstack_react_query.UseQueryResult<CustomerProfile | null, Error>;
|
|
1647
|
-
useCustomerLogin(options?: MutationCallbacks<CustomerAuthResponse>): _tanstack_react_query.UseMutationResult<CustomerAuthResponse, SDKError, CustomerLoginData, unknown>;
|
|
1648
|
-
useCustomerRegister(options?: MutationCallbacks<{
|
|
1649
|
-
customer: CustomerProfile;
|
|
1650
|
-
}>): _tanstack_react_query.UseMutationResult<CustomerRegisterResponse, SDKError, CustomerRegisterData, unknown>;
|
|
1651
|
-
useCustomerLogout(options?: MutationCallbacks<void>): _tanstack_react_query.UseMutationResult<void, SDKError, void, unknown>;
|
|
1652
|
-
useCustomerForgotPassword(options?: MutationCallbacks<void>): _tanstack_react_query.UseMutationResult<void, SDKError, string, unknown>;
|
|
1653
|
-
useCustomerResetPassword(options?: MutationCallbacks<void>): _tanstack_react_query.UseMutationResult<void, SDKError, {
|
|
1654
|
-
token: string;
|
|
1655
|
-
password: string;
|
|
1656
|
-
}, unknown>;
|
|
1657
|
-
useCustomerRefreshToken(options?: MutationCallbacks<CustomerRefreshResponse>): _tanstack_react_query.UseMutationResult<CustomerRefreshResponse, SDKError, unknown, unknown>;
|
|
1658
|
-
useCustomerUpdateProfile(options?: MutationCallbacks<CustomerProfile>): _tanstack_react_query.UseMutationResult<CustomerProfile, SDKError, UpdateProfileData, unknown>;
|
|
1659
|
-
useCustomerChangePassword(options?: MutationCallbacks<void>): _tanstack_react_query.UseMutationResult<void, SDKError, {
|
|
1660
|
-
currentPassword: string;
|
|
1661
|
-
newPassword: string;
|
|
1662
|
-
}, unknown>;
|
|
1663
|
-
invalidateCustomerQueries(): Promise<void>;
|
|
1664
|
-
getCustomerData(): CustomerProfile | null | undefined;
|
|
1665
|
-
setCustomerData(data: CustomerProfile | null): void;
|
|
1172
|
+
/**
|
|
1173
|
+
* Payload CMS Create/Update Response
|
|
1174
|
+
* POST /api/{collection}
|
|
1175
|
+
* PATCH /api/{collection}/{id}
|
|
1176
|
+
*/
|
|
1177
|
+
interface PayloadMutationResponse<T = unknown> {
|
|
1178
|
+
message: string;
|
|
1179
|
+
doc: T;
|
|
1180
|
+
errors?: unknown[];
|
|
1666
1181
|
}
|
|
1667
|
-
|
|
1668
|
-
type
|
|
1669
|
-
type ReadOnlyQueryHooks = Omit<QueryHooks, 'useCreate' | 'useUpdate' | 'useRemove'>;
|
|
1182
|
+
type Sort = string | string[];
|
|
1183
|
+
type Where = Record<string, unknown>;
|
|
1670
1184
|
/**
|
|
1671
|
-
*
|
|
1672
|
-
*
|
|
1185
|
+
* Do NOT replace with `Pick<FindOptions>` from `payload` or import Payload
|
|
1186
|
+
* types here. Payload's generic query types depend on `PayloadTypes` module
|
|
1187
|
+
* augmentation; external SDK consumers who only use `createClient` should not
|
|
1188
|
+
* install Payload just to type REST query objects. Excluded vs native:
|
|
1189
|
+
* Local-API-only fields, `locale`/`fallbackLocale`.
|
|
1673
1190
|
*/
|
|
1674
|
-
interface
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1191
|
+
interface ApiQueryOptions {
|
|
1192
|
+
page?: number;
|
|
1193
|
+
limit?: number;
|
|
1194
|
+
sort?: Sort;
|
|
1195
|
+
/**
|
|
1196
|
+
* Filter documents. Id-based relation filters (`where: { product: { equals: id } }`) are the
|
|
1197
|
+
* most reliable pattern. Dotted-path relation filters (`where: { 'product.slug': { equals } }`)
|
|
1198
|
+
* are Payload-native but may silently return empty when access control restricts the related
|
|
1199
|
+
* document or when the relation is polymorphic. String shorthand (`where: { slug: 'x' }`)
|
|
1200
|
+
* silently matches nothing — always use `{ slug: { equals: 'x' } }`.
|
|
1201
|
+
*/
|
|
1202
|
+
where?: Where;
|
|
1203
|
+
/**
|
|
1204
|
+
* Controls how deeply relationship fields are populated. This is the primary control for
|
|
1205
|
+
* populating relationships like `category`, `images`, `brand`. The configured Payload default
|
|
1206
|
+
* applies when unset.
|
|
1207
|
+
*/
|
|
1208
|
+
depth?: number;
|
|
1209
|
+
select?: Record<string, boolean>;
|
|
1210
|
+
/**
|
|
1211
|
+
* Controls which fields are returned for already-populated relationships, keyed by collection
|
|
1212
|
+
* slug. Does NOT control which relationships to populate — that is `depth`.
|
|
1213
|
+
*
|
|
1214
|
+
* @example
|
|
1215
|
+
* // depth: 2 populates category; populate trims which fields come back
|
|
1216
|
+
* populate: { categories: { title: true, slug: true } }
|
|
1217
|
+
*/
|
|
1218
|
+
populate?: Record<string, boolean | Record<string, boolean>>;
|
|
1219
|
+
/**
|
|
1220
|
+
* Controls Payload `type: 'join'` virtual reverse-relation fields only (pagination, sort,
|
|
1221
|
+
* filter, count per join field, or `false` to disable all join-field population).
|
|
1222
|
+
*
|
|
1223
|
+
* Does NOT populate normal relationship fields like `category`, `images`, or `brand`.
|
|
1224
|
+
* For normal relationship population use `depth` (and optionally `populate` for field
|
|
1225
|
+
* selection).
|
|
1226
|
+
*
|
|
1227
|
+
* Pass `joins: false` to disable all join-field population — useful for lightweight list
|
|
1228
|
+
* queries where join fields are not needed.
|
|
1229
|
+
*
|
|
1230
|
+
* @example
|
|
1231
|
+
* // `article-authors` has a `type: 'join'` field `articles` (reverse-relation)
|
|
1232
|
+
* joins: { articles: { limit: 10, sort: '-publishedAt' } }
|
|
1233
|
+
*
|
|
1234
|
+
* // depth: 2 populates product.category — joins has no effect on this
|
|
1235
|
+
* depth: 2
|
|
1236
|
+
*
|
|
1237
|
+
* // Disable all join-field population
|
|
1238
|
+
* joins: false
|
|
1239
|
+
*/
|
|
1240
|
+
joins?: Record<string, {
|
|
1241
|
+
limit?: number;
|
|
1242
|
+
page?: number;
|
|
1243
|
+
sort?: string;
|
|
1244
|
+
where?: Where;
|
|
1245
|
+
count?: boolean;
|
|
1246
|
+
} | false> | false;
|
|
1247
|
+
/** Set to `false` to skip the count query — returns docs without totalDocs/totalPages */
|
|
1248
|
+
pagination?: boolean;
|
|
1249
|
+
/** Include draft versions (access control still applies on the server) */
|
|
1250
|
+
draft?: boolean;
|
|
1251
|
+
/** Include soft-deleted documents (requires `trash` enabled on the collection) */
|
|
1252
|
+
trash?: boolean;
|
|
1678
1253
|
}
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
useCustomerMe: CustomerHooks['useCustomerMe'];
|
|
1684
|
-
useCustomerLogin: CustomerHooks['useCustomerLogin'];
|
|
1685
|
-
useCustomerRegister: CustomerHooks['useCustomerRegister'];
|
|
1686
|
-
useCustomerLogout: CustomerHooks['useCustomerLogout'];
|
|
1687
|
-
useCustomerForgotPassword: CustomerHooks['useCustomerForgotPassword'];
|
|
1688
|
-
useCustomerResetPassword: CustomerHooks['useCustomerResetPassword'];
|
|
1689
|
-
useCustomerRefreshToken: CustomerHooks['useCustomerRefreshToken'];
|
|
1690
|
-
useCustomerUpdateProfile: CustomerHooks['useCustomerUpdateProfile'];
|
|
1691
|
-
useCustomerChangePassword: CustomerHooks['useCustomerChangePassword'];
|
|
1692
|
-
invalidateCustomerQueries: CustomerHooks['invalidateCustomerQueries'];
|
|
1693
|
-
getCustomerData: CustomerHooks['getCustomerData'];
|
|
1694
|
-
setCustomerData: CustomerHooks['setCustomerData'];
|
|
1695
|
-
useProductListingGroupsQuery<TData = PayloadFindResponse<ProductListingGroupsItem>>(params: {
|
|
1696
|
-
options?: ProductListingGroupsQueryOptions;
|
|
1697
|
-
}, options?: QueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): UseQueryResult<_tanstack_react_query.NoInfer<TData>, Error>;
|
|
1698
|
-
useSuspenseProductListingGroupsQuery<TData = PayloadFindResponse<ProductListingGroupsItem>>(params: {
|
|
1699
|
-
options?: ProductListingGroupsQueryOptions;
|
|
1700
|
-
}, options?: SuspenseQueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): _tanstack_react_query.UseSuspenseQueryResult<TData, Error>;
|
|
1701
|
-
useInfiniteProductListingGroupsQuery<TData = InfiniteData<PayloadFindResponse<ProductListingGroupsItem>>>(params: {
|
|
1702
|
-
options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>;
|
|
1703
|
-
pageSize?: number;
|
|
1704
|
-
}, options?: InfiniteQueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): _tanstack_react_query.UseInfiniteQueryResult<TData, Error>;
|
|
1705
|
-
useSuspenseInfiniteProductListingGroupsQuery<TData = InfiniteData<PayloadFindResponse<ProductListingGroupsItem>>>(params: {
|
|
1706
|
-
options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>;
|
|
1707
|
-
pageSize?: number;
|
|
1708
|
-
}, options?: SuspenseInfiniteQueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): _tanstack_react_query.UseSuspenseInfiniteQueryResult<TData, Error>;
|
|
1709
|
-
prefetchProductListingGroupsQuery(params: {
|
|
1710
|
-
options?: ProductListingGroupsQueryOptions;
|
|
1711
|
-
}, options?: {
|
|
1712
|
-
staleTime?: number;
|
|
1713
|
-
}): Promise<void>;
|
|
1714
|
-
prefetchInfiniteProductListingGroupsQuery(params: {
|
|
1715
|
-
options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>;
|
|
1716
|
-
pageSize?: number;
|
|
1717
|
-
}, options?: {
|
|
1718
|
-
pages?: number;
|
|
1719
|
-
staleTime?: number;
|
|
1720
|
-
}): Promise<void>;
|
|
1721
|
-
useProductDetail(params: {
|
|
1722
|
-
slug: string;
|
|
1723
|
-
} | {
|
|
1724
|
-
id: string;
|
|
1725
|
-
}, options?: {
|
|
1726
|
-
enabled?: boolean;
|
|
1727
|
-
}): UseQueryResult<ProductDetail | null>;
|
|
1728
|
-
useProductDetailBySlug(slug: string, options?: {
|
|
1729
|
-
enabled?: boolean;
|
|
1730
|
-
}): UseQueryResult<ProductDetail | null>;
|
|
1731
|
-
useProductDetailById(id: string, options?: {
|
|
1732
|
-
enabled?: boolean;
|
|
1733
|
-
}): UseQueryResult<ProductDetail | null>;
|
|
1254
|
+
interface DebugConfig {
|
|
1255
|
+
logRequests?: boolean;
|
|
1256
|
+
logResponses?: boolean;
|
|
1257
|
+
logErrors?: boolean;
|
|
1734
1258
|
}
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
}
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1259
|
+
interface RetryConfig {
|
|
1260
|
+
maxRetries?: number;
|
|
1261
|
+
retryableStatuses?: number[];
|
|
1262
|
+
retryDelay?: (attempt: number) => number;
|
|
1263
|
+
}
|
|
1264
|
+
interface RootQueryLookup<T extends string> {
|
|
1265
|
+
find(options?: ApiQueryOptions): Promise<PayloadFindResponse<CollectionType<T>>>;
|
|
1266
|
+
findById(id: string | number, options?: ApiQueryOptions): Promise<CollectionType<T>>;
|
|
1267
|
+
count(options?: ApiQueryOptions): Promise<{
|
|
1268
|
+
totalDocs: number;
|
|
1269
|
+
}>;
|
|
1270
|
+
}
|
|
1271
|
+
type RootReadOnlyQueryBuilder<T extends PublicCollection> = RootQueryLookup<T>;
|
|
1272
|
+
interface RootCollectionClient {
|
|
1273
|
+
from<T extends PublicCollection>(collection: T): RootReadOnlyQueryBuilder<T>;
|
|
1274
|
+
}
|
|
1275
|
+
interface RootClient {
|
|
1276
|
+
commerce: CommerceClient;
|
|
1277
|
+
community: CommunityClient;
|
|
1278
|
+
customer: CustomerNamespace;
|
|
1279
|
+
collections: RootCollectionClient;
|
|
1749
1280
|
lastRequestId: string | null;
|
|
1750
|
-
protected state: ClientState;
|
|
1751
|
-
protected config: ClientServerConfig;
|
|
1752
|
-
constructor(options: ClientServerConfig);
|
|
1753
1281
|
getState(): ClientState;
|
|
1754
|
-
getConfig():
|
|
1282
|
+
getConfig(): ClientConfig;
|
|
1755
1283
|
}
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
declare function createServerClient(options: ClientServerConfig): ServerClient;
|
|
1284
|
+
type DeepPartial<T> = {
|
|
1285
|
+
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
1286
|
+
};
|
|
1287
|
+
type ExtractArrayType<T> = T extends (infer U)[] ? U : never;
|
|
1761
1288
|
|
|
1762
|
-
export { type
|
|
1289
|
+
export { type OrderApiOptions as $, type ApiQueryOptions as A, BaseApi as B, CommerceClient as C, type DebugConfig as D, type ExtractArrayType as E, type CreateFulfillmentParams as F, type CreateOrderParams as G, type CreateReturnParams as H, CustomerAuth as I, type CustomerAuthOptions as J, type CustomerAuthResponse as K, type CustomerLoginData as L, type CustomerProfile as M, type CustomerRefreshResponse as N, type CustomerRegisterData as O, type PayloadFindResponse as P, type CustomerRegisterResponse as Q, type RetryConfig as R, type Sort as S, type CustomerSnapshot as T, DiscountApi as U, type DiscountApiOptions as V, type Where as W, type LegacyProductSelectionParamEvent as X, type ListingGroupsParams as Y, type NormalizedProductSelection as Z, OrderApi as _, CommunityClient as a, buildProductHref as a$, ProductApi as a0, type ProductApiOptions as a1, type ProductDetail as a2, type ProductDetailBrand as a3, type ProductDetailCategory as a4, type ProductDetailImage as a5, type ProductDetailImageMedia as a6, type ProductDetailListing as a7, type ProductDetailMedia as a8, type ProductDetailOption as a9, type ProductSelectionByOptionValue as aA, ProductSelectionCodecError as aB, type ProductSelectionCodecOptions as aC, type ProductSelectionInput as aD, type ProductSelectionResolution as aE, type ProductSelectionResolutionContext as aF, type ProductVariantShape as aG, type RemoveDiscountParams as aH, type RemoveItemParams as aI, type RequestOptions as aJ, type ReturnItem as aK, type ReturnReason as aL, type ReturnWithRefundParams as aM, type ServerApiOptions as aN, ShippingApi as aO, type ShippingApiOptions as aP, type StockCheckParams as aQ, type StockCheckResponse as aR, type StockCheckResult as aS, type UpdateFulfillmentParams as aT, type UpdateItemParams as aU, type UpdateOrderParams as aV, type UpdateProfileData as aW, type UpdateReturnParams as aX, type UpdateTransactionParams as aY, type ValidateDiscountParams as aZ, type ValidateDiscountResult as a_, type ProductDetailOptionValue as aa, type ProductDetailParams as ab, type ProductDetailTag as ac, type ProductDetailVariant as ad, type ProductDetailVariantOptionValue as ae, type ProductDetailVideo as af, type ProductHrefGroup as ag, type ProductHrefOptions as ah, type ProductHrefProduct as ai, type ProductListingCard as aj, type ProductListingCardPriceRange as ak, type ProductListingGroup as al, type ProductListingGroupSummary as am, type ProductListingGroupsItem as an, type ProductListingGroupsProduct as ao, type ProductListingGroupsResponse as ap, type ProductListingProductShape as aq, type ProductListingProjection as ar, type ProductListingSwatch as as, type ProductOptionMatrix as at, type ProductOptionMatrixOption as au, type ProductOptionMatrixValue as av, type ProductOptionMatrixVariant as aw, type ProductOptionShape as ax, type ProductOptionValueShape as ay, type ProductSelectionAvailableValue as az, CustomerNamespace as b, buildProductListingCard as b0, buildProductListingGroupsByOption as b1, buildProductListingProjection as b2, buildProductOptionMatrix as b3, buildProductOptionMatrixFromDetail as b4, createProductSelectionCodec as b5, getAvailableOptionValues as b6, getProductSelectionImages as b7, getSelectedValueByOptionId as b8, normalizeProductSelection as b9, normalizeProductSelectionFromMatrix as ba, normalizeSelectedValueIds as bb, parseProductSelection as bc, resolveProductSelection as bd, resolveProductSelectionFromMatrix as be, resolveVariantForSelection as bf, stringifyProductSelection as bg, type ProductDetailPreviewParams as bh, type ProductDetailPreviewOptions as bi, type ProductUpsertParams as bj, type ProductUpsertResponse as bk, type ClientServerConfig as bl, type ClientState as c, type ClientConfig as d, type ClientMetadata as e, type DeepPartial as f, type PayloadMutationResponse as g, type RootClient as h, type RootCollectionClient as i, type RootReadOnlyQueryBuilder as j, type AddItemParams as k, type ApplyDiscountParams as l, type BulkImportFulfillmentsParams as m, type BulkImportFulfillmentsResponse as n, type CalculateShippingParams as o, type CalculateShippingResult as p, CartApi as q, type CartApiOptions as r, type CheckoutParams as s, type ClearCartParams as t, type CommerceClientOptions as u, type CommunityClientOptions as v, type CommunityPost as w, type CompatibilityProductSelectionParamEvent as x, type ConfirmPaymentParams as y, type ConfirmPaymentResponse as z };
|