@01.software/sdk 0.2.9-dev.260309.c56872d → 0.2.9-dev.260311.892250f

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.
Files changed (58) hide show
  1. package/README.md +21 -8
  2. package/dist/auth.cjs +3 -1
  3. package/dist/auth.cjs.map +1 -1
  4. package/dist/auth.d.cts +36 -3
  5. package/dist/auth.d.ts +36 -3
  6. package/dist/auth.js +3 -1
  7. package/dist/auth.js.map +1 -1
  8. package/dist/index.cjs +252 -258
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.cts +324 -161
  11. package/dist/index.d.ts +324 -161
  12. package/dist/index.js +255 -258
  13. package/dist/index.js.map +1 -1
  14. package/dist/{payload-types-2wbfaDxp.d.cts → payload-types-BjvBwB8Z.d.cts} +1633 -507
  15. package/dist/{payload-types-2wbfaDxp.d.ts → payload-types-BjvBwB8Z.d.ts} +1633 -507
  16. package/dist/ui/code-block.cjs +182 -0
  17. package/dist/ui/code-block.cjs.map +1 -0
  18. package/dist/ui/code-block.d.cts +62 -0
  19. package/dist/ui/code-block.d.ts +62 -0
  20. package/dist/ui/code-block.js +152 -0
  21. package/dist/ui/code-block.js.map +1 -0
  22. package/dist/{flow.cjs → ui/flow.cjs} +120 -96
  23. package/dist/ui/flow.cjs.map +1 -0
  24. package/dist/{flow.d.cts → ui/flow.d.cts} +27 -11
  25. package/dist/{flow.d.ts → ui/flow.d.ts} +27 -11
  26. package/dist/{flow.js → ui/flow.js} +119 -94
  27. package/dist/ui/flow.js.map +1 -0
  28. package/dist/{components.cjs → ui/form.cjs} +27 -520
  29. package/dist/ui/form.cjs.map +1 -0
  30. package/dist/ui/form.d.cts +37 -0
  31. package/dist/ui/form.d.ts +37 -0
  32. package/dist/{components.js → ui/form.js} +20 -516
  33. package/dist/ui/form.js.map +1 -0
  34. package/dist/ui/image.cjs +208 -0
  35. package/dist/ui/image.cjs.map +1 -0
  36. package/dist/ui/image.d.cts +44 -0
  37. package/dist/ui/image.d.ts +44 -0
  38. package/dist/ui/image.js +180 -0
  39. package/dist/ui/image.js.map +1 -0
  40. package/dist/ui/rich-text.cjs +258 -0
  41. package/dist/ui/rich-text.cjs.map +1 -0
  42. package/dist/ui/rich-text.d.cts +110 -0
  43. package/dist/ui/rich-text.d.ts +110 -0
  44. package/dist/ui/rich-text.js +235 -0
  45. package/dist/ui/rich-text.js.map +1 -0
  46. package/dist/{webhook-I6ZDGW1d.d.ts → webhook-CszIpUKn.d.cts} +2 -2
  47. package/dist/{webhook-Byzl1A0g.d.cts → webhook-_LdLdjGa.d.ts} +2 -2
  48. package/dist/webhook.d.cts +2 -2
  49. package/dist/webhook.d.ts +2 -2
  50. package/package.json +66 -33
  51. package/dist/auth-BieKA-OQ.d.ts +0 -298
  52. package/dist/auth-CAV8xgZk.d.cts +0 -298
  53. package/dist/components.cjs.map +0 -1
  54. package/dist/components.d.cts +0 -240
  55. package/dist/components.d.ts +0 -240
  56. package/dist/components.js.map +0 -1
  57. package/dist/flow.cjs.map +0 -1
  58. package/dist/flow.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,20 +1,228 @@
1
- import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, E as Exchange, C as Cart, c as CartItem, P as Product } from './payload-types-2wbfaDxp.cjs';
2
- export { m as ApiUsage, ap as ApiUsageSelect, A as Audience, al as AudiencesSelect, bm as Auth, o as BillingHistory, ar as BillingHistorySelect, w as Brand, B as BrandLogo, aB as BrandLogosSelect, aA as BrandsSelect, aT as CartItemsSelect, aS as CartsSelect, g as CodeBlock, bl as CollectionsWidget, d as Config, y as Customer, G as CustomerAddress, aP as CustomerAddressesSelect, e as CustomerAuthOperations, z as CustomerGroup, D as CustomerGroupImage, aR as CustomerGroupImagesSelect, aQ as CustomerGroupsSelect, aO as CustomersSelect, N as Discount, aU as DiscountsSelect, Z as Document, a$ as DocumentCategoriesSelect, a0 as DocumentCategory, $ as DocumentImage, b1 as DocumentImagesSelect, _ as DocumentType, b0 as DocumentTypesSelect, a_ as DocumentsSelect, j as EmailLog, am as EmailLogsSelect, K as ExchangeProduct, aM as ExchangeProductsSelect, aL as ExchangesSelect, a7 as Flow, a9 as FlowEdgeType, ba as FlowEdgeTypesSelect, aa as FlowImage, bb as FlowImagesSelect, a8 as FlowNodeType, b9 as FlowNodeTypesSelect, b8 as FlowsSelect, F as Form, ae as FormSubmission, bg as FormSubmissionsSelect, bf as FormsSelect, H as FulfillmentItem, aI as FulfillmentItemsSelect, aH as FulfillmentsSelect, b5 as GalleriesSelect, a4 as Gallery, b7 as GalleryCategoriesSelect, a6 as GalleryCategory, a5 as GalleryImage, b6 as GalleryImagesSelect, I as IframeBlock, ac as LiveStream, ad as LiveStreamImage, be as LiveStreamImagesSelect, bd as LiveStreamsSelect, M as Media, ak as MediaSelect, a2 as Music, b3 as MusicsSelect, aE as OrderProductsSelect, L as OrderStatusLog, aG as OrderStatusLogsSelect, aD as OrdersSelect, af as PayloadKv, bh as PayloadKvSelect, ag as PayloadLockedDocument, bi as PayloadLockedDocumentsSelect, ai as PayloadMigration, bk as PayloadMigrationsSelect, ah as PayloadPreference, bj as PayloadPreferencesSelect, f as PlayerBlock, a1 as Playlist, a3 as PlaylistImage, b4 as PlaylistImagesSelect, b2 as PlaylistsSelect, Q as Post, W as PostAuthor, aW as PostAuthorsSelect, aX as PostCategoriesSelect, X as PostCategory, V as PostImage, aZ as PostImagesSelect, Y as PostTag, aY as PostTagsSelect, aV as PostsSelect, ax as ProductCategoriesSelect, t as ProductCategory, v as ProductCollection, az as ProductCollectionsSelect, q as ProductImage, aC as ProductImagesSelect, s as ProductOption, aw as ProductOptionsSelect, u as ProductTag, ay as ProductTagsSelect, r as ProductVariant, av as ProductVariantsSelect, au as ProductsSelect, J as ReturnProduct, aK as ReturnProductsSelect, aJ as ReturnsSelect, aN as ShippingPoliciesSelect, x as ShippingPolicy, n as Subscription, aq as SubscriptionsSelect, S as SupportedTimezones, i as Tenant, p as TenantLogo, as as TenantLogosSelect, ao as TenantMetadataSelect, k as TenantMetadatum, l as TenantOgImage, at as TenantOgImagesSelect, an as TenantsSelect, aF as TransactionsSelect, h as User, U as UserAuthOperations, aj as UsersSelect, ab as Video, bc as VideosSelect } from './payload-types-2wbfaDxp.cjs';
3
- import { F as FetchOptions, A as ApiQueryOptions, P as PayloadFindResponse, a as PayloadMutationResponse, S as SDKError, C as ClientBrowserConfig, b as ClientState, c as ClientServerConfig } from './auth-CAV8xgZk.cjs';
4
- export { x as API_URLS, f as ApiError, H as ApiQueryReactOptions, z as ClientMetadata, g as ConfigError, d as DebugConfig, D as DeepPartial, w as Environment, e as ErrorLogger, E as ExtractArrayType, G as GoneError, J as JwtPayload, N as NetworkError, B as PaginationMeta, R as RetryConfig, h as ServiceUnavailableError, T as TimeoutError, U as UsageLimitError, V as ValidationError, t as createApiKey, r as createServerToken, s as decodeServerToken, l as isApiError, m as isConfigError, o as isGoneError, j as isNetworkError, i as isSDKError, p as isServiceUnavailableError, n as isTimeoutError, q as isUsageLimitError, k as isValidationError, u as parseApiKey, y as resolveApiUrl, v as verifyServerToken } from './auth-CAV8xgZk.cjs';
1
+ import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, E as Exchange, C as Cart, c as CartItem, P as Product } from './payload-types-BjvBwB8Z.cjs';
2
+ export { n as ApiUsage, az as ApiUsageSelect, A as Audience, av as AudiencesSelect, bE as Auth, p as BillingHistory, aB as BillingHistorySelect, D as Brand, B as BrandLogo, aL as BrandLogosSelect, aK as BrandsSelect, b1 as CartItemsSelect, b0 as CartsSelect, g as CodeBlock, bD as CollectionsWidget, d as Config, J as Customer, Q as CustomerAddress, aZ as CustomerAddressesSelect, e as CustomerAuthOperations, K as CustomerGroup, N as CustomerGroupImage, a$ as CustomerGroupImagesSelect, a_ as CustomerGroupsSelect, aY as CustomersSelect, _ as Discount, b2 as DiscountsSelect, a4 as Document, b9 as DocumentCategoriesSelect, a7 as DocumentCategory, a5 as DocumentImage, bb as DocumentImagesSelect, a6 as DocumentType, ba as DocumentTypesSelect, b8 as DocumentsSelect, k as EmailLog, aw as EmailLogsSelect, Y as ExchangeProduct, aW as ExchangeProductsSelect, aV as ExchangesSelect, j as FieldConfig, at as FieldConfigsSelect, ah as Flow, bo as FlowCategoriesSelect, ai as FlowCategory, am as FlowEdgeType, bn as FlowEdgeTypesSelect, aj as FlowImage, bp as FlowImagesSelect, al as FlowNodeType, bm as FlowNodeTypesSelect, ak as FlowTag, bq as FlowTagsSelect, bl as FlowsSelect, F as Form, an as FormSubmission, by as FormSubmissionsSelect, bx as FormsSelect, W as FulfillmentItem, aS as FulfillmentItemsSelect, aR as FulfillmentsSelect, bh as GalleriesSelect, ad as Gallery, bj as GalleryCategoriesSelect, ae as GalleryCategory, af as GalleryImage, bi as GalleryImagesSelect, ag as GalleryTag, bk as GalleryTagsSelect, I as IframeBlock, L as LiveStream, s as LiveStreamImage, bw as LiveStreamImagesSelect, bv as LiveStreamsSelect, M as Media, au as MediaSelect, ac as Music, bf as MusicsSelect, aO as OrderProductsSelect, Z as OrderStatusLog, aQ as OrderStatusLogsSelect, aN as OrdersSelect, ao as PayloadKv, bz as PayloadKvSelect, ap as PayloadLockedDocument, bA as PayloadLockedDocumentsSelect, ar as PayloadMigration, bC as PayloadMigrationsSelect, aq as PayloadPreference, bB as PayloadPreferencesSelect, f as PlayerBlock, a8 as Playlist, bd as PlaylistCategoriesSelect, a9 as PlaylistCategory, aa as PlaylistImage, bg as PlaylistImagesSelect, ab as PlaylistTag, be as PlaylistTagsSelect, bc as PlaylistsSelect, $ as Post, a0 as PostAuthor, b4 as PostAuthorsSelect, b5 as PostCategoriesSelect, a2 as PostCategory, a1 as PostImage, b7 as PostImagesSelect, a3 as PostTag, b6 as PostTagsSelect, b3 as PostsSelect, aH as ProductCategoriesSelect, y as ProductCategory, H as ProductCollection, aJ as ProductCollectionsSelect, r as ProductImage, aM as ProductImagesSelect, x as ProductOption, aG as ProductOptionsSelect, z as ProductTag, aI as ProductTagsSelect, w as ProductVariant, aF as ProductVariantsSelect, aE as ProductsSelect, X as ReturnProduct, aU as ReturnProductsSelect, aT as ReturnsSelect, aX as ShippingPoliciesSelect, G as ShippingPolicy, o as Subscription, aA as SubscriptionsSelect, S as SupportedTimezones, i as Tenant, q as TenantLogo, aC as TenantLogosSelect, ay as TenantMetadataSelect, l as TenantMetadatum, m as TenantOgImage, aD as TenantOgImagesSelect, ax as TenantsSelect, aP as TransactionsSelect, h as User, U as UserAuthOperations, as as UsersSelect, V as Video, bs as VideoCategoriesSelect, u as VideoCategory, t as VideoImage, bu as VideoImagesSelect, v as VideoTag, bt as VideoTagsSelect, br as VideosSelect } from './payload-types-BjvBwB8Z.cjs';
3
+ import { Sort, Where } from 'payload';
5
4
  import * as _tanstack_react_query from '@tanstack/react-query';
6
5
  import { QueryClient } from '@tanstack/react-query';
7
- import { P as PublicCollection, C as CollectionType } from './webhook-Byzl1A0g.cjs';
8
- export { b as COLLECTIONS, a as Collection, c as WebhookEvent, d as WebhookHandler, W as WebhookOperation, e as WebhookOptions, f as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-Byzl1A0g.cjs';
6
+ import { P as PublicCollection, C as CollectionType } from './webhook-CszIpUKn.cjs';
7
+ export { b as COLLECTIONS, a as Collection, c as WebhookEvent, d as WebhookHandler, W as WebhookOperation, e as WebhookOptions, f as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-CszIpUKn.cjs';
9
8
  import { Metadata } from 'next';
10
9
  export { b as IMAGE_SIZES, I as ImageData, a as ImagePalette, f as ImagePlaceholderOptions, d as getImageLqip, e as getImagePalette, h as getImagePlaceholderStyle, c as getImageSrcSet, g as getImageUrl } from './image-TT8lTsk5.cjs';
11
- import 'payload';
10
+ export { JwtPayload, createApiKey, createServerToken, decodeServerToken, parseApiKey, verifyServerToken } from './auth.cjs';
12
11
 
13
- interface OrderApiOptions {
12
+ declare class SDKError extends Error {
13
+ readonly code: string;
14
+ readonly status?: number;
15
+ readonly details?: unknown;
16
+ readonly userMessage?: string;
17
+ readonly suggestion?: string;
18
+ constructor(code: string, message: string, status?: number, details?: unknown, userMessage?: string, suggestion?: string);
19
+ getUserMessage(): string;
20
+ toJSON(): {
21
+ name: string;
22
+ code: string;
23
+ message: string;
24
+ status: number | undefined;
25
+ details: unknown;
26
+ userMessage: string | undefined;
27
+ suggestion: string | undefined;
28
+ };
29
+ }
30
+ declare class NetworkError extends SDKError {
31
+ constructor(message: string, status?: number, details?: unknown, userMessage?: string, suggestion?: string);
32
+ }
33
+ declare class ValidationError extends SDKError {
34
+ constructor(message: string, details?: unknown, userMessage?: string, suggestion?: string);
35
+ }
36
+ declare class ApiError extends SDKError {
37
+ constructor(message: string, status: number, details?: unknown, userMessage?: string, suggestion?: string);
38
+ }
39
+ declare class ConfigError extends SDKError {
40
+ constructor(message: string, details?: unknown, userMessage?: string, suggestion?: string);
41
+ }
42
+ declare class TimeoutError extends SDKError {
43
+ constructor(message?: string, details?: unknown, userMessage?: string, suggestion?: string);
44
+ }
45
+ declare class GoneError extends SDKError {
46
+ constructor(message?: string, details?: unknown, userMessage?: string, suggestion?: string);
47
+ }
48
+ declare class ServiceUnavailableError extends SDKError {
49
+ readonly retryAfter?: number;
50
+ constructor(message?: string, retryAfter?: number, details?: unknown, userMessage?: string, suggestion?: string);
51
+ }
52
+ declare class UsageLimitError extends SDKError {
53
+ readonly usage: {
54
+ limit: number;
55
+ current: number;
56
+ remaining: number;
57
+ };
58
+ constructor(message: string, usage: {
59
+ limit: number;
60
+ current: number;
61
+ remaining: number;
62
+ }, details?: unknown, userMessage?: string, suggestion?: string);
63
+ toJSON(): {
64
+ usage: {
65
+ limit: number;
66
+ current: number;
67
+ remaining: number;
68
+ };
69
+ name: string;
70
+ code: string;
71
+ message: string;
72
+ status: number | undefined;
73
+ details: unknown;
74
+ userMessage: string | undefined;
75
+ suggestion: string | undefined;
76
+ };
77
+ }
78
+ declare function isSDKError(error: unknown): error is SDKError;
79
+ declare function isNetworkError(error: unknown): error is NetworkError;
80
+ declare function isValidationError(error: unknown): error is ValidationError;
81
+ declare function isApiError(error: unknown): error is ApiError;
82
+ declare function isConfigError(error: unknown): error is ConfigError;
83
+ declare function isTimeoutError(error: unknown): error is TimeoutError;
84
+ declare function isGoneError(error: unknown): error is GoneError;
85
+ declare function isServiceUnavailableError(error: unknown): error is ServiceUnavailableError;
86
+ declare function isUsageLimitError(error: unknown): error is UsageLimitError;
87
+
88
+ type Environment = 'local' | 'development' | 'staging' | 'production';
89
+ declare const API_URLS: Record<Environment, string>;
90
+ /**
91
+ * 환경에 맞는 API URL을 반환합니다.
92
+ * 우선순위: baseUrl > environment > 환경변수 > 기본값(production)
93
+ */
94
+ declare function resolveApiUrl(config?: {
95
+ baseUrl?: string;
96
+ environment?: Environment;
97
+ }): string;
98
+ interface ClientBrowserConfig {
99
+ clientKey: string;
100
+ /**
101
+ * API 환경 설정.
102
+ * - 'local': localhost:3000
103
+ * - 'development': dev.01.software
104
+ * - 'staging': stg.01.software
105
+ * - 'production': api.01.software
106
+ *
107
+ * baseUrl이 설정되면 이 값은 무시됩니다.
108
+ * @default 'production'
109
+ */
110
+ environment?: Environment;
111
+ /**
112
+ * 커스텀 API URL. 설정 시 environment 값은 무시됩니다.
113
+ * @example 'https://my-custom-api.example.com'
114
+ */
115
+ baseUrl?: string;
116
+ /**
117
+ * Customer authentication options.
118
+ * Used to initialize CustomerAuth on BrowserClient.
119
+ */
120
+ customer?: {
121
+ /**
122
+ * Automatically persist token in localStorage.
123
+ * - `true`: uses default key `'customer-token'`
124
+ * - `string`: uses the given string as localStorage key
125
+ *
126
+ * Handles SSR safely (no-op on server).
127
+ * When set, `token` and `onTokenChange` are ignored.
128
+ */
129
+ persist?: boolean | string;
130
+ /** Initial token (e.g. from SSR cookie) */
131
+ token?: string;
132
+ /** Called when token changes (login/logout) — use to persist in localStorage/cookie */
133
+ onTokenChange?: (token: string | null) => void;
134
+ };
135
+ }
136
+ interface ClientServerConfig extends ClientBrowserConfig {
137
+ secretKey: string;
138
+ }
139
+ interface ClientMetadata {
140
+ userAgent?: string;
141
+ timestamp: number;
142
+ }
143
+ interface ClientState {
144
+ metadata: ClientMetadata;
145
+ }
146
+ interface PaginationMeta {
147
+ page: number;
148
+ limit: number;
149
+ totalDocs: number;
150
+ totalPages: number;
151
+ hasNextPage: boolean;
152
+ hasPrevPage: boolean;
153
+ pagingCounter: number;
154
+ prevPage: number | null;
155
+ nextPage: number | null;
156
+ }
157
+ /**
158
+ * Payload CMS Find (List) Response
159
+ * GET /api/{collection}
160
+ */
161
+ interface PayloadFindResponse<T = unknown> {
162
+ docs: T[];
163
+ totalDocs: number;
164
+ limit: number;
165
+ totalPages: number;
166
+ page: number;
167
+ pagingCounter: number;
168
+ hasPrevPage: boolean;
169
+ hasNextPage: boolean;
170
+ prevPage: number | null;
171
+ nextPage: number | null;
172
+ }
173
+ /**
174
+ * Payload CMS Create/Update Response
175
+ * POST /api/{collection}
176
+ * PATCH /api/{collection}/{id}
177
+ */
178
+ interface PayloadMutationResponse<T = unknown> {
179
+ message: string;
180
+ doc: T;
181
+ errors?: unknown[];
182
+ }
183
+ interface ApiQueryOptions {
184
+ page?: number;
185
+ limit?: number;
186
+ sort?: Sort;
187
+ where?: Where;
188
+ depth?: number;
189
+ select?: Record<string, boolean>;
190
+ }
191
+ interface ApiQueryReactOptions {
192
+ keepPreviousData?: boolean;
193
+ }
194
+ interface DebugConfig {
195
+ logRequests?: boolean;
196
+ logResponses?: boolean;
197
+ logErrors?: boolean;
198
+ }
199
+ interface RetryConfig {
200
+ maxRetries?: number;
201
+ retryableStatuses?: number[];
202
+ retryDelay?: (attempt: number) => number;
203
+ }
204
+ interface ErrorLogger {
205
+ log(error: SDKError | Error, context?: Record<string, unknown>): void;
206
+ }
207
+ type DeepPartial<T> = {
208
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
209
+ };
210
+ type ExtractArrayType<T> = T extends (infer U)[] ? U : never;
211
+
212
+ interface ServerApiOptions {
14
213
  clientKey: string;
15
214
  secretKey: string;
16
215
  baseUrl?: string;
17
216
  }
217
+ declare abstract class BaseApi {
218
+ protected readonly clientKey: string;
219
+ protected readonly secretKey: string;
220
+ protected readonly baseUrl?: string;
221
+ constructor(apiName: string, options: ServerApiOptions);
222
+ protected request<T>(endpoint: string, body: unknown): Promise<T>;
223
+ }
224
+
225
+ type OrderApiOptions = ServerApiOptions;
18
226
  type CreateOrderParams = {
19
227
  orderNumber: string;
20
228
  customer?: string;
@@ -26,6 +234,7 @@ type CreateOrderParams = {
26
234
  shippingAddress: Order['shippingAddress'];
27
235
  orderProducts: Omit<OrderProduct, 'id' | 'brand' | 'createdAt' | 'updatedAt' | 'order' | 'status'>[];
28
236
  totalAmount: number;
237
+ shippingFee?: number;
29
238
  paymentId?: string;
30
239
  discountCode?: string;
31
240
  };
@@ -133,12 +342,8 @@ type UpdateExchangeParams = {
133
342
  exchangeId: string;
134
343
  status: 'processing' | 'shipped' | 'completed' | 'rejected';
135
344
  };
136
- declare class OrderApi {
137
- private readonly clientKey;
138
- private readonly secretKey;
139
- private readonly baseUrl?;
345
+ declare class OrderApi extends BaseApi {
140
346
  constructor(options: OrderApiOptions);
141
- private request;
142
347
  createOrder(params: CreateOrderParams): Promise<Order>;
143
348
  updateOrder(params: UpdateOrderParams): Promise<Order>;
144
349
  getOrder(params: GetOrderParams): Promise<Order>;
@@ -210,11 +415,7 @@ declare class CartApi {
210
415
  }>;
211
416
  }
212
417
 
213
- interface ProductApiOptions {
214
- clientKey: string;
215
- secretKey: string;
216
- baseUrl?: string;
217
- }
418
+ type ProductApiOptions = ServerApiOptions;
218
419
  type StockCheckParams = {
219
420
  items: Array<{
220
421
  optionId: string;
@@ -232,21 +433,27 @@ type StockCheckResponse = {
232
433
  results: StockCheckResult[];
233
434
  allAvailable: boolean;
234
435
  };
235
- declare class ProductApi {
236
- private readonly clientKey;
237
- private readonly secretKey;
238
- private readonly baseUrl?;
436
+ declare class ProductApi extends BaseApi {
239
437
  constructor(options: ProductApiOptions);
240
- private request;
241
438
  stockCheck(params: StockCheckParams): Promise<StockCheckResponse>;
242
439
  }
243
440
 
244
441
  interface GenerateMetadataOptions {
245
- title?: string;
246
- description?: string;
247
442
  siteName?: string;
248
443
  }
249
444
 
445
+ interface FetchOptions extends RequestInit {
446
+ clientKey?: string;
447
+ secretKey?: string;
448
+ customerToken?: string;
449
+ timeout?: number;
450
+ baseUrl?: string;
451
+ debug?: boolean | DebugConfig;
452
+ retry?: RetryConfig;
453
+ /** Called on 401 when customerToken is set. Return a new token to retry, or null to fail. */
454
+ onUnauthorized?: () => Promise<string | null>;
455
+ }
456
+
250
457
  declare class HttpClient {
251
458
  protected clientKey: string;
252
459
  protected secretKey?: string;
@@ -528,7 +735,7 @@ declare class CustomerAuth {
528
735
  page?: number;
529
736
  limit?: number;
530
737
  status?: string;
531
- }): Promise<unknown>;
738
+ }): Promise<PayloadFindResponse<Order>>;
532
739
  /**
533
740
  * Get the current token (or null if not authenticated)
534
741
  */
@@ -548,19 +755,6 @@ declare class CustomerAuth {
548
755
  private requestJson;
549
756
  }
550
757
 
551
- declare function collectionKeys<T extends PublicCollection>(collection: T): {
552
- all: readonly [T];
553
- lists: () => readonly [T, "list"];
554
- list: (options?: ApiQueryOptions) => readonly [T, "list", ApiQueryOptions | undefined];
555
- details: () => readonly [T, "detail"];
556
- detail: (id: string, options?: ApiQueryOptions) => readonly [T, "detail", string, ApiQueryOptions | undefined];
557
- infinites: () => readonly [T, "infinite"];
558
- infinite: (options?: Omit<ApiQueryOptions, "page">) => readonly [T, "infinite", Omit<ApiQueryOptions, "page"> | undefined];
559
- };
560
- declare const customerKeys: {
561
- all: readonly ["customer"];
562
- me: () => readonly ["customer", "me"];
563
- };
564
758
  interface CollectionQueryParams<T extends PublicCollection> {
565
759
  collection: T;
566
760
  options?: ApiQueryOptions;
@@ -575,62 +769,31 @@ interface CollectionInfiniteQueryParams<T extends PublicCollection> {
575
769
  options?: Omit<ApiQueryOptions, 'page'>;
576
770
  pageSize?: number;
577
771
  }
578
- type ReadOnlyQueryHooks = Omit<QueryHooks, 'useCreate' | 'useUpdate' | 'useRemove'>;
579
- declare class QueryHooks {
580
- private queryClient;
581
- private collectionClient;
582
- private customerAuth?;
583
- constructor(queryClient: QueryClient, collectionClient: CollectionClient, customerAuth?: CustomerAuth);
584
- private ensureCustomerAuth;
585
- useQuery<T extends PublicCollection>(params: CollectionQueryParams<T>, options?: {
586
- enabled?: boolean;
587
- staleTime?: number;
588
- gcTime?: number;
589
- refetchOnWindowFocus?: boolean;
590
- refetchOnMount?: boolean;
591
- refetchInterval?: number | false;
592
- retry?: boolean | number;
593
- }): _tanstack_react_query.UseQueryResult<CollectionType<T>[], Error>;
594
- useSuspenseQuery<T extends PublicCollection>(params: CollectionQueryParams<T>, options?: {
595
- staleTime?: number;
596
- gcTime?: number;
597
- refetchOnWindowFocus?: boolean;
598
- refetchOnMount?: boolean;
599
- refetchInterval?: number | false;
600
- retry?: boolean | number;
601
- }): _tanstack_react_query.UseSuspenseQueryResult<CollectionType<T>[], Error>;
602
- useQueryById<T extends PublicCollection>(params: CollectionDetailQueryParams<T>, options?: {
603
- enabled?: boolean;
604
- staleTime?: number;
605
- gcTime?: number;
606
- refetchOnWindowFocus?: boolean;
607
- refetchOnMount?: boolean;
608
- refetchInterval?: number | false;
609
- retry?: boolean | number;
610
- }): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<CollectionType<T>>, Error>;
611
- useSuspenseQueryById<T extends PublicCollection>(params: CollectionDetailQueryParams<T>, options?: {
612
- staleTime?: number;
613
- gcTime?: number;
614
- refetchOnWindowFocus?: boolean;
615
- refetchOnMount?: boolean;
616
- refetchInterval?: number | false;
617
- retry?: boolean | number;
618
- }): _tanstack_react_query.UseSuspenseQueryResult<CollectionType<T>, Error>;
619
- useInfiniteQuery<T extends PublicCollection>(params: CollectionInfiniteQueryParams<T>, options?: {
620
- enabled?: boolean;
621
- staleTime?: number;
622
- gcTime?: number;
623
- refetchOnWindowFocus?: boolean;
624
- refetchOnMount?: boolean;
625
- retry?: boolean | number;
626
- }): _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<PayloadFindResponse<CollectionType<T>>, unknown>, Error>;
627
- useSuspenseInfiniteQuery<T extends PublicCollection>(params: CollectionInfiniteQueryParams<T>, options?: {
628
- staleTime?: number;
629
- gcTime?: number;
630
- refetchOnWindowFocus?: boolean;
631
- refetchOnMount?: boolean;
632
- retry?: boolean | number;
633
- }): _tanstack_react_query.UseSuspenseInfiniteQueryResult<_tanstack_react_query.InfiniteData<PayloadFindResponse<CollectionType<T>>, unknown>, Error>;
772
+ interface QueryOptions {
773
+ enabled?: boolean;
774
+ staleTime?: number;
775
+ gcTime?: number;
776
+ refetchOnWindowFocus?: boolean;
777
+ refetchOnMount?: boolean;
778
+ refetchInterval?: number | false;
779
+ retry?: boolean | number;
780
+ }
781
+ type SuspenseQueryOptions = Omit<QueryOptions, 'enabled'>;
782
+ interface MutationCallbacks$1<TData> {
783
+ onSuccess?: (data: TData) => void;
784
+ onError?: (error: SDKError) => void;
785
+ onSettled?: () => void;
786
+ }
787
+ declare class CollectionHooks {
788
+ protected queryClient: QueryClient;
789
+ protected collectionClient: CollectionClient;
790
+ constructor(queryClient: QueryClient, collectionClient: CollectionClient);
791
+ useQuery<T extends PublicCollection>(params: CollectionQueryParams<T>, options?: QueryOptions): _tanstack_react_query.UseQueryResult<CollectionType<T>[], Error>;
792
+ useSuspenseQuery<T extends PublicCollection>(params: CollectionQueryParams<T>, options?: SuspenseQueryOptions): _tanstack_react_query.UseSuspenseQueryResult<CollectionType<T>[], Error>;
793
+ useQueryById<T extends PublicCollection>(params: CollectionDetailQueryParams<T>, options?: QueryOptions): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<CollectionType<T>>, Error>;
794
+ useSuspenseQueryById<T extends PublicCollection>(params: CollectionDetailQueryParams<T>, options?: SuspenseQueryOptions): _tanstack_react_query.UseSuspenseQueryResult<CollectionType<T>, Error>;
795
+ useInfiniteQuery<T extends PublicCollection>(params: CollectionInfiniteQueryParams<T>, options?: QueryOptions): _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<PayloadFindResponse<CollectionType<T>>, unknown>, Error>;
796
+ useSuspenseInfiniteQuery<T extends PublicCollection>(params: CollectionInfiniteQueryParams<T>, options?: SuspenseQueryOptions): _tanstack_react_query.UseSuspenseInfiniteQueryResult<_tanstack_react_query.InfiniteData<PayloadFindResponse<CollectionType<T>>, unknown>, Error>;
634
797
  prefetchQuery<T extends PublicCollection>(params: CollectionQueryParams<T>, options?: {
635
798
  staleTime?: number;
636
799
  }): Promise<void>;
@@ -643,22 +806,14 @@ declare class QueryHooks {
643
806
  }): Promise<void>;
644
807
  useCreate<T extends PublicCollection>(params: {
645
808
  collection: T;
646
- }, options?: {
647
- onSuccess?: (data: PayloadMutationResponse<CollectionType<T>>) => void;
648
- onError?: (error: SDKError) => void;
649
- onSettled?: () => void;
650
- }): _tanstack_react_query.UseMutationResult<PayloadMutationResponse<CollectionType<T>>, SDKError, {
809
+ }, options?: MutationCallbacks$1<PayloadMutationResponse<CollectionType<T>>>): _tanstack_react_query.UseMutationResult<PayloadMutationResponse<CollectionType<T>>, SDKError, {
651
810
  data: Partial<CollectionType<T>>;
652
811
  file?: File | Blob;
653
812
  filename?: string;
654
813
  }, unknown>;
655
814
  useUpdate<T extends PublicCollection>(params: {
656
815
  collection: T;
657
- }, options?: {
658
- onSuccess?: (data: PayloadMutationResponse<CollectionType<T>>) => void;
659
- onError?: (error: SDKError) => void;
660
- onSettled?: () => void;
661
- }): _tanstack_react_query.UseMutationResult<PayloadMutationResponse<CollectionType<T>>, SDKError, {
816
+ }, options?: MutationCallbacks$1<PayloadMutationResponse<CollectionType<T>>>): _tanstack_react_query.UseMutationResult<PayloadMutationResponse<CollectionType<T>>, SDKError, {
662
817
  id: string;
663
818
  data: Partial<CollectionType<T>>;
664
819
  file?: File | Blob;
@@ -666,16 +821,25 @@ declare class QueryHooks {
666
821
  }, unknown>;
667
822
  useRemove<T extends PublicCollection>(params: {
668
823
  collection: T;
669
- }, options?: {
670
- onSuccess?: (data: CollectionType<T>) => void;
671
- onError?: (error: SDKError) => void;
672
- onSettled?: () => void;
673
- }): _tanstack_react_query.UseMutationResult<CollectionType<T>, SDKError, string, unknown>;
824
+ }, options?: MutationCallbacks$1<CollectionType<T>>): _tanstack_react_query.UseMutationResult<CollectionType<T>, SDKError, string, unknown>;
674
825
  invalidateQueries<T extends PublicCollection>(collection: T, type?: 'list' | 'detail' | 'infinite'): Promise<void>;
675
826
  getQueryData<T extends PublicCollection>(collection: T, type: 'list', options?: ApiQueryOptions): CollectionType<T>[] | undefined;
676
827
  getQueryData<T extends PublicCollection>(collection: T, type: 'detail', id: string, options?: ApiQueryOptions): CollectionType<T> | null | undefined;
677
828
  setQueryData<T extends PublicCollection>(collection: T, type: 'list', data: CollectionType<T>[], options?: ApiQueryOptions): void;
678
829
  setQueryData<T extends PublicCollection>(collection: T, type: 'detail', id: string, data: CollectionType<T> | null, options?: ApiQueryOptions): void;
830
+ }
831
+
832
+ interface MutationCallbacks<TData> {
833
+ onSuccess?: (data: TData) => void;
834
+ onError?: (error: SDKError) => void;
835
+ onSettled?: () => void;
836
+ }
837
+ declare class CustomerHooks {
838
+ private queryClient;
839
+ private customerAuth?;
840
+ constructor(queryClient: QueryClient, customerAuth?: CustomerAuth);
841
+ private ensureCustomerAuth;
842
+ private invalidateMe;
679
843
  useCustomerMe(options?: {
680
844
  enabled?: boolean;
681
845
  staleTime?: number;
@@ -685,58 +849,22 @@ declare class QueryHooks {
685
849
  refetchInterval?: number | false;
686
850
  retry?: boolean | number;
687
851
  }): _tanstack_react_query.UseQueryResult<CustomerProfile | null, Error>;
688
- useCustomerLogin(options?: {
689
- onSuccess?: (data: CustomerAuthResponse) => void;
690
- onError?: (error: SDKError) => void;
691
- onSettled?: () => void;
692
- }): _tanstack_react_query.UseMutationResult<CustomerAuthResponse, SDKError, CustomerLoginData, unknown>;
693
- useCustomerRegister(options?: {
694
- onSuccess?: (data: {
695
- customer: CustomerProfile;
696
- }) => void;
697
- onError?: (error: SDKError) => void;
698
- onSettled?: () => void;
699
- }): _tanstack_react_query.UseMutationResult<{
852
+ useCustomerLogin(options?: MutationCallbacks<CustomerAuthResponse>): _tanstack_react_query.UseMutationResult<CustomerAuthResponse, SDKError, CustomerLoginData, unknown>;
853
+ useCustomerRegister(options?: MutationCallbacks<{
854
+ customer: CustomerProfile;
855
+ }>): _tanstack_react_query.UseMutationResult<{
700
856
  customer: CustomerProfile;
701
857
  }, SDKError, CustomerRegisterData, unknown>;
702
- useCustomerLogout(options?: {
703
- onSuccess?: () => void;
704
- onError?: (error: SDKError) => void;
705
- onSettled?: () => void;
706
- }): _tanstack_react_query.UseMutationResult<void, SDKError, void, unknown>;
707
- useCustomerForgotPassword(options?: {
708
- onSuccess?: () => void;
709
- onError?: (error: SDKError) => void;
710
- onSettled?: () => void;
711
- }): _tanstack_react_query.UseMutationResult<void, SDKError, string, unknown>;
712
- useCustomerResetPassword(options?: {
713
- onSuccess?: () => void;
714
- onError?: (error: SDKError) => void;
715
- onSettled?: () => void;
716
- }): _tanstack_react_query.UseMutationResult<void, SDKError, {
858
+ useCustomerLogout(options?: MutationCallbacks<void>): _tanstack_react_query.UseMutationResult<void, SDKError, void, unknown>;
859
+ useCustomerForgotPassword(options?: MutationCallbacks<void>): _tanstack_react_query.UseMutationResult<void, SDKError, string, unknown>;
860
+ useCustomerResetPassword(options?: MutationCallbacks<void>): _tanstack_react_query.UseMutationResult<void, SDKError, {
717
861
  token: string;
718
862
  password: string;
719
863
  }, unknown>;
720
- useCustomerVerifyEmail(options?: {
721
- onSuccess?: () => void;
722
- onError?: (error: SDKError) => void;
723
- onSettled?: () => void;
724
- }): _tanstack_react_query.UseMutationResult<void, SDKError, string, unknown>;
725
- useCustomerRefreshToken(options?: {
726
- onSuccess?: (data: CustomerRefreshResponse) => void;
727
- onError?: (error: SDKError) => void;
728
- onSettled?: () => void;
729
- }): _tanstack_react_query.UseMutationResult<CustomerRefreshResponse, SDKError, void, unknown>;
730
- useCustomerUpdateProfile(options?: {
731
- onSuccess?: (data: CustomerProfile) => void;
732
- onError?: (error: SDKError) => void;
733
- onSettled?: () => void;
734
- }): _tanstack_react_query.UseMutationResult<CustomerProfile, SDKError, UpdateProfileData, unknown>;
735
- useCustomerChangePassword(options?: {
736
- onSuccess?: () => void;
737
- onError?: (error: SDKError) => void;
738
- onSettled?: () => void;
739
- }): _tanstack_react_query.UseMutationResult<void, SDKError, {
864
+ useCustomerVerifyEmail(options?: MutationCallbacks<void>): _tanstack_react_query.UseMutationResult<void, SDKError, string, unknown>;
865
+ useCustomerRefreshToken(options?: MutationCallbacks<CustomerRefreshResponse>): _tanstack_react_query.UseMutationResult<CustomerRefreshResponse, SDKError, unknown, unknown>;
866
+ useCustomerUpdateProfile(options?: MutationCallbacks<CustomerProfile>): _tanstack_react_query.UseMutationResult<CustomerProfile, SDKError, UpdateProfileData, unknown>;
867
+ useCustomerChangePassword(options?: MutationCallbacks<void>): _tanstack_react_query.UseMutationResult<void, SDKError, {
740
868
  currentPassword: string;
741
869
  newPassword: string;
742
870
  }, unknown>;
@@ -745,6 +873,43 @@ declare class QueryHooks {
745
873
  setCustomerData(data: CustomerProfile | null): void;
746
874
  }
747
875
 
876
+ declare function collectionKeys<T extends PublicCollection>(collection: T): {
877
+ all: readonly [T];
878
+ lists: () => readonly [T, "list"];
879
+ list: (options?: ApiQueryOptions) => readonly [T, "list", ApiQueryOptions | undefined];
880
+ details: () => readonly [T, "detail"];
881
+ detail: (id: string, options?: ApiQueryOptions) => readonly [T, "detail", string, ApiQueryOptions | undefined];
882
+ infinites: () => readonly [T, "infinite"];
883
+ infinite: (options?: Omit<ApiQueryOptions, "page">) => readonly [T, "infinite", Omit<ApiQueryOptions, "page"> | undefined];
884
+ };
885
+ declare const customerKeys: {
886
+ all: readonly ["customer"];
887
+ me: () => readonly ["customer", "me"];
888
+ };
889
+
890
+ type ReadOnlyQueryHooks = Omit<QueryHooks, 'useCreate' | 'useUpdate' | 'useRemove'>;
891
+ /**
892
+ * Composes CollectionHooks + CustomerHooks into a single API surface.
893
+ * All methods are delegated; no logic lives here.
894
+ */
895
+ declare class QueryHooks extends CollectionHooks {
896
+ private _customer;
897
+ constructor(queryClient: QueryClient, collectionClient: CollectionClient, customerAuth?: CustomerAuth);
898
+ useCustomerMe: CustomerHooks['useCustomerMe'];
899
+ useCustomerLogin: CustomerHooks['useCustomerLogin'];
900
+ useCustomerRegister: CustomerHooks['useCustomerRegister'];
901
+ useCustomerLogout: CustomerHooks['useCustomerLogout'];
902
+ useCustomerForgotPassword: CustomerHooks['useCustomerForgotPassword'];
903
+ useCustomerResetPassword: CustomerHooks['useCustomerResetPassword'];
904
+ useCustomerVerifyEmail: CustomerHooks['useCustomerVerifyEmail'];
905
+ useCustomerRefreshToken: CustomerHooks['useCustomerRefreshToken'];
906
+ useCustomerUpdateProfile: CustomerHooks['useCustomerUpdateProfile'];
907
+ useCustomerChangePassword: CustomerHooks['useCustomerChangePassword'];
908
+ invalidateCustomerQueries: CustomerHooks['invalidateCustomerQueries'];
909
+ getCustomerData: CustomerHooks['getCustomerData'];
910
+ setCustomerData: CustomerHooks['setCustomerData'];
911
+ }
912
+
748
913
  declare class BrowserClient {
749
914
  cart: CartApi;
750
915
  query: ReadOnlyQueryHooks;
@@ -796,9 +961,7 @@ declare const formatOrderName: (items: OrderItem[]) => string;
796
961
  * @param ref - The relation field value (T, string, number, null, or undefined)
797
962
  * @returns The resolved document object, or null if not populated
798
963
  */
799
- declare const resolveRelation: <T>(ref: T | string | null | undefined) => T | null;
800
- /** @deprecated Use `resolveRelation` instead */
801
- declare const objectFor: <T>(ref: T | string | null | undefined) => T | null;
964
+ declare const resolveRelation: <T>(ref: T | string | number | null | undefined) => T | null;
802
965
 
803
966
  interface VideoThumbnailOptions {
804
967
  /** Width in pixels (default: 640) */
@@ -884,4 +1047,4 @@ declare function getVideoStreamUrl(playbackId: string): string;
884
1047
  */
885
1048
  declare function getVideoMp4Url(playbackId: string, resolution?: 'high' | 'medium' | 'low'): string;
886
1049
 
887
- export { type AddItemParams, ApiQueryOptions, type ApplyDiscountParams, BrowserClient, BrowserClient as BrowserClientType, type CalculateShippingParams, type CalculateShippingResult, Cart, CartApi, type CartApiOptions, CartItem, type CheckoutParams, type ClearCartParams, ClientBrowserConfig, ClientServerConfig, ClientState, CollectionClient, type CollectionDetailQueryParams, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, type CreateExchangeParams, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, Exchange, Fulfillment, type GenerateMetadataOptions, type GetOrderParams, Order, OrderApi, type OrderApiOptions, OrderProduct, PayloadFindResponse, PayloadMutationResponse, Product, ProductApi, type ProductApiOptions, PublicCollection, QueryHooks, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveDiscountParams, type RemoveItemParams, Return, type ReturnWithRefundParams, SDKError, ServerClient, ServerClient as ServerClientType, type StockCheckParams, type StockCheckResponse, type StockCheckResult, Transaction, type UpdateExchangeParams, type UpdateFulfillmentParams, type UpdateItemParams, type UpdateOrderParams, type UpdateProfileData, type UpdateReturnParams, type UpdateTransactionParams, type ValidateDiscountParams, type ValidateDiscountResult, type VideoGifOptions, type VideoThumbnailOptions, collectionKeys, createBrowserClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, getVideoGif, getVideoMp4Url, getVideoStoryboard, getVideoStreamUrl, getVideoThumbnail, objectFor, resolveRelation };
1050
+ export { API_URLS, type AddItemParams, ApiError, type ApiQueryOptions, type ApiQueryReactOptions, type ApplyDiscountParams, BaseApi, BrowserClient, BrowserClient as BrowserClientType, type CalculateShippingParams, type CalculateShippingResult, Cart, CartApi, type CartApiOptions, CartItem, type CheckoutParams, type ClearCartParams, type ClientBrowserConfig, type ClientMetadata, type ClientServerConfig, type ClientState, CollectionClient, type CollectionDetailQueryParams, CollectionHooks, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, ConfigError, type CreateExchangeParams, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, CustomerHooks, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, type DebugConfig, type DeepPartial, type Environment, type ErrorLogger, Exchange, type ExtractArrayType, Fulfillment, type GenerateMetadataOptions, type GetOrderParams, GoneError, NetworkError, Order, OrderApi, type OrderApiOptions, OrderProduct, type PaginationMeta, type PayloadFindResponse, type PayloadMutationResponse, Product, ProductApi, type ProductApiOptions, PublicCollection, QueryHooks, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveDiscountParams, type RemoveItemParams, type RetryConfig, Return, type ReturnWithRefundParams, SDKError, type ServerApiOptions, ServerClient, ServerClient as ServerClientType, ServiceUnavailableError, type StockCheckParams, type StockCheckResponse, type StockCheckResult, TimeoutError, Transaction, type UpdateExchangeParams, type UpdateFulfillmentParams, type UpdateItemParams, type UpdateOrderParams, type UpdateProfileData, type UpdateReturnParams, type UpdateTransactionParams, UsageLimitError, type ValidateDiscountParams, type ValidateDiscountResult, ValidationError, type VideoGifOptions, type VideoThumbnailOptions, collectionKeys, createBrowserClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, getVideoGif, getVideoMp4Url, getVideoStoryboard, getVideoStreamUrl, getVideoThumbnail, isApiError, isConfigError, isGoneError, isNetworkError, isSDKError, isServiceUnavailableError, isTimeoutError, isUsageLimitError, isValidationError, resolveApiUrl, resolveRelation };