@01.software/sdk 0.2.9-dev.260310.cf511cb → 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 +214 -231
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.cts +321 -155
  11. package/dist/index.d.ts +321 -155
  12. package/dist/index.js +217 -231
  13. package/dist/index.js.map +1 -1
  14. package/dist/{payload-types-Cq93wqIe.d.cts → payload-types-BjvBwB8Z.d.cts} +1601 -1373
  15. package/dist/{payload-types-Cq93wqIe.d.ts → payload-types-BjvBwB8Z.d.ts} +1601 -1373
  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-NRdVwXN7.d.cts → webhook-CszIpUKn.d.cts} +2 -2
  47. package/dist/{webhook-C_7s0K66.d.ts → 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 +47 -12
  51. package/dist/auth-CVVo5UT5.d.ts +0 -298
  52. package/dist/auth-CqgrT1qd.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-Cq93wqIe.cjs';
2
- export { n as ApiUsage, ax as ApiUsageSelect, A as Audience, at as AudiencesSelect, bA as Auth, p as BillingHistory, az as BillingHistorySelect, x as Brand, B as BrandLogo, aJ as BrandLogosSelect, aI as BrandsSelect, a$ as CartItemsSelect, a_ as CartsSelect, g as CodeBlock, bz as CollectionsWidget, d as Config, z as Customer, H as CustomerAddress, aX as CustomerAddressesSelect, e as CustomerAuthOperations, D as CustomerGroup, G as CustomerGroupImage, aZ as CustomerGroupImagesSelect, aY as CustomerGroupsSelect, aW as CustomersSelect, Q as Discount, b0 as DiscountsSelect, _ as Document, b7 as DocumentCategoriesSelect, a1 as DocumentCategory, a0 as DocumentImage, b9 as DocumentImagesSelect, $ as DocumentType, b8 as DocumentTypesSelect, b6 as DocumentsSelect, k as EmailLog, au as EmailLogsSelect, L as ExchangeProduct, aU as ExchangeProductsSelect, aT as ExchangesSelect, j as FieldConfig, ar as FieldConfigsSelect, aa as Flow, ae as FlowEdgeType, bk as FlowEdgeTypesSelect, ab as FlowImage, bl as FlowImagesSelect, ad as FlowNodeType, bj as FlowNodeTypesSelect, ac as FlowTag, bm as FlowTagsSelect, bi as FlowsSelect, F as Form, al as FormSubmission, bu as FormSubmissionsSelect, bt as FormsSelect, J as FulfillmentItem, aQ as FulfillmentItemsSelect, aP as FulfillmentsSelect, be as GalleriesSelect, a6 as Gallery, bg as GalleryCategoriesSelect, a8 as GalleryCategory, a7 as GalleryImage, bf as GalleryImagesSelect, a9 as GalleryTag, bh as GalleryTagsSelect, I as IframeBlock, ag as LiveStream, ah as LiveStreamImage, bs as LiveStreamImagesSelect, br as LiveStreamsSelect, M as Media, as as MediaSelect, a3 as Music, bc as MusicsSelect, aM as OrderProductsSelect, N as OrderStatusLog, aO as OrderStatusLogsSelect, aL as OrdersSelect, am as PayloadKv, bv as PayloadKvSelect, an as PayloadLockedDocument, bw as PayloadLockedDocumentsSelect, ap as PayloadMigration, by as PayloadMigrationsSelect, ao as PayloadPreference, bx as PayloadPreferencesSelect, f as PlayerBlock, a2 as Playlist, bb as PlaylistCategoriesSelect, a4 as PlaylistCategory, a5 as PlaylistImage, bd as PlaylistImagesSelect, ba as PlaylistsSelect, V as Post, X as PostAuthor, b2 as PostAuthorsSelect, b3 as PostCategoriesSelect, Y as PostCategory, W as PostImage, b5 as PostImagesSelect, Z as PostTag, b4 as PostTagsSelect, b1 as PostsSelect, aF as ProductCategoriesSelect, u as ProductCategory, w as ProductCollection, aH as ProductCollectionsSelect, r as ProductImage, aK as ProductImagesSelect, t as ProductOption, aE as ProductOptionsSelect, v as ProductTag, aG as ProductTagsSelect, s as ProductVariant, aD as ProductVariantsSelect, aC as ProductsSelect, K as ReturnProduct, aS as ReturnProductsSelect, aR as ReturnsSelect, aV as ShippingPoliciesSelect, y as ShippingPolicy, o as Subscription, ay as SubscriptionsSelect, S as SupportedTimezones, i as Tenant, q as TenantLogo, aA as TenantLogosSelect, aw as TenantMetadataSelect, l as TenantMetadatum, m as TenantOgImage, aB as TenantOgImagesSelect, av as TenantsSelect, aN as TransactionsSelect, h as User, U as UserAuthOperations, aq as UsersSelect, af as Video, bo as VideoCategoriesSelect, aj as VideoCategory, ai as VideoImage, bq as VideoImagesSelect, ak as VideoTag, bp as VideoTagsSelect, bn as VideosSelect } from './payload-types-Cq93wqIe.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-CqgrT1qd.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-CqgrT1qd.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-NRdVwXN7.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-NRdVwXN7.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;
@@ -134,12 +342,8 @@ type UpdateExchangeParams = {
134
342
  exchangeId: string;
135
343
  status: 'processing' | 'shipped' | 'completed' | 'rejected';
136
344
  };
137
- declare class OrderApi {
138
- private readonly clientKey;
139
- private readonly secretKey;
140
- private readonly baseUrl?;
345
+ declare class OrderApi extends BaseApi {
141
346
  constructor(options: OrderApiOptions);
142
- private request;
143
347
  createOrder(params: CreateOrderParams): Promise<Order>;
144
348
  updateOrder(params: UpdateOrderParams): Promise<Order>;
145
349
  getOrder(params: GetOrderParams): Promise<Order>;
@@ -211,11 +415,7 @@ declare class CartApi {
211
415
  }>;
212
416
  }
213
417
 
214
- interface ProductApiOptions {
215
- clientKey: string;
216
- secretKey: string;
217
- baseUrl?: string;
218
- }
418
+ type ProductApiOptions = ServerApiOptions;
219
419
  type StockCheckParams = {
220
420
  items: Array<{
221
421
  optionId: string;
@@ -233,12 +433,8 @@ type StockCheckResponse = {
233
433
  results: StockCheckResult[];
234
434
  allAvailable: boolean;
235
435
  };
236
- declare class ProductApi {
237
- private readonly clientKey;
238
- private readonly secretKey;
239
- private readonly baseUrl?;
436
+ declare class ProductApi extends BaseApi {
240
437
  constructor(options: ProductApiOptions);
241
- private request;
242
438
  stockCheck(params: StockCheckParams): Promise<StockCheckResponse>;
243
439
  }
244
440
 
@@ -246,6 +442,18 @@ interface GenerateMetadataOptions {
246
442
  siteName?: string;
247
443
  }
248
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
+
249
457
  declare class HttpClient {
250
458
  protected clientKey: string;
251
459
  protected secretKey?: string;
@@ -547,19 +755,6 @@ declare class CustomerAuth {
547
755
  private requestJson;
548
756
  }
549
757
 
550
- declare function collectionKeys<T extends PublicCollection>(collection: T): {
551
- all: readonly [T];
552
- lists: () => readonly [T, "list"];
553
- list: (options?: ApiQueryOptions) => readonly [T, "list", ApiQueryOptions | undefined];
554
- details: () => readonly [T, "detail"];
555
- detail: (id: string, options?: ApiQueryOptions) => readonly [T, "detail", string, ApiQueryOptions | undefined];
556
- infinites: () => readonly [T, "infinite"];
557
- infinite: (options?: Omit<ApiQueryOptions, "page">) => readonly [T, "infinite", Omit<ApiQueryOptions, "page"> | undefined];
558
- };
559
- declare const customerKeys: {
560
- all: readonly ["customer"];
561
- me: () => readonly ["customer", "me"];
562
- };
563
758
  interface CollectionQueryParams<T extends PublicCollection> {
564
759
  collection: T;
565
760
  options?: ApiQueryOptions;
@@ -574,62 +769,31 @@ interface CollectionInfiniteQueryParams<T extends PublicCollection> {
574
769
  options?: Omit<ApiQueryOptions, 'page'>;
575
770
  pageSize?: number;
576
771
  }
577
- type ReadOnlyQueryHooks = Omit<QueryHooks, 'useCreate' | 'useUpdate' | 'useRemove'>;
578
- declare class QueryHooks {
579
- private queryClient;
580
- private collectionClient;
581
- private customerAuth?;
582
- constructor(queryClient: QueryClient, collectionClient: CollectionClient, customerAuth?: CustomerAuth);
583
- private ensureCustomerAuth;
584
- useQuery<T extends PublicCollection>(params: CollectionQueryParams<T>, options?: {
585
- enabled?: boolean;
586
- staleTime?: number;
587
- gcTime?: number;
588
- refetchOnWindowFocus?: boolean;
589
- refetchOnMount?: boolean;
590
- refetchInterval?: number | false;
591
- retry?: boolean | number;
592
- }): _tanstack_react_query.UseQueryResult<CollectionType<T>[], Error>;
593
- useSuspenseQuery<T extends PublicCollection>(params: CollectionQueryParams<T>, options?: {
594
- staleTime?: number;
595
- gcTime?: number;
596
- refetchOnWindowFocus?: boolean;
597
- refetchOnMount?: boolean;
598
- refetchInterval?: number | false;
599
- retry?: boolean | number;
600
- }): _tanstack_react_query.UseSuspenseQueryResult<CollectionType<T>[], Error>;
601
- useQueryById<T extends PublicCollection>(params: CollectionDetailQueryParams<T>, options?: {
602
- enabled?: boolean;
603
- staleTime?: number;
604
- gcTime?: number;
605
- refetchOnWindowFocus?: boolean;
606
- refetchOnMount?: boolean;
607
- refetchInterval?: number | false;
608
- retry?: boolean | number;
609
- }): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<CollectionType<T>>, Error>;
610
- useSuspenseQueryById<T extends PublicCollection>(params: CollectionDetailQueryParams<T>, options?: {
611
- staleTime?: number;
612
- gcTime?: number;
613
- refetchOnWindowFocus?: boolean;
614
- refetchOnMount?: boolean;
615
- refetchInterval?: number | false;
616
- retry?: boolean | number;
617
- }): _tanstack_react_query.UseSuspenseQueryResult<CollectionType<T>, Error>;
618
- useInfiniteQuery<T extends PublicCollection>(params: CollectionInfiniteQueryParams<T>, options?: {
619
- enabled?: boolean;
620
- staleTime?: number;
621
- gcTime?: number;
622
- refetchOnWindowFocus?: boolean;
623
- refetchOnMount?: boolean;
624
- retry?: boolean | number;
625
- }): _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<PayloadFindResponse<CollectionType<T>>, unknown>, Error>;
626
- useSuspenseInfiniteQuery<T extends PublicCollection>(params: CollectionInfiniteQueryParams<T>, options?: {
627
- staleTime?: number;
628
- gcTime?: number;
629
- refetchOnWindowFocus?: boolean;
630
- refetchOnMount?: boolean;
631
- retry?: boolean | number;
632
- }): _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>;
633
797
  prefetchQuery<T extends PublicCollection>(params: CollectionQueryParams<T>, options?: {
634
798
  staleTime?: number;
635
799
  }): Promise<void>;
@@ -642,22 +806,14 @@ declare class QueryHooks {
642
806
  }): Promise<void>;
643
807
  useCreate<T extends PublicCollection>(params: {
644
808
  collection: T;
645
- }, options?: {
646
- onSuccess?: (data: PayloadMutationResponse<CollectionType<T>>) => void;
647
- onError?: (error: SDKError) => void;
648
- onSettled?: () => void;
649
- }): _tanstack_react_query.UseMutationResult<PayloadMutationResponse<CollectionType<T>>, SDKError, {
809
+ }, options?: MutationCallbacks$1<PayloadMutationResponse<CollectionType<T>>>): _tanstack_react_query.UseMutationResult<PayloadMutationResponse<CollectionType<T>>, SDKError, {
650
810
  data: Partial<CollectionType<T>>;
651
811
  file?: File | Blob;
652
812
  filename?: string;
653
813
  }, unknown>;
654
814
  useUpdate<T extends PublicCollection>(params: {
655
815
  collection: T;
656
- }, options?: {
657
- onSuccess?: (data: PayloadMutationResponse<CollectionType<T>>) => void;
658
- onError?: (error: SDKError) => void;
659
- onSettled?: () => void;
660
- }): _tanstack_react_query.UseMutationResult<PayloadMutationResponse<CollectionType<T>>, SDKError, {
816
+ }, options?: MutationCallbacks$1<PayloadMutationResponse<CollectionType<T>>>): _tanstack_react_query.UseMutationResult<PayloadMutationResponse<CollectionType<T>>, SDKError, {
661
817
  id: string;
662
818
  data: Partial<CollectionType<T>>;
663
819
  file?: File | Blob;
@@ -665,16 +821,25 @@ declare class QueryHooks {
665
821
  }, unknown>;
666
822
  useRemove<T extends PublicCollection>(params: {
667
823
  collection: T;
668
- }, options?: {
669
- onSuccess?: (data: CollectionType<T>) => void;
670
- onError?: (error: SDKError) => void;
671
- onSettled?: () => void;
672
- }): _tanstack_react_query.UseMutationResult<CollectionType<T>, SDKError, string, unknown>;
824
+ }, options?: MutationCallbacks$1<CollectionType<T>>): _tanstack_react_query.UseMutationResult<CollectionType<T>, SDKError, string, unknown>;
673
825
  invalidateQueries<T extends PublicCollection>(collection: T, type?: 'list' | 'detail' | 'infinite'): Promise<void>;
674
826
  getQueryData<T extends PublicCollection>(collection: T, type: 'list', options?: ApiQueryOptions): CollectionType<T>[] | undefined;
675
827
  getQueryData<T extends PublicCollection>(collection: T, type: 'detail', id: string, options?: ApiQueryOptions): CollectionType<T> | null | undefined;
676
828
  setQueryData<T extends PublicCollection>(collection: T, type: 'list', data: CollectionType<T>[], options?: ApiQueryOptions): void;
677
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;
678
843
  useCustomerMe(options?: {
679
844
  enabled?: boolean;
680
845
  staleTime?: number;
@@ -684,58 +849,22 @@ declare class QueryHooks {
684
849
  refetchInterval?: number | false;
685
850
  retry?: boolean | number;
686
851
  }): _tanstack_react_query.UseQueryResult<CustomerProfile | null, Error>;
687
- useCustomerLogin(options?: {
688
- onSuccess?: (data: CustomerAuthResponse) => void;
689
- onError?: (error: SDKError) => void;
690
- onSettled?: () => void;
691
- }): _tanstack_react_query.UseMutationResult<CustomerAuthResponse, SDKError, CustomerLoginData, unknown>;
692
- useCustomerRegister(options?: {
693
- onSuccess?: (data: {
694
- customer: CustomerProfile;
695
- }) => void;
696
- onError?: (error: SDKError) => void;
697
- onSettled?: () => void;
698
- }): _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<{
699
856
  customer: CustomerProfile;
700
857
  }, SDKError, CustomerRegisterData, unknown>;
701
- useCustomerLogout(options?: {
702
- onSuccess?: () => void;
703
- onError?: (error: SDKError) => void;
704
- onSettled?: () => void;
705
- }): _tanstack_react_query.UseMutationResult<void, SDKError, void, unknown>;
706
- useCustomerForgotPassword(options?: {
707
- onSuccess?: () => void;
708
- onError?: (error: SDKError) => void;
709
- onSettled?: () => void;
710
- }): _tanstack_react_query.UseMutationResult<void, SDKError, string, unknown>;
711
- useCustomerResetPassword(options?: {
712
- onSuccess?: () => void;
713
- onError?: (error: SDKError) => void;
714
- onSettled?: () => void;
715
- }): _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, {
716
861
  token: string;
717
862
  password: string;
718
863
  }, unknown>;
719
- useCustomerVerifyEmail(options?: {
720
- onSuccess?: () => void;
721
- onError?: (error: SDKError) => void;
722
- onSettled?: () => void;
723
- }): _tanstack_react_query.UseMutationResult<void, SDKError, string, unknown>;
724
- useCustomerRefreshToken(options?: {
725
- onSuccess?: (data: CustomerRefreshResponse) => void;
726
- onError?: (error: SDKError) => void;
727
- onSettled?: () => void;
728
- }): _tanstack_react_query.UseMutationResult<CustomerRefreshResponse, SDKError, void, unknown>;
729
- useCustomerUpdateProfile(options?: {
730
- onSuccess?: (data: CustomerProfile) => void;
731
- onError?: (error: SDKError) => void;
732
- onSettled?: () => void;
733
- }): _tanstack_react_query.UseMutationResult<CustomerProfile, SDKError, UpdateProfileData, unknown>;
734
- useCustomerChangePassword(options?: {
735
- onSuccess?: () => void;
736
- onError?: (error: SDKError) => void;
737
- onSettled?: () => void;
738
- }): _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, {
739
868
  currentPassword: string;
740
869
  newPassword: string;
741
870
  }, unknown>;
@@ -744,6 +873,43 @@ declare class QueryHooks {
744
873
  setCustomerData(data: CustomerProfile | null): void;
745
874
  }
746
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
+
747
913
  declare class BrowserClient {
748
914
  cart: CartApi;
749
915
  query: ReadOnlyQueryHooks;
@@ -881,4 +1047,4 @@ declare function getVideoStreamUrl(playbackId: string): string;
881
1047
  */
882
1048
  declare function getVideoMp4Url(playbackId: string, resolution?: 'high' | 'medium' | 'low'): string;
883
1049
 
884
- 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, 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 };