@01.software/sdk 0.28.0 → 0.30.1
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 +273 -73
- 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 +1476 -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 +1453 -0
- package/dist/client.js.map +1 -0
- package/dist/collection-client-B9d9kr1d.d.ts +218 -0
- package/dist/collection-client-QPbwimkU.d.cts +218 -0
- package/dist/{const-mdQQtIOz.d.ts → const-B75IFDRi.d.ts} +2 -4
- package/dist/{const-Cz9Ki_I7.d.cts → const-VZuk2tWc.d.cts} +2 -4
- package/dist/index-B2WbhEgT.d.cts +106 -0
- package/dist/index-B2WbhEgT.d.ts +106 -0
- package/dist/index.cjs +1291 -1501
- 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 +1292 -1520
- 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-BrSYb-sh.d.cts → payload-types-DPjO_IbQ.d.cts} +17 -6
- package/dist/{payload-types-BrSYb-sh.d.ts → payload-types-DPjO_IbQ.d.ts} +17 -6
- package/dist/query.cjs +1791 -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 +1786 -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 +300 -844
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +112 -7
- package/dist/server.d.ts +112 -7
- package/dist/server.js +300 -862
- package/dist/server.js.map +1 -1
- package/dist/{types-BLUb4cYq.d.ts → types-1fBLrYU7.d.ts} +1 -1
- package/dist/{types-CW4PaIL7.d.cts → types-BwT0eeaz.d.cts} +1 -1
- package/dist/types-Dlb2mwpX.d.cts +1249 -0
- package/dist/types-DuSKPiY5.d.ts +1249 -0
- 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 +82 -13
- package/dist/server-C2Q9R-Lu.d.ts +0 -1662
- package/dist/server-D369bCVJ.d.cts +0 -1662
|
@@ -1,1662 +0,0 @@
|
|
|
1
|
-
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
-
import { QueryClient, InfiniteData, UseQueryResult } from '@tanstack/react-query';
|
|
3
|
-
import { O as Order, d as Cart, e as CartItem, f as Product, l as OrderItem, m as Transaction, n as Fulfillment, o as Return } from './payload-types-BrSYb-sh.cjs';
|
|
4
|
-
import { Sort, Where } from 'payload';
|
|
5
|
-
import { Metadata } from 'next';
|
|
6
|
-
import { C as CollectionType } from './types-CW4PaIL7.cjs';
|
|
7
|
-
import { P as PublicCollection, d as ServerCollection } from './const-Cz9Ki_I7.cjs';
|
|
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
|
-
}
|
|
483
|
-
|
|
484
|
-
interface CommunityClientOptions {
|
|
485
|
-
publishableKey?: string;
|
|
486
|
-
secretKey?: string;
|
|
487
|
-
customerToken?: string | (() => string | null);
|
|
488
|
-
onUnauthorized?: () => Promise<string | null>;
|
|
489
|
-
onRequestId?: (id: string | null) => void;
|
|
490
|
-
}
|
|
491
|
-
interface CommunityPost {
|
|
492
|
-
id: string;
|
|
493
|
-
title?: string | null;
|
|
494
|
-
displayTitle?: string | null;
|
|
495
|
-
content?: unknown;
|
|
496
|
-
categories?: string[];
|
|
497
|
-
thumbnail?: string;
|
|
498
|
-
viewCount?: number;
|
|
499
|
-
createdAt?: string;
|
|
500
|
-
updatedAt?: string;
|
|
501
|
-
[key: string]: unknown;
|
|
502
|
-
}
|
|
503
|
-
interface Comment {
|
|
504
|
-
id: string;
|
|
505
|
-
body: string;
|
|
506
|
-
post?: string;
|
|
507
|
-
parent?: string;
|
|
508
|
-
rootComment?: string;
|
|
509
|
-
createdAt?: string;
|
|
510
|
-
updatedAt?: string;
|
|
511
|
-
[key: string]: unknown;
|
|
512
|
-
}
|
|
513
|
-
interface Reaction {
|
|
514
|
-
id: string;
|
|
515
|
-
post?: string;
|
|
516
|
-
comment?: string;
|
|
517
|
-
type?: string;
|
|
518
|
-
createdAt?: string;
|
|
519
|
-
[key: string]: unknown;
|
|
520
|
-
}
|
|
521
|
-
interface ReactionSummary {
|
|
522
|
-
counts: Record<string, number>;
|
|
523
|
-
total: number;
|
|
524
|
-
userReactions: string[];
|
|
525
|
-
}
|
|
526
|
-
interface Bookmark {
|
|
527
|
-
id: string;
|
|
528
|
-
post?: string;
|
|
529
|
-
createdAt?: string;
|
|
530
|
-
[key: string]: unknown;
|
|
531
|
-
}
|
|
532
|
-
interface ReactionType {
|
|
533
|
-
id: string;
|
|
534
|
-
title: string;
|
|
535
|
-
slug: string;
|
|
536
|
-
emoji?: string;
|
|
537
|
-
[key: string]: unknown;
|
|
538
|
-
}
|
|
539
|
-
interface PaginatedResponse<T> {
|
|
540
|
-
docs: T[];
|
|
541
|
-
totalDocs: number;
|
|
542
|
-
limit: number;
|
|
543
|
-
totalPages: number;
|
|
544
|
-
page: number;
|
|
545
|
-
pagingCounter: number;
|
|
546
|
-
hasPrevPage: boolean;
|
|
547
|
-
hasNextPage: boolean;
|
|
548
|
-
prevPage: number | null;
|
|
549
|
-
nextPage: number | null;
|
|
550
|
-
}
|
|
551
|
-
declare class CommunityClient {
|
|
552
|
-
private readonly publishableKey;
|
|
553
|
-
private readonly secretKey?;
|
|
554
|
-
private readonly customerToken?;
|
|
555
|
-
private readonly onUnauthorized?;
|
|
556
|
-
private readonly onRequestId?;
|
|
557
|
-
constructor(options: CommunityClientOptions);
|
|
558
|
-
private buildQuery;
|
|
559
|
-
private execute;
|
|
560
|
-
createPost(params: {
|
|
561
|
-
title?: string | null;
|
|
562
|
-
content?: unknown;
|
|
563
|
-
categories?: string[];
|
|
564
|
-
thumbnail?: string;
|
|
565
|
-
}): Promise<CommunityPost>;
|
|
566
|
-
getMyPosts(params?: {
|
|
567
|
-
page?: number;
|
|
568
|
-
limit?: number;
|
|
569
|
-
}): Promise<PaginatedResponse<CommunityPost>>;
|
|
570
|
-
getTrending(params?: {
|
|
571
|
-
page?: number;
|
|
572
|
-
limit?: number;
|
|
573
|
-
period?: string;
|
|
574
|
-
}): Promise<PaginatedResponse<CommunityPost>>;
|
|
575
|
-
incrementView(params: {
|
|
576
|
-
postId: string;
|
|
577
|
-
}): Promise<{
|
|
578
|
-
viewCount: number;
|
|
579
|
-
}>;
|
|
580
|
-
reportPost(params: {
|
|
581
|
-
postId: string;
|
|
582
|
-
reason?: string;
|
|
583
|
-
reasonDetail?: string;
|
|
584
|
-
}): Promise<{
|
|
585
|
-
success: boolean;
|
|
586
|
-
}>;
|
|
587
|
-
createComment(params: {
|
|
588
|
-
postId: string;
|
|
589
|
-
body: string;
|
|
590
|
-
parentId?: string;
|
|
591
|
-
}): Promise<Comment>;
|
|
592
|
-
listComments(params: {
|
|
593
|
-
postId: string;
|
|
594
|
-
page?: number;
|
|
595
|
-
limit?: number;
|
|
596
|
-
rootComment?: string;
|
|
597
|
-
}): Promise<PaginatedResponse<Comment>>;
|
|
598
|
-
updateComment(params: {
|
|
599
|
-
commentId: string;
|
|
600
|
-
body: string;
|
|
601
|
-
}): Promise<Comment>;
|
|
602
|
-
deleteComment(params: {
|
|
603
|
-
commentId: string;
|
|
604
|
-
}): Promise<{
|
|
605
|
-
success: boolean;
|
|
606
|
-
}>;
|
|
607
|
-
reportComment(params: {
|
|
608
|
-
commentId: string;
|
|
609
|
-
reason?: string;
|
|
610
|
-
reasonDetail?: string;
|
|
611
|
-
}): Promise<{
|
|
612
|
-
success: boolean;
|
|
613
|
-
}>;
|
|
614
|
-
addReaction(params: {
|
|
615
|
-
postId: string;
|
|
616
|
-
type: string;
|
|
617
|
-
}): Promise<Reaction>;
|
|
618
|
-
removeReaction(params: {
|
|
619
|
-
postId: string;
|
|
620
|
-
type: string;
|
|
621
|
-
}): Promise<{
|
|
622
|
-
success: boolean;
|
|
623
|
-
}>;
|
|
624
|
-
addCommentReaction(params: {
|
|
625
|
-
commentId: string;
|
|
626
|
-
type: string;
|
|
627
|
-
}): Promise<Reaction>;
|
|
628
|
-
removeCommentReaction(params: {
|
|
629
|
-
commentId: string;
|
|
630
|
-
type: string;
|
|
631
|
-
}): Promise<{
|
|
632
|
-
success: boolean;
|
|
633
|
-
}>;
|
|
634
|
-
getReactionSummary(params: {
|
|
635
|
-
postId: string;
|
|
636
|
-
}): Promise<ReactionSummary>;
|
|
637
|
-
getReactionTypes(): Promise<PaginatedResponse<ReactionType>>;
|
|
638
|
-
addBookmark(params: {
|
|
639
|
-
postId: string;
|
|
640
|
-
}): Promise<Bookmark>;
|
|
641
|
-
removeBookmark(params: {
|
|
642
|
-
postId: string;
|
|
643
|
-
}): Promise<{
|
|
644
|
-
success: boolean;
|
|
645
|
-
}>;
|
|
646
|
-
getMyBookmarks(params?: {
|
|
647
|
-
page?: number;
|
|
648
|
-
limit?: number;
|
|
649
|
-
}): Promise<PaginatedResponse<Bookmark>>;
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
interface ServerApiOptions {
|
|
653
|
-
publishableKey?: string;
|
|
654
|
-
secretKey: string;
|
|
655
|
-
onRequestId?: (id: string | null) => void;
|
|
656
|
-
}
|
|
657
|
-
interface RequestOptions {
|
|
658
|
-
method?: 'GET' | 'POST' | 'PATCH' | 'DELETE';
|
|
659
|
-
headers?: Record<string, string>;
|
|
660
|
-
}
|
|
661
|
-
declare abstract class BaseApi {
|
|
662
|
-
protected readonly publishableKey: string;
|
|
663
|
-
protected readonly secretKey: string;
|
|
664
|
-
protected readonly onRequestId?: (id: string | null) => void;
|
|
665
|
-
constructor(apiName: string, options: ServerApiOptions);
|
|
666
|
-
protected request<T>(endpoint: string, body: unknown, options?: RequestOptions): Promise<T>;
|
|
667
|
-
}
|
|
668
|
-
|
|
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
|
-
interface CustomerAuthResponse {
|
|
698
|
-
token: string;
|
|
699
|
-
customer: CustomerProfile;
|
|
700
|
-
}
|
|
701
|
-
interface MarketingConsentChannel {
|
|
702
|
-
isConsented?: boolean;
|
|
703
|
-
}
|
|
704
|
-
interface MarketingConsent {
|
|
705
|
-
email?: MarketingConsentChannel;
|
|
706
|
-
sms?: MarketingConsentChannel;
|
|
707
|
-
push?: MarketingConsentChannel;
|
|
708
|
-
consentSource?: string;
|
|
709
|
-
}
|
|
710
|
-
interface CustomerProfile {
|
|
711
|
-
id: string;
|
|
712
|
-
name: string;
|
|
713
|
-
email?: string | null;
|
|
714
|
-
phone?: string | null;
|
|
715
|
-
authProvider?: 'local' | 'google' | 'apple' | 'kakao' | 'naver' | null;
|
|
716
|
-
isGuest?: boolean | null;
|
|
717
|
-
marketingConsent?: MarketingConsent | null;
|
|
718
|
-
metadata?: Record<string, unknown> | null;
|
|
719
|
-
groups?: string[];
|
|
720
|
-
}
|
|
721
|
-
interface CustomerRegisterData {
|
|
722
|
-
name: string;
|
|
723
|
-
email: string;
|
|
724
|
-
password: string;
|
|
725
|
-
phone?: string;
|
|
726
|
-
}
|
|
727
|
-
interface CustomerRegisterResponse {
|
|
728
|
-
customer: CustomerProfile;
|
|
729
|
-
}
|
|
730
|
-
interface CustomerLoginData {
|
|
731
|
-
email: string;
|
|
732
|
-
password: string;
|
|
733
|
-
}
|
|
734
|
-
interface CustomerRefreshResponse {
|
|
735
|
-
token: string;
|
|
736
|
-
}
|
|
737
|
-
interface UpdateProfileData {
|
|
738
|
-
name?: string;
|
|
739
|
-
phone?: string;
|
|
740
|
-
marketingConsent?: MarketingConsent;
|
|
741
|
-
}
|
|
742
|
-
interface CustomerAuthOptions {
|
|
743
|
-
/**
|
|
744
|
-
* Persist token in localStorage. Defaults to `true`.
|
|
745
|
-
* - `true` (default): uses key `'customer-token'`
|
|
746
|
-
* - `string`: uses the given string as localStorage key
|
|
747
|
-
* - `false`: disables persistence (token/onTokenChange used instead)
|
|
748
|
-
*
|
|
749
|
-
* Handles SSR safely (no-op on server).
|
|
750
|
-
* When enabled, `token` and `onTokenChange` are ignored.
|
|
751
|
-
*/
|
|
752
|
-
persist?: boolean | string;
|
|
753
|
-
/** Initial token (e.g. from SSR cookie) */
|
|
754
|
-
token?: string;
|
|
755
|
-
/** Called when token changes (login/logout) — use to persist in localStorage/cookie */
|
|
756
|
-
onTokenChange?: (token: string | null) => void;
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
/**
|
|
760
|
-
* Customer authentication client.
|
|
761
|
-
*
|
|
762
|
-
* Manages customer registration, login, logout, and token lifecycle.
|
|
763
|
-
* All requests include X-Publishable-Key for tenant resolution.
|
|
764
|
-
*/
|
|
765
|
-
declare class CustomerAuth {
|
|
766
|
-
private publishableKey;
|
|
767
|
-
private baseUrl;
|
|
768
|
-
private token;
|
|
769
|
-
private onTokenChange?;
|
|
770
|
-
private refreshPromise;
|
|
771
|
-
constructor(publishableKey: string, options?: CustomerAuthOptions);
|
|
772
|
-
/**
|
|
773
|
-
* Register a new customer account
|
|
774
|
-
*/
|
|
775
|
-
register(data: CustomerRegisterData): Promise<CustomerRegisterResponse>;
|
|
776
|
-
/**
|
|
777
|
-
* Login with email and password. Stores the token internally.
|
|
778
|
-
*/
|
|
779
|
-
login(data: CustomerLoginData): Promise<CustomerAuthResponse>;
|
|
780
|
-
/**
|
|
781
|
-
* Refresh the current token. Requires a valid (non-expired) token.
|
|
782
|
-
*/
|
|
783
|
-
refreshToken(): Promise<CustomerRefreshResponse>;
|
|
784
|
-
private _doRefreshToken;
|
|
785
|
-
/**
|
|
786
|
-
* Clear the stored token
|
|
787
|
-
*/
|
|
788
|
-
logout(): void;
|
|
789
|
-
/**
|
|
790
|
-
* Get the current authenticated customer's profile
|
|
791
|
-
*/
|
|
792
|
-
me(): Promise<CustomerProfile | null>;
|
|
793
|
-
/**
|
|
794
|
-
* Request a password reset email
|
|
795
|
-
*/
|
|
796
|
-
forgotPassword(email: string): Promise<void>;
|
|
797
|
-
/**
|
|
798
|
-
* Reset password using a token from the reset email
|
|
799
|
-
*/
|
|
800
|
-
resetPassword(token: string, password: string): Promise<void>;
|
|
801
|
-
/**
|
|
802
|
-
* Update the authenticated customer's profile (name, phone, marketingConsent)
|
|
803
|
-
*/
|
|
804
|
-
updateProfile(data: UpdateProfileData): Promise<CustomerProfile>;
|
|
805
|
-
/**
|
|
806
|
-
* Change the password of the currently authenticated customer
|
|
807
|
-
*/
|
|
808
|
-
changePassword(currentPassword: string, newPassword: string): Promise<void>;
|
|
809
|
-
/**
|
|
810
|
-
* Get the authenticated customer's orders with pagination and optional status filter
|
|
811
|
-
*/
|
|
812
|
-
getMyOrders(options?: {
|
|
813
|
-
page?: number;
|
|
814
|
-
limit?: number;
|
|
815
|
-
status?: string;
|
|
816
|
-
}): Promise<PayloadFindResponse<Order>>;
|
|
817
|
-
/**
|
|
818
|
-
* Get the current token (or null if not authenticated)
|
|
819
|
-
*/
|
|
820
|
-
getToken(): string | null;
|
|
821
|
-
/**
|
|
822
|
-
* Set the token manually (e.g. from SSR)
|
|
823
|
-
*/
|
|
824
|
-
setToken(token: string | null): void;
|
|
825
|
-
/**
|
|
826
|
-
* Check if the customer is currently authenticated
|
|
827
|
-
*/
|
|
828
|
-
isAuthenticated(): boolean;
|
|
829
|
-
/**
|
|
830
|
-
* Internal: make a request with timeout and error handling.
|
|
831
|
-
* Auth endpoints don't retry — failures are final.
|
|
832
|
-
*/
|
|
833
|
-
private requestJson;
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
interface CartApiOptions {
|
|
837
|
-
publishableKey?: string;
|
|
838
|
-
secretKey?: string;
|
|
839
|
-
customerToken?: string | (() => string | null);
|
|
840
|
-
onUnauthorized?: () => Promise<string | null>;
|
|
841
|
-
onRequestId?: (id: string | null) => void;
|
|
842
|
-
}
|
|
843
|
-
type AddItemParams = {
|
|
844
|
-
cartId: string;
|
|
845
|
-
product: string;
|
|
846
|
-
variant: string;
|
|
847
|
-
option: string;
|
|
848
|
-
quantity: number;
|
|
849
|
-
};
|
|
850
|
-
type UpdateItemParams = {
|
|
851
|
-
cartItemId: string;
|
|
852
|
-
quantity: number;
|
|
853
|
-
};
|
|
854
|
-
type RemoveItemParams = {
|
|
855
|
-
cartItemId: string;
|
|
856
|
-
};
|
|
857
|
-
type ApplyDiscountParams = {
|
|
858
|
-
cartId: string;
|
|
859
|
-
discountCode: string;
|
|
860
|
-
};
|
|
861
|
-
type RemoveDiscountParams = {
|
|
862
|
-
cartId: string;
|
|
863
|
-
};
|
|
864
|
-
type ClearCartParams = {
|
|
865
|
-
cartId: string;
|
|
866
|
-
};
|
|
867
|
-
declare class CartApi {
|
|
868
|
-
private readonly publishableKey;
|
|
869
|
-
private readonly secretKey?;
|
|
870
|
-
private readonly customerToken?;
|
|
871
|
-
private readonly onUnauthorized?;
|
|
872
|
-
private readonly onRequestId?;
|
|
873
|
-
constructor(options: CartApiOptions);
|
|
874
|
-
private execute;
|
|
875
|
-
getCart(cartId: string): Promise<Cart>;
|
|
876
|
-
addItem(params: AddItemParams): Promise<CartItem>;
|
|
877
|
-
updateItem(params: UpdateItemParams): Promise<CartItem>;
|
|
878
|
-
removeItem(params: RemoveItemParams): Promise<{
|
|
879
|
-
success: boolean;
|
|
880
|
-
}>;
|
|
881
|
-
applyDiscount(params: ApplyDiscountParams): Promise<Cart>;
|
|
882
|
-
removeDiscount(params: RemoveDiscountParams): Promise<Cart>;
|
|
883
|
-
clearCart(params: ClearCartParams): Promise<{
|
|
884
|
-
success: boolean;
|
|
885
|
-
}>;
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
type EntityID = string;
|
|
889
|
-
type RelationshipValue = string | number | null | undefined | {
|
|
890
|
-
id?: string | number | null;
|
|
891
|
-
};
|
|
892
|
-
type MediaValue = {
|
|
893
|
-
id?: EntityID | null;
|
|
894
|
-
} | EntityID | null | undefined;
|
|
895
|
-
interface ProductOptionValueShape {
|
|
896
|
-
id?: string | number | null;
|
|
897
|
-
option?: RelationshipValue;
|
|
898
|
-
value?: string | null;
|
|
899
|
-
slug?: string | null;
|
|
900
|
-
swatchColor?: string | null;
|
|
901
|
-
thumbnail?: MediaValue;
|
|
902
|
-
images?: MediaValue[] | null;
|
|
903
|
-
_order?: string | null;
|
|
904
|
-
'_product-option-values_values_order'?: string | null;
|
|
905
|
-
}
|
|
906
|
-
interface ProductOptionShape {
|
|
907
|
-
id?: string | number | null;
|
|
908
|
-
title?: string | null;
|
|
909
|
-
_order?: string | null;
|
|
910
|
-
'_product-options_options_order'?: string | null;
|
|
911
|
-
values?: {
|
|
912
|
-
docs?: unknown[];
|
|
913
|
-
} | null;
|
|
914
|
-
}
|
|
915
|
-
interface ProductVariantShape {
|
|
916
|
-
id?: string | number | null;
|
|
917
|
-
optionValues?: unknown[] | null;
|
|
918
|
-
price?: number | null;
|
|
919
|
-
compareAtPrice?: number | null;
|
|
920
|
-
stock?: number | null;
|
|
921
|
-
reservedStock?: number | null;
|
|
922
|
-
isUnlimited?: boolean | null;
|
|
923
|
-
isActive?: boolean | null;
|
|
924
|
-
thumbnail?: MediaValue;
|
|
925
|
-
images?: MediaValue[] | null;
|
|
926
|
-
_order?: string | null;
|
|
927
|
-
}
|
|
928
|
-
interface ProductListingProductShape {
|
|
929
|
-
id?: EntityID;
|
|
930
|
-
thumbnail?: MediaValue;
|
|
931
|
-
images?: MediaValue[] | null;
|
|
932
|
-
}
|
|
933
|
-
type ProductOptionMatrixValue = {
|
|
934
|
-
id: string;
|
|
935
|
-
optionId: string;
|
|
936
|
-
label: string;
|
|
937
|
-
slug: string | null;
|
|
938
|
-
swatchColor?: string | null;
|
|
939
|
-
thumbnail?: MediaValue;
|
|
940
|
-
images?: MediaValue[] | null;
|
|
941
|
-
order: string;
|
|
942
|
-
};
|
|
943
|
-
type ProductOptionMatrixOption = {
|
|
944
|
-
id: string;
|
|
945
|
-
title: string;
|
|
946
|
-
order: string;
|
|
947
|
-
values: ProductOptionMatrixValue[];
|
|
948
|
-
};
|
|
949
|
-
type ProductOptionMatrixVariant<TVariant extends ProductVariantShape = ProductVariantShape> = {
|
|
950
|
-
id: string;
|
|
951
|
-
optionValueIds: string[];
|
|
952
|
-
optionValueByOptionId: Map<string, string>;
|
|
953
|
-
source: TVariant;
|
|
954
|
-
};
|
|
955
|
-
type ProductOptionMatrix<TVariant extends ProductVariantShape = ProductVariantShape> = {
|
|
956
|
-
options: ProductOptionMatrixOption[];
|
|
957
|
-
optionIds: string[];
|
|
958
|
-
optionById: Map<string, ProductOptionMatrixOption>;
|
|
959
|
-
valueById: Map<string, ProductOptionMatrixValue>;
|
|
960
|
-
valueToOptionId: Map<string, string>;
|
|
961
|
-
variants: ProductOptionMatrixVariant<TVariant>[];
|
|
962
|
-
};
|
|
963
|
-
type ProductListingProjection = {
|
|
964
|
-
selectionHintVariant: EntityID | null;
|
|
965
|
-
primaryImage: EntityID | null;
|
|
966
|
-
minPrice: number | null;
|
|
967
|
-
maxPrice: number | null;
|
|
968
|
-
minCompareAtPrice: number | null;
|
|
969
|
-
maxCompareAtPrice: number | null;
|
|
970
|
-
isPriceRange: boolean;
|
|
971
|
-
availableForSale: boolean;
|
|
972
|
-
};
|
|
973
|
-
type ProductListingGroup<TVariant extends ProductVariantShape = ProductVariantShape> = {
|
|
974
|
-
optionId: EntityID;
|
|
975
|
-
optionTitle: string;
|
|
976
|
-
optionValueId: EntityID;
|
|
977
|
-
optionValueLabel: string;
|
|
978
|
-
optionValueSlug: string | null;
|
|
979
|
-
optionValueSwatchColor?: string | null;
|
|
980
|
-
optionValueThumbnail?: MediaValue;
|
|
981
|
-
optionValueImages?: MediaValue[] | null;
|
|
982
|
-
variantIds: EntityID[];
|
|
983
|
-
variantCount: number;
|
|
984
|
-
variants: TVariant[];
|
|
985
|
-
listing: ProductListingProjection;
|
|
986
|
-
};
|
|
987
|
-
declare function buildProductOptionMatrix<TVariant extends ProductVariantShape = ProductVariantShape>({ options, variants, }: {
|
|
988
|
-
options: ProductOptionShape[];
|
|
989
|
-
variants?: TVariant[];
|
|
990
|
-
}): ProductOptionMatrix<TVariant>;
|
|
991
|
-
declare function getSelectedValueByOptionId<TVariant extends ProductVariantShape = ProductVariantShape>(matrix: ProductOptionMatrix<TVariant>, selectedValueIds: Iterable<unknown>): Map<string, string>;
|
|
992
|
-
declare function normalizeSelectedValueIds<TVariant extends ProductVariantShape = ProductVariantShape>(matrix: ProductOptionMatrix<TVariant>, selectedValueIds: Iterable<unknown>): string[];
|
|
993
|
-
declare function getAvailableOptionValues<TVariant extends ProductVariantShape = ProductVariantShape>(matrix: ProductOptionMatrix<TVariant>, optionId: string, selectedValueIds: Iterable<unknown>): ProductOptionMatrixValue[];
|
|
994
|
-
declare function resolveVariantForSelection<TVariant extends ProductVariantShape = ProductVariantShape>(matrix: ProductOptionMatrix<TVariant>, selectedValueIds: Iterable<unknown>): ProductOptionMatrixVariant<TVariant> | undefined;
|
|
995
|
-
declare function buildProductListingProjection(product: ProductListingProductShape | null | undefined, variants: ProductVariantShape[]): ProductListingProjection;
|
|
996
|
-
/**
|
|
997
|
-
* Builds product-first listing groups for one primary option.
|
|
998
|
-
*
|
|
999
|
-
* The returned groups are intended for product cards with nested swatches or
|
|
1000
|
-
* option-value sections. They do not make a product-paginated API response into
|
|
1001
|
-
* an expanded-card paginator; one product can still emit several groups.
|
|
1002
|
-
*/
|
|
1003
|
-
declare function buildProductListingGroupsByOption<TVariant extends ProductVariantShape = ProductVariantShape>(args: {
|
|
1004
|
-
product: ProductListingProductShape | null | undefined;
|
|
1005
|
-
options: ProductOptionShape[];
|
|
1006
|
-
variants: TVariant[];
|
|
1007
|
-
primaryOptionId?: string | null;
|
|
1008
|
-
}): ProductListingGroup<TVariant>[];
|
|
1009
|
-
|
|
1010
|
-
type ProductApiOptions = ServerApiOptions;
|
|
1011
|
-
type StockCheckParams = {
|
|
1012
|
-
items: Array<{
|
|
1013
|
-
variantId: string;
|
|
1014
|
-
quantity: number;
|
|
1015
|
-
}>;
|
|
1016
|
-
};
|
|
1017
|
-
type StockCheckResult = {
|
|
1018
|
-
variantId: string;
|
|
1019
|
-
available: boolean;
|
|
1020
|
-
availableStock: number;
|
|
1021
|
-
requestedQuantity: number;
|
|
1022
|
-
error?: string;
|
|
1023
|
-
};
|
|
1024
|
-
type StockCheckResponse = {
|
|
1025
|
-
results: StockCheckResult[];
|
|
1026
|
-
allAvailable: boolean;
|
|
1027
|
-
};
|
|
1028
|
-
type ListingGroupsParams = {
|
|
1029
|
-
productIds: string[];
|
|
1030
|
-
};
|
|
1031
|
-
type ProductListingGroupSummary = Omit<ProductListingGroup, 'variants'>;
|
|
1032
|
-
type ProductListingGroupsItem = {
|
|
1033
|
-
product: Product;
|
|
1034
|
-
primaryOptionId: string | null;
|
|
1035
|
-
groups: ProductListingGroupSummary[];
|
|
1036
|
-
};
|
|
1037
|
-
type ProductListingGroupsResponse = {
|
|
1038
|
-
docs: ProductListingGroupsItem[];
|
|
1039
|
-
};
|
|
1040
|
-
type ProductDetailParams = {
|
|
1041
|
-
slug: string;
|
|
1042
|
-
} | {
|
|
1043
|
-
id: string;
|
|
1044
|
-
};
|
|
1045
|
-
interface ProductDetailVariantOptionValue {
|
|
1046
|
-
optionId: string | number;
|
|
1047
|
-
valueId: string | number;
|
|
1048
|
-
value?: string | null;
|
|
1049
|
-
}
|
|
1050
|
-
interface ProductDetailVariant {
|
|
1051
|
-
id: string | number;
|
|
1052
|
-
optionKey: string;
|
|
1053
|
-
title?: string | null;
|
|
1054
|
-
displayName: string;
|
|
1055
|
-
sku?: string | null;
|
|
1056
|
-
price: number;
|
|
1057
|
-
compareAtPrice?: number | null;
|
|
1058
|
-
stock: number;
|
|
1059
|
-
reservedStock: number;
|
|
1060
|
-
isUnlimited: boolean;
|
|
1061
|
-
thumbnail?: unknown | null;
|
|
1062
|
-
images?: unknown[];
|
|
1063
|
-
optionValues: ProductDetailVariantOptionValue[];
|
|
1064
|
-
}
|
|
1065
|
-
interface ProductDetailOptionValue {
|
|
1066
|
-
id: string | number;
|
|
1067
|
-
value: string;
|
|
1068
|
-
swatchColor?: string | null;
|
|
1069
|
-
thumbnail?: unknown | null;
|
|
1070
|
-
}
|
|
1071
|
-
interface ProductDetailOption {
|
|
1072
|
-
id: string | number;
|
|
1073
|
-
title: string;
|
|
1074
|
-
values: ProductDetailOptionValue[];
|
|
1075
|
-
}
|
|
1076
|
-
interface ProductDetailBrand {
|
|
1077
|
-
id: string | number;
|
|
1078
|
-
name: string;
|
|
1079
|
-
slug?: string | null;
|
|
1080
|
-
logo?: unknown | null;
|
|
1081
|
-
}
|
|
1082
|
-
interface ProductDetailCategory {
|
|
1083
|
-
id: string | number;
|
|
1084
|
-
title: string;
|
|
1085
|
-
slug?: string | null;
|
|
1086
|
-
}
|
|
1087
|
-
interface ProductDetailTag {
|
|
1088
|
-
id: string | number;
|
|
1089
|
-
title: string;
|
|
1090
|
-
slug?: string | null;
|
|
1091
|
-
}
|
|
1092
|
-
interface ProductDetailImage {
|
|
1093
|
-
id: string | number;
|
|
1094
|
-
url?: string | null;
|
|
1095
|
-
alt?: string | null;
|
|
1096
|
-
width?: number | null;
|
|
1097
|
-
height?: number | null;
|
|
1098
|
-
}
|
|
1099
|
-
interface ProductDetailVideo {
|
|
1100
|
-
id: string | number;
|
|
1101
|
-
url?: string | null;
|
|
1102
|
-
}
|
|
1103
|
-
interface ProductDetailListing {
|
|
1104
|
-
minPrice?: number | null;
|
|
1105
|
-
maxPrice?: number | null;
|
|
1106
|
-
minCompareAtPrice?: number | null;
|
|
1107
|
-
maxCompareAtPrice?: number | null;
|
|
1108
|
-
isPriceRange?: boolean | null;
|
|
1109
|
-
primaryImage?: unknown | null;
|
|
1110
|
-
availableForSale?: boolean | null;
|
|
1111
|
-
selectionHintVariant?: unknown | null;
|
|
1112
|
-
}
|
|
1113
|
-
interface ProductDetail {
|
|
1114
|
-
product: {
|
|
1115
|
-
id: string | number;
|
|
1116
|
-
slug: string;
|
|
1117
|
-
title: string;
|
|
1118
|
-
subtitle?: string | null;
|
|
1119
|
-
description?: string | null;
|
|
1120
|
-
content?: unknown;
|
|
1121
|
-
publishedAt?: string | null;
|
|
1122
|
-
status: string;
|
|
1123
|
-
totalInventory: number;
|
|
1124
|
-
totalVariants: number;
|
|
1125
|
-
hasOnlyDefaultVariant: boolean;
|
|
1126
|
-
};
|
|
1127
|
-
variants: ProductDetailVariant[];
|
|
1128
|
-
options: ProductDetailOption[];
|
|
1129
|
-
brand: ProductDetailBrand | null;
|
|
1130
|
-
categories: ProductDetailCategory[];
|
|
1131
|
-
tags: ProductDetailTag[];
|
|
1132
|
-
images: ProductDetailImage[];
|
|
1133
|
-
videos: ProductDetailVideo[];
|
|
1134
|
-
listing: ProductDetailListing;
|
|
1135
|
-
}
|
|
1136
|
-
type ProductUpsertOptionValueInput = {
|
|
1137
|
-
id?: string;
|
|
1138
|
-
value: string;
|
|
1139
|
-
slug?: string;
|
|
1140
|
-
swatchColor?: string | null;
|
|
1141
|
-
thumbnail?: string | null;
|
|
1142
|
-
images?: string[];
|
|
1143
|
-
metadata?: unknown;
|
|
1144
|
-
};
|
|
1145
|
-
type ProductUpsertOptionInput = {
|
|
1146
|
-
id?: string;
|
|
1147
|
-
title: string;
|
|
1148
|
-
values: ProductUpsertOptionValueInput[];
|
|
1149
|
-
};
|
|
1150
|
-
type ProductUpsertVariantInput = {
|
|
1151
|
-
id?: string;
|
|
1152
|
-
optionValues?: Record<string, string> | string[];
|
|
1153
|
-
sku?: string | null;
|
|
1154
|
-
title?: string | null;
|
|
1155
|
-
price: number;
|
|
1156
|
-
compareAtPrice?: number | null;
|
|
1157
|
-
stock?: number;
|
|
1158
|
-
isUnlimited?: boolean;
|
|
1159
|
-
weight?: number | null;
|
|
1160
|
-
requiresShipping?: boolean;
|
|
1161
|
-
barcode?: string | null;
|
|
1162
|
-
externalId?: string | null;
|
|
1163
|
-
isActive?: boolean;
|
|
1164
|
-
thumbnail?: string | null;
|
|
1165
|
-
images?: string[];
|
|
1166
|
-
metadata?: unknown;
|
|
1167
|
-
};
|
|
1168
|
-
type ProductUpsertParams = {
|
|
1169
|
-
product: Record<string, unknown> & {
|
|
1170
|
-
id?: string;
|
|
1171
|
-
title?: string;
|
|
1172
|
-
};
|
|
1173
|
-
options?: ProductUpsertOptionInput[];
|
|
1174
|
-
variants?: ProductUpsertVariantInput[];
|
|
1175
|
-
};
|
|
1176
|
-
type ProductUpsertResponse = {
|
|
1177
|
-
ok: true;
|
|
1178
|
-
product: Product;
|
|
1179
|
-
} | {
|
|
1180
|
-
ok: false;
|
|
1181
|
-
failedEntity: 'product' | 'option' | 'option-value' | 'variant';
|
|
1182
|
-
failedIndex?: number;
|
|
1183
|
-
message: string;
|
|
1184
|
-
};
|
|
1185
|
-
declare class ProductApi extends BaseApi {
|
|
1186
|
-
constructor(options: ProductApiOptions);
|
|
1187
|
-
/**
|
|
1188
|
-
* Check point-in-time stock availability for one or more product variants.
|
|
1189
|
-
* Results reflect available stock at the moment of the call and are not guaranteed
|
|
1190
|
-
* to remain available by the time an order is placed.
|
|
1191
|
-
*/
|
|
1192
|
-
stockCheck(params: StockCheckParams): Promise<StockCheckResponse>;
|
|
1193
|
-
listingGroups(params: ListingGroupsParams): Promise<ProductListingGroupsResponse>;
|
|
1194
|
-
/**
|
|
1195
|
-
* Fetch full product detail by slug or id.
|
|
1196
|
-
* Returns `null` on 404 regardless of reason (`not_found` / `not_published` /
|
|
1197
|
-
* `tenant_mismatch` / `feature_disabled`). For the reason behind a null,
|
|
1198
|
-
* inspect `client.lastRequestId` against backend logs.
|
|
1199
|
-
*/
|
|
1200
|
-
detail(params: ProductDetailParams): Promise<ProductDetail | null>;
|
|
1201
|
-
/**
|
|
1202
|
-
* Atomically create or update a product together with its options,
|
|
1203
|
-
* option-values, and variants in a single transaction. Mirrors Shopify's
|
|
1204
|
-
* `productSet` shape and is the canonical write path for the MCP
|
|
1205
|
-
* `product-upsert` tool.
|
|
1206
|
-
*/
|
|
1207
|
-
upsert(params: ProductUpsertParams): Promise<ProductUpsertResponse>;
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
|
-
type DiscountApiOptions = ServerApiOptions;
|
|
1211
|
-
type ValidateDiscountParams = {
|
|
1212
|
-
code: string;
|
|
1213
|
-
orderAmount: number;
|
|
1214
|
-
};
|
|
1215
|
-
type ValidateDiscountResult = {
|
|
1216
|
-
valid: boolean;
|
|
1217
|
-
code: string;
|
|
1218
|
-
type?: 'percentage' | 'fixed_amount' | 'free_shipping' | 'tiered';
|
|
1219
|
-
discountAmount: number;
|
|
1220
|
-
freeShipping?: boolean;
|
|
1221
|
-
reason?: string;
|
|
1222
|
-
};
|
|
1223
|
-
declare class DiscountApi extends BaseApi {
|
|
1224
|
-
constructor(options: DiscountApiOptions);
|
|
1225
|
-
validate(params: ValidateDiscountParams): Promise<ValidateDiscountResult>;
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
|
-
type ShippingApiOptions = ServerApiOptions;
|
|
1229
|
-
type CalculateShippingParams = {
|
|
1230
|
-
shippingPolicyId?: string;
|
|
1231
|
-
orderAmount: number;
|
|
1232
|
-
postalCode?: string;
|
|
1233
|
-
};
|
|
1234
|
-
type CalculateShippingResult = {
|
|
1235
|
-
shippingAmount: number;
|
|
1236
|
-
baseShippingAmount: number;
|
|
1237
|
-
extraShippingAmount: number;
|
|
1238
|
-
freeShipping: boolean;
|
|
1239
|
-
freeShippingMinAmount: number | null;
|
|
1240
|
-
isJeju: boolean;
|
|
1241
|
-
isRemoteIsland: boolean;
|
|
1242
|
-
};
|
|
1243
|
-
declare class ShippingApi extends BaseApi {
|
|
1244
|
-
constructor(options: ShippingApiOptions);
|
|
1245
|
-
calculate(params: CalculateShippingParams): Promise<CalculateShippingResult>;
|
|
1246
|
-
}
|
|
1247
|
-
|
|
1248
|
-
type OrderApiOptions = ServerApiOptions;
|
|
1249
|
-
type CustomerSnapshot = {
|
|
1250
|
-
name?: string;
|
|
1251
|
-
email: string;
|
|
1252
|
-
phone?: string;
|
|
1253
|
-
};
|
|
1254
|
-
type ReturnReason = 'change_of_mind' | 'defective' | 'wrong_delivery' | 'damaged' | 'other';
|
|
1255
|
-
type ReturnItem = {
|
|
1256
|
-
orderItem: string;
|
|
1257
|
-
quantity: number;
|
|
1258
|
-
};
|
|
1259
|
-
type CreateOrderParams = {
|
|
1260
|
-
orderNumber: string;
|
|
1261
|
-
customer?: string;
|
|
1262
|
-
customerSnapshot: CustomerSnapshot;
|
|
1263
|
-
shippingAddress: Order['shippingAddress'];
|
|
1264
|
-
orderItems: Pick<OrderItem, 'product' | 'variant' | 'quantity' | 'unitPrice' | 'totalPrice'>[];
|
|
1265
|
-
totalAmount: number;
|
|
1266
|
-
shippingAmount?: number;
|
|
1267
|
-
pgPaymentId?: string;
|
|
1268
|
-
discountCode?: string;
|
|
1269
|
-
};
|
|
1270
|
-
type UpdateOrderParams = {
|
|
1271
|
-
orderNumber: string;
|
|
1272
|
-
status: Order['status'];
|
|
1273
|
-
};
|
|
1274
|
-
type TransactionStatus = 'pending' | 'paid' | 'failed' | 'canceled';
|
|
1275
|
-
type UpdateTransactionParams = {
|
|
1276
|
-
pgPaymentId: string;
|
|
1277
|
-
status: TransactionStatus;
|
|
1278
|
-
paymentMethod?: string;
|
|
1279
|
-
receiptUrl?: string;
|
|
1280
|
-
paymentKey?: string;
|
|
1281
|
-
amount?: number;
|
|
1282
|
-
};
|
|
1283
|
-
type ConfirmPaymentParams = {
|
|
1284
|
-
orderNumber?: string;
|
|
1285
|
-
pgPaymentId: string;
|
|
1286
|
-
pgProvider: string;
|
|
1287
|
-
pgOrderId?: string;
|
|
1288
|
-
amount: number;
|
|
1289
|
-
currency?: string;
|
|
1290
|
-
paymentMethod?: string;
|
|
1291
|
-
receiptUrl?: string;
|
|
1292
|
-
approvedAt?: string;
|
|
1293
|
-
providerStatus?: string;
|
|
1294
|
-
providerEventId?: string;
|
|
1295
|
-
confirmationSource?: 'provider_webhook' | 'provider_lookup' | 'provider_api_confirm' | 'manual_server';
|
|
1296
|
-
metadata?: Record<string, unknown>;
|
|
1297
|
-
};
|
|
1298
|
-
type ConfirmPaymentResponse = {
|
|
1299
|
-
orderId: string;
|
|
1300
|
-
transactionId: string;
|
|
1301
|
-
status: 'paid';
|
|
1302
|
-
alreadyConfirmed?: boolean;
|
|
1303
|
-
};
|
|
1304
|
-
type RestockAction = 'return_to_stock' | 'discard';
|
|
1305
|
-
type ReturnWithRefundItem = {
|
|
1306
|
-
orderItem: string | number;
|
|
1307
|
-
quantity: number;
|
|
1308
|
-
restockAction?: RestockAction;
|
|
1309
|
-
};
|
|
1310
|
-
type ReturnWithRefundParams = {
|
|
1311
|
-
orderNumber: string;
|
|
1312
|
-
reason?: ReturnReason;
|
|
1313
|
-
reasonDetail?: string;
|
|
1314
|
-
returnItems: ReturnWithRefundItem[];
|
|
1315
|
-
refundAmount: number;
|
|
1316
|
-
pgPaymentId: string;
|
|
1317
|
-
paymentKey?: string;
|
|
1318
|
-
refundReceiptUrl?: string;
|
|
1319
|
-
};
|
|
1320
|
-
type CheckoutParams = {
|
|
1321
|
-
cartId: string;
|
|
1322
|
-
orderNumber: string;
|
|
1323
|
-
customerSnapshot: CustomerSnapshot;
|
|
1324
|
-
pgPaymentId?: string;
|
|
1325
|
-
discountCode?: string;
|
|
1326
|
-
};
|
|
1327
|
-
type CreateFulfillmentParams = {
|
|
1328
|
-
orderNumber: string;
|
|
1329
|
-
carrier?: string;
|
|
1330
|
-
trackingNumber?: string;
|
|
1331
|
-
items: Array<{
|
|
1332
|
-
orderItem: string;
|
|
1333
|
-
quantity: number;
|
|
1334
|
-
}>;
|
|
1335
|
-
};
|
|
1336
|
-
type UpdateFulfillmentParams = {
|
|
1337
|
-
fulfillmentId: string;
|
|
1338
|
-
status: 'packed' | 'shipped' | 'delivered' | 'failed';
|
|
1339
|
-
carrier?: string;
|
|
1340
|
-
trackingNumber?: string;
|
|
1341
|
-
};
|
|
1342
|
-
type BulkImportFulfillmentsParams = {
|
|
1343
|
-
items: Array<{
|
|
1344
|
-
orderNumber: string;
|
|
1345
|
-
carrier?: string;
|
|
1346
|
-
trackingNumber?: string;
|
|
1347
|
-
}>;
|
|
1348
|
-
};
|
|
1349
|
-
type BulkImportFulfillmentsResponse = {
|
|
1350
|
-
succeeded: Array<{
|
|
1351
|
-
orderNumber: string;
|
|
1352
|
-
fulfillmentId: string;
|
|
1353
|
-
}>;
|
|
1354
|
-
failed: Array<{
|
|
1355
|
-
orderNumber: string;
|
|
1356
|
-
error: string;
|
|
1357
|
-
}>;
|
|
1358
|
-
};
|
|
1359
|
-
type CreateReturnParams = {
|
|
1360
|
-
orderNumber: string;
|
|
1361
|
-
reason?: ReturnReason;
|
|
1362
|
-
reasonDetail?: string;
|
|
1363
|
-
returnItems: ReturnItem[];
|
|
1364
|
-
refundAmount: number;
|
|
1365
|
-
};
|
|
1366
|
-
type UpdateReturnParams = {
|
|
1367
|
-
returnId: string;
|
|
1368
|
-
status: 'processing' | 'approved' | 'rejected' | 'completed';
|
|
1369
|
-
};
|
|
1370
|
-
declare class OrderApi extends BaseApi {
|
|
1371
|
-
constructor(options: OrderApiOptions);
|
|
1372
|
-
createOrder(params: CreateOrderParams): Promise<Order>;
|
|
1373
|
-
updateOrder(params: UpdateOrderParams): Promise<Order>;
|
|
1374
|
-
updateTransaction(params: UpdateTransactionParams): Promise<Transaction>;
|
|
1375
|
-
confirmPayment(params: ConfirmPaymentParams): Promise<ConfirmPaymentResponse>;
|
|
1376
|
-
checkout(params: CheckoutParams): Promise<Order>;
|
|
1377
|
-
createFulfillment(params: CreateFulfillmentParams): Promise<Fulfillment>;
|
|
1378
|
-
updateFulfillment(params: UpdateFulfillmentParams): Promise<Fulfillment>;
|
|
1379
|
-
bulkImportFulfillments(params: BulkImportFulfillmentsParams): Promise<BulkImportFulfillmentsResponse>;
|
|
1380
|
-
returnWithRefund(params: ReturnWithRefundParams): Promise<{
|
|
1381
|
-
return: Return;
|
|
1382
|
-
transaction: Transaction | null;
|
|
1383
|
-
}>;
|
|
1384
|
-
createReturn(params: CreateReturnParams): Promise<Return>;
|
|
1385
|
-
updateReturn(params: UpdateReturnParams): Promise<Return>;
|
|
1386
|
-
}
|
|
1387
|
-
|
|
1388
|
-
interface ServerCommerceClientOptions {
|
|
1389
|
-
publishableKey?: string;
|
|
1390
|
-
secretKey: string;
|
|
1391
|
-
onRequestId?: (id: string | null) => void;
|
|
1392
|
-
}
|
|
1393
|
-
declare class ServerCommerceClient {
|
|
1394
|
-
readonly product: {
|
|
1395
|
-
stockCheck: (params: StockCheckParams) => Promise<StockCheckResponse>;
|
|
1396
|
-
listingGroups: (params: ListingGroupsParams) => Promise<ProductListingGroupsResponse>;
|
|
1397
|
-
detail: (params: ProductDetailParams) => Promise<ProductDetail | null>;
|
|
1398
|
-
upsert: (params: ProductUpsertParams) => Promise<ProductUpsertResponse>;
|
|
1399
|
-
};
|
|
1400
|
-
readonly cart: {
|
|
1401
|
-
get: (cartId: string) => Promise<Cart>;
|
|
1402
|
-
addItem: (params: AddItemParams) => Promise<CartItem>;
|
|
1403
|
-
updateItem: (params: UpdateItemParams) => Promise<CartItem>;
|
|
1404
|
-
removeItem: (params: RemoveItemParams) => Promise<{
|
|
1405
|
-
success: boolean;
|
|
1406
|
-
}>;
|
|
1407
|
-
applyDiscount: (params: ApplyDiscountParams) => Promise<Cart>;
|
|
1408
|
-
removeDiscount: (params: RemoveDiscountParams) => Promise<Cart>;
|
|
1409
|
-
clear: (params: ClearCartParams) => Promise<{
|
|
1410
|
-
success: boolean;
|
|
1411
|
-
}>;
|
|
1412
|
-
};
|
|
1413
|
-
readonly orders: {
|
|
1414
|
-
checkout: (params: CheckoutParams) => Promise<Order>;
|
|
1415
|
-
create: (params: CreateOrderParams) => Promise<Order>;
|
|
1416
|
-
update: (params: UpdateOrderParams) => Promise<Order>;
|
|
1417
|
-
updateTransaction: (params: UpdateTransactionParams) => Promise<Transaction>;
|
|
1418
|
-
confirmPayment: (params: ConfirmPaymentParams) => Promise<ConfirmPaymentResponse>;
|
|
1419
|
-
createFulfillment: (params: CreateFulfillmentParams) => Promise<Fulfillment>;
|
|
1420
|
-
updateFulfillment: (params: UpdateFulfillmentParams) => Promise<Fulfillment>;
|
|
1421
|
-
bulkImportFulfillments: (params: BulkImportFulfillmentsParams) => Promise<BulkImportFulfillmentsResponse>;
|
|
1422
|
-
createReturn: (params: CreateReturnParams) => Promise<Return>;
|
|
1423
|
-
updateReturn: (params: UpdateReturnParams) => Promise<Return>;
|
|
1424
|
-
returnWithRefund: (params: ReturnWithRefundParams) => Promise<{
|
|
1425
|
-
return: Return;
|
|
1426
|
-
transaction: Transaction | null;
|
|
1427
|
-
}>;
|
|
1428
|
-
};
|
|
1429
|
-
readonly discounts: {
|
|
1430
|
-
validate: (params: ValidateDiscountParams) => Promise<ValidateDiscountResult>;
|
|
1431
|
-
};
|
|
1432
|
-
readonly shipping: {
|
|
1433
|
-
calculate: (params: CalculateShippingParams) => Promise<CalculateShippingResult>;
|
|
1434
|
-
};
|
|
1435
|
-
constructor(options: ServerCommerceClientOptions);
|
|
1436
|
-
}
|
|
1437
|
-
|
|
1438
|
-
interface CollectionQueryParams<T extends PublicCollection> {
|
|
1439
|
-
collection: T;
|
|
1440
|
-
options?: ApiQueryOptions;
|
|
1441
|
-
}
|
|
1442
|
-
interface CollectionDetailQueryParams<T extends PublicCollection> {
|
|
1443
|
-
collection: T;
|
|
1444
|
-
id: string;
|
|
1445
|
-
options?: ApiQueryOptions;
|
|
1446
|
-
}
|
|
1447
|
-
interface CollectionInfiniteQueryParams<T extends PublicCollection> {
|
|
1448
|
-
collection: T;
|
|
1449
|
-
options?: Omit<ApiQueryOptions, 'page'>;
|
|
1450
|
-
pageSize?: number;
|
|
1451
|
-
}
|
|
1452
|
-
interface QueryOptions<TQueryFnData = unknown, TData = TQueryFnData> {
|
|
1453
|
-
enabled?: boolean;
|
|
1454
|
-
staleTime?: number;
|
|
1455
|
-
gcTime?: number;
|
|
1456
|
-
refetchOnWindowFocus?: boolean;
|
|
1457
|
-
refetchOnMount?: boolean | 'always';
|
|
1458
|
-
refetchInterval?: number | false;
|
|
1459
|
-
retry?: boolean | number;
|
|
1460
|
-
select?: (data: TQueryFnData) => TData;
|
|
1461
|
-
placeholderData?: TQueryFnData | ((previousData: TData | undefined) => TQueryFnData | undefined);
|
|
1462
|
-
initialData?: TQueryFnData | (() => TQueryFnData);
|
|
1463
|
-
initialDataUpdatedAt?: number | (() => number | undefined);
|
|
1464
|
-
}
|
|
1465
|
-
type SuspenseQueryOptions<TQueryFnData = unknown, TData = TQueryFnData> = Omit<QueryOptions<TQueryFnData, TData>, 'enabled' | 'placeholderData'>;
|
|
1466
|
-
interface InfiniteQueryOptions<TQueryFnData = unknown, TData = InfiniteData<TQueryFnData>> {
|
|
1467
|
-
enabled?: boolean;
|
|
1468
|
-
staleTime?: number;
|
|
1469
|
-
gcTime?: number;
|
|
1470
|
-
refetchOnWindowFocus?: boolean;
|
|
1471
|
-
refetchOnMount?: boolean | 'always';
|
|
1472
|
-
refetchInterval?: number | false;
|
|
1473
|
-
retry?: boolean | number;
|
|
1474
|
-
select?: (data: InfiniteData<TQueryFnData>) => TData;
|
|
1475
|
-
}
|
|
1476
|
-
type SuspenseInfiniteQueryOptions<TQueryFnData = unknown, TData = InfiniteData<TQueryFnData>> = Omit<InfiniteQueryOptions<TQueryFnData, TData>, 'enabled'>;
|
|
1477
|
-
interface MutationCallbacks$1<TData> {
|
|
1478
|
-
onSuccess?: (data: TData) => void;
|
|
1479
|
-
onError?: (error: SDKError) => void;
|
|
1480
|
-
onSettled?: () => void;
|
|
1481
|
-
}
|
|
1482
|
-
declare class CollectionHooks {
|
|
1483
|
-
protected queryClient: QueryClient;
|
|
1484
|
-
protected collectionClient: CollectionClient;
|
|
1485
|
-
constructor(queryClient: QueryClient, collectionClient: CollectionClient);
|
|
1486
|
-
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>;
|
|
1487
|
-
useSuspenseQuery<T extends PublicCollection, TData = PayloadFindResponse<CollectionType<T>>>(params: CollectionQueryParams<T>, options?: SuspenseQueryOptions<PayloadFindResponse<CollectionType<T>>, TData>): _tanstack_react_query.UseSuspenseQueryResult<TData, Error>;
|
|
1488
|
-
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>;
|
|
1489
|
-
useSuspenseQueryById<T extends PublicCollection, TData = CollectionType<T>>(params: CollectionDetailQueryParams<T>, options?: SuspenseQueryOptions<CollectionType<T>, TData>): _tanstack_react_query.UseSuspenseQueryResult<TData, Error>;
|
|
1490
|
-
useInfiniteQuery<T extends PublicCollection, TData = InfiniteData<PayloadFindResponse<CollectionType<T>>>>(params: CollectionInfiniteQueryParams<T>, options?: InfiniteQueryOptions<PayloadFindResponse<CollectionType<T>>, TData>): _tanstack_react_query.UseInfiniteQueryResult<TData, Error>;
|
|
1491
|
-
useSuspenseInfiniteQuery<T extends PublicCollection, TData = InfiniteData<PayloadFindResponse<CollectionType<T>>>>(params: CollectionInfiniteQueryParams<T>, options?: SuspenseInfiniteQueryOptions<PayloadFindResponse<CollectionType<T>>, TData>): _tanstack_react_query.UseSuspenseInfiniteQueryResult<TData, Error>;
|
|
1492
|
-
prefetchQuery<T extends PublicCollection>(params: CollectionQueryParams<T>, options?: {
|
|
1493
|
-
staleTime?: number;
|
|
1494
|
-
}): Promise<void>;
|
|
1495
|
-
prefetchQueryById<T extends PublicCollection>(params: CollectionDetailQueryParams<T>, options?: {
|
|
1496
|
-
staleTime?: number;
|
|
1497
|
-
}): Promise<void>;
|
|
1498
|
-
prefetchInfiniteQuery<T extends PublicCollection>(params: CollectionInfiniteQueryParams<T>, options?: {
|
|
1499
|
-
pages?: number;
|
|
1500
|
-
staleTime?: number;
|
|
1501
|
-
}): Promise<void>;
|
|
1502
|
-
useCreate<T extends PublicCollection>(params: {
|
|
1503
|
-
collection: T;
|
|
1504
|
-
}, options?: MutationCallbacks$1<PayloadMutationResponse<CollectionType<T>>>): _tanstack_react_query.UseMutationResult<PayloadMutationResponse<CollectionType<T>>, SDKError, {
|
|
1505
|
-
data: Partial<CollectionType<T>>;
|
|
1506
|
-
file?: File | Blob;
|
|
1507
|
-
filename?: string;
|
|
1508
|
-
}, unknown>;
|
|
1509
|
-
useUpdate<T extends PublicCollection>(params: {
|
|
1510
|
-
collection: T;
|
|
1511
|
-
}, options?: MutationCallbacks$1<PayloadMutationResponse<CollectionType<T>>>): _tanstack_react_query.UseMutationResult<PayloadMutationResponse<CollectionType<T>>, SDKError, {
|
|
1512
|
-
id: string;
|
|
1513
|
-
data: Partial<CollectionType<T>>;
|
|
1514
|
-
file?: File | Blob;
|
|
1515
|
-
filename?: string;
|
|
1516
|
-
}, unknown>;
|
|
1517
|
-
useRemove<T extends PublicCollection>(params: {
|
|
1518
|
-
collection: T;
|
|
1519
|
-
}, options?: MutationCallbacks$1<CollectionType<T>>): _tanstack_react_query.UseMutationResult<CollectionType<T>, SDKError, string, unknown>;
|
|
1520
|
-
invalidateQueries<T extends PublicCollection>(collection: T, type?: 'list' | 'detail' | 'infinite'): Promise<void>;
|
|
1521
|
-
getQueryData<T extends PublicCollection>(collection: T, type: 'list', options?: ApiQueryOptions): PayloadFindResponse<CollectionType<T>> | undefined;
|
|
1522
|
-
getQueryData<T extends PublicCollection>(collection: T, type: 'detail', id: string, options?: ApiQueryOptions): CollectionType<T> | null | undefined;
|
|
1523
|
-
setQueryData<T extends PublicCollection>(collection: T, type: 'list', data: PayloadFindResponse<CollectionType<T>>, options?: ApiQueryOptions): void;
|
|
1524
|
-
setQueryData<T extends PublicCollection>(collection: T, type: 'detail', id: string, data: CollectionType<T> | null, options?: ApiQueryOptions): void;
|
|
1525
|
-
}
|
|
1526
|
-
|
|
1527
|
-
interface MutationCallbacks<TData> {
|
|
1528
|
-
onSuccess?: (data: TData) => void;
|
|
1529
|
-
onError?: (error: SDKError) => void;
|
|
1530
|
-
onSettled?: () => void;
|
|
1531
|
-
}
|
|
1532
|
-
declare class CustomerHooks {
|
|
1533
|
-
private queryClient;
|
|
1534
|
-
private customerAuth?;
|
|
1535
|
-
constructor(queryClient: QueryClient, customerAuth?: CustomerAuth);
|
|
1536
|
-
private ensureCustomerAuth;
|
|
1537
|
-
private invalidateMe;
|
|
1538
|
-
useCustomerMe(options?: {
|
|
1539
|
-
enabled?: boolean;
|
|
1540
|
-
staleTime?: number;
|
|
1541
|
-
gcTime?: number;
|
|
1542
|
-
refetchOnWindowFocus?: boolean;
|
|
1543
|
-
refetchOnMount?: boolean | 'always';
|
|
1544
|
-
refetchInterval?: number | false;
|
|
1545
|
-
retry?: boolean | number;
|
|
1546
|
-
}): _tanstack_react_query.UseQueryResult<CustomerProfile | null, Error>;
|
|
1547
|
-
useCustomerLogin(options?: MutationCallbacks<CustomerAuthResponse>): _tanstack_react_query.UseMutationResult<CustomerAuthResponse, SDKError, CustomerLoginData, unknown>;
|
|
1548
|
-
useCustomerRegister(options?: MutationCallbacks<{
|
|
1549
|
-
customer: CustomerProfile;
|
|
1550
|
-
}>): _tanstack_react_query.UseMutationResult<CustomerRegisterResponse, SDKError, CustomerRegisterData, unknown>;
|
|
1551
|
-
useCustomerLogout(options?: MutationCallbacks<void>): _tanstack_react_query.UseMutationResult<void, SDKError, void, unknown>;
|
|
1552
|
-
useCustomerForgotPassword(options?: MutationCallbacks<void>): _tanstack_react_query.UseMutationResult<void, SDKError, string, unknown>;
|
|
1553
|
-
useCustomerResetPassword(options?: MutationCallbacks<void>): _tanstack_react_query.UseMutationResult<void, SDKError, {
|
|
1554
|
-
token: string;
|
|
1555
|
-
password: string;
|
|
1556
|
-
}, unknown>;
|
|
1557
|
-
useCustomerRefreshToken(options?: MutationCallbacks<CustomerRefreshResponse>): _tanstack_react_query.UseMutationResult<CustomerRefreshResponse, SDKError, unknown, unknown>;
|
|
1558
|
-
useCustomerUpdateProfile(options?: MutationCallbacks<CustomerProfile>): _tanstack_react_query.UseMutationResult<CustomerProfile, SDKError, UpdateProfileData, unknown>;
|
|
1559
|
-
useCustomerChangePassword(options?: MutationCallbacks<void>): _tanstack_react_query.UseMutationResult<void, SDKError, {
|
|
1560
|
-
currentPassword: string;
|
|
1561
|
-
newPassword: string;
|
|
1562
|
-
}, unknown>;
|
|
1563
|
-
invalidateCustomerQueries(): Promise<void>;
|
|
1564
|
-
getCustomerData(): CustomerProfile | null | undefined;
|
|
1565
|
-
setCustomerData(data: CustomerProfile | null): void;
|
|
1566
|
-
}
|
|
1567
|
-
|
|
1568
|
-
type ProductListingGroupsQueryOptions = Pick<ApiQueryOptions, 'page' | 'limit' | 'sort' | 'where'>;
|
|
1569
|
-
type ReadOnlyQueryHooks = Omit<QueryHooks, 'useCreate' | 'useUpdate' | 'useRemove'>;
|
|
1570
|
-
/**
|
|
1571
|
-
* Composes CollectionHooks + CustomerHooks into a single API surface.
|
|
1572
|
-
* All methods are delegated; no logic lives here.
|
|
1573
|
-
*/
|
|
1574
|
-
interface ProductDetailCallable {
|
|
1575
|
-
product: {
|
|
1576
|
-
detail: (params: ProductDetailParams) => Promise<ProductDetail | null>;
|
|
1577
|
-
};
|
|
1578
|
-
}
|
|
1579
|
-
declare class QueryHooks extends CollectionHooks {
|
|
1580
|
-
private _customer;
|
|
1581
|
-
private _commerce?;
|
|
1582
|
-
constructor(queryClient: QueryClient, collectionClient: CollectionClient, customerAuth?: CustomerAuth, commerceClient?: ProductDetailCallable);
|
|
1583
|
-
useCustomerMe: CustomerHooks['useCustomerMe'];
|
|
1584
|
-
useCustomerLogin: CustomerHooks['useCustomerLogin'];
|
|
1585
|
-
useCustomerRegister: CustomerHooks['useCustomerRegister'];
|
|
1586
|
-
useCustomerLogout: CustomerHooks['useCustomerLogout'];
|
|
1587
|
-
useCustomerForgotPassword: CustomerHooks['useCustomerForgotPassword'];
|
|
1588
|
-
useCustomerResetPassword: CustomerHooks['useCustomerResetPassword'];
|
|
1589
|
-
useCustomerRefreshToken: CustomerHooks['useCustomerRefreshToken'];
|
|
1590
|
-
useCustomerUpdateProfile: CustomerHooks['useCustomerUpdateProfile'];
|
|
1591
|
-
useCustomerChangePassword: CustomerHooks['useCustomerChangePassword'];
|
|
1592
|
-
invalidateCustomerQueries: CustomerHooks['invalidateCustomerQueries'];
|
|
1593
|
-
getCustomerData: CustomerHooks['getCustomerData'];
|
|
1594
|
-
setCustomerData: CustomerHooks['setCustomerData'];
|
|
1595
|
-
useProductListingGroupsQuery<TData = PayloadFindResponse<ProductListingGroupsItem>>(params: {
|
|
1596
|
-
options?: ProductListingGroupsQueryOptions;
|
|
1597
|
-
}, options?: QueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): UseQueryResult<_tanstack_react_query.NoInfer<TData>, Error>;
|
|
1598
|
-
useSuspenseProductListingGroupsQuery<TData = PayloadFindResponse<ProductListingGroupsItem>>(params: {
|
|
1599
|
-
options?: ProductListingGroupsQueryOptions;
|
|
1600
|
-
}, options?: SuspenseQueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): _tanstack_react_query.UseSuspenseQueryResult<TData, Error>;
|
|
1601
|
-
useInfiniteProductListingGroupsQuery<TData = InfiniteData<PayloadFindResponse<ProductListingGroupsItem>>>(params: {
|
|
1602
|
-
options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>;
|
|
1603
|
-
pageSize?: number;
|
|
1604
|
-
}, options?: InfiniteQueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): _tanstack_react_query.UseInfiniteQueryResult<TData, Error>;
|
|
1605
|
-
useSuspenseInfiniteProductListingGroupsQuery<TData = InfiniteData<PayloadFindResponse<ProductListingGroupsItem>>>(params: {
|
|
1606
|
-
options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>;
|
|
1607
|
-
pageSize?: number;
|
|
1608
|
-
}, options?: SuspenseInfiniteQueryOptions<PayloadFindResponse<ProductListingGroupsItem>, TData>): _tanstack_react_query.UseSuspenseInfiniteQueryResult<TData, Error>;
|
|
1609
|
-
prefetchProductListingGroupsQuery(params: {
|
|
1610
|
-
options?: ProductListingGroupsQueryOptions;
|
|
1611
|
-
}, options?: {
|
|
1612
|
-
staleTime?: number;
|
|
1613
|
-
}): Promise<void>;
|
|
1614
|
-
prefetchInfiniteProductListingGroupsQuery(params: {
|
|
1615
|
-
options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>;
|
|
1616
|
-
pageSize?: number;
|
|
1617
|
-
}, options?: {
|
|
1618
|
-
pages?: number;
|
|
1619
|
-
staleTime?: number;
|
|
1620
|
-
}): Promise<void>;
|
|
1621
|
-
useProductDetail(params: {
|
|
1622
|
-
slug: string;
|
|
1623
|
-
} | {
|
|
1624
|
-
id: string;
|
|
1625
|
-
}, options?: {
|
|
1626
|
-
enabled?: boolean;
|
|
1627
|
-
}): UseQueryResult<ProductDetail | null>;
|
|
1628
|
-
useProductDetailBySlug(slug: string, options?: {
|
|
1629
|
-
enabled?: boolean;
|
|
1630
|
-
}): UseQueryResult<ProductDetail | null>;
|
|
1631
|
-
useProductDetailById(id: string, options?: {
|
|
1632
|
-
enabled?: boolean;
|
|
1633
|
-
}): UseQueryResult<ProductDetail | null>;
|
|
1634
|
-
}
|
|
1635
|
-
|
|
1636
|
-
declare class ServerClient {
|
|
1637
|
-
commerce: ServerCommerceClient;
|
|
1638
|
-
community: CommunityClient & {
|
|
1639
|
-
moderation: {
|
|
1640
|
-
banCustomer: (p: BanCustomerParams) => Promise<CommunityBan>;
|
|
1641
|
-
unbanCustomer: (p: UnbanCustomerParams) => Promise<{
|
|
1642
|
-
success: true;
|
|
1643
|
-
}>;
|
|
1644
|
-
};
|
|
1645
|
-
};
|
|
1646
|
-
query: QueryHooks;
|
|
1647
|
-
collections: ServerCollectionClient;
|
|
1648
|
-
queryClient: QueryClient;
|
|
1649
|
-
lastRequestId: string | null;
|
|
1650
|
-
protected state: ClientState;
|
|
1651
|
-
protected config: ClientServerConfig;
|
|
1652
|
-
constructor(options: ClientServerConfig);
|
|
1653
|
-
getState(): ClientState;
|
|
1654
|
-
getConfig(): Omit<ClientServerConfig, 'secretKey'>;
|
|
1655
|
-
}
|
|
1656
|
-
/**
|
|
1657
|
-
* Create a server-only client with full read/write access. Requires secretKey.
|
|
1658
|
-
* For read-only usage, prefer `createClient()` (no secretKey needed).
|
|
1659
|
-
*/
|
|
1660
|
-
declare function createServerClient(options: ClientServerConfig): ServerClient;
|
|
1661
|
-
|
|
1662
|
-
export { type CustomerAuthResponse as $, type AddItemParams as A, type BanCustomerParams as B, CustomerAuth as C, type ClientMetadata as D, type ClientServerConfig as E, CollectionClient as F, type CollectionDetailQueryParams as G, CollectionHooks as H, type CollectionInfiniteQueryParams as I, CollectionQueryBuilder as J, type CollectionQueryParams as K, type ListingGroupsParams as L, type CommunityBan as M, type CommunityClientOptions as N, type CommunityPost as O, type ProductListingGroupsResponse as P, ConfigError as Q, type RemoveItemParams as R, type StockCheckParams as S, type ConfirmPaymentParams as T, type UpdateItemParams as U, type ValidateDiscountParams as V, type ConfirmPaymentResponse as W, ConflictError as X, type CreateFulfillmentParams as Y, type CreateOrderParams as Z, type CreateReturnParams as _, type CustomerAuthOptions as a, type ServerCommerceClientOptions as a$, CustomerHooks as a0, type CustomerLoginData as a1, type CustomerProfile as a2, type CustomerRefreshResponse as a3, type CustomerRegisterData as a4, type CustomerRegisterResponse as a5, type CustomerSnapshot as a6, type DebugConfig as a7, type DeepPartial as a8, DiscountApi as a9, type ProductListingGroup as aA, type ProductListingGroupSummary as aB, type ProductListingGroupsItem as aC, type ProductListingProductShape as aD, type ProductListingProjection as aE, type ProductOptionMatrix as aF, type ProductOptionMatrixOption as aG, type ProductOptionMatrixValue as aH, type ProductOptionMatrixVariant as aI, type ProductOptionShape as aJ, type ProductOptionValueShape as aK, type ProductVariantShape as aL, QueryHooks as aM, type QueryOptions as aN, RateLimitError as aO, type ReadOnlyQueryBuilder as aP, type RequestOptions as aQ, type RetryConfig as aR, type ReturnItem as aS, type ReturnReason as aT, type ReturnWithRefundParams as aU, SDKError as aV, type ServerApiOptions as aW, ServerClient as aX, ServerCollectionClient as aY, ServerCollectionQueryBuilder as aZ, ServerCommerceClient as a_, type DiscountApiOptions as aa, type ExtractArrayType as ab, type GenerateMetadataOptions as ac, GoneError as ad, type InfiniteQueryOptions as ae, ModerationApi as af, type ModerationApiOptions as ag, NetworkError as ah, NotFoundError as ai, OrderApi as aj, type OrderApiOptions as ak, type PaginationMeta as al, type PayloadMutationResponse as am, PermissionError as an, ProductApi as ao, type ProductApiOptions as ap, type ProductDetailBrand as aq, type ProductDetailCategory as ar, type ProductDetailImage as as, type ProductDetailListing as at, type ProductDetailOption as au, type ProductDetailOptionValue as av, type ProductDetailTag as aw, type ProductDetailVariant as ax, type ProductDetailVariantOptionValue as ay, type ProductDetailVideo as az, type StockCheckResponse as b, ServiceUnavailableError as b0, ShippingApi as b1, type ShippingApiOptions as b2, type StockCheckResult as b3, type SuspenseInfiniteQueryOptions as b4, type SuspenseQueryOptions as b5, TimeoutError as b6, type UnbanCustomerParams as b7, type UpdateFulfillmentParams as b8, type UpdateOrderParams as b9, isServiceUnavailableError as bA, isTimeoutError as bB, isUsageLimitError as bC, isValidationError as bD, normalizeSelectedValueIds as bE, resolveApiUrl as bF, resolveVariantForSelection as bG, type UpdateProfileData as ba, type UpdateReturnParams as bb, type UpdateTransactionParams as bc, UsageLimitError as bd, ValidationError as be, buildProductListingGroupsByOption as bf, buildProductListingProjection as bg, buildProductOptionMatrix as bh, createAuthError as bi, createConflictError as bj, createNotFoundError as bk, createPermissionError as bl, createRateLimitError as bm, createServerClient as bn, getAvailableOptionValues as bo, getSelectedValueByOptionId as bp, isApiError as bq, isAuthError as br, isConfigError as bs, isConflictError as bt, isGoneError as bu, isNetworkError as bv, isNotFoundError as bw, isPermissionError as bx, isRateLimitError as by, isSDKError as bz, type ProductDetailParams as c, type ProductDetail as d, type ApplyDiscountParams as e, type RemoveDiscountParams as f, type ClearCartParams as g, type CheckoutParams as h, type PayloadFindResponse as i, type ValidateDiscountResult as j, type CalculateShippingParams as k, type CalculateShippingResult as l, type ApiQueryOptions as m, type ProductListingGroupsQueryOptions as n, CommunityClient as o, type ReadOnlyQueryHooks as p, ReadOnlyCollectionClient as q, type ClientState as r, type ClientConfig as s, ApiError as t, AuthError as u, BaseApi as v, type BulkImportFulfillmentsParams as w, type BulkImportFulfillmentsResponse as x, CartApi as y, type CartApiOptions as z };
|