@01.software/sdk 0.1.5 → 0.1.6

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/dist/index.d.cts CHANGED
@@ -1,11 +1,11 @@
1
- import { O as Order, a as OrderProduct, T as Transaction, P as ProductOption } from './payload-types-BAZCcssT.cjs';
2
- export { i as ApiUsage, a3 as ApiUsageSelect, A as Audience, Z as AudiencesSelect, aC as Auth, u as Author, an as AuthorsSelect, k as BillingHistory, a5 as BillingHistorySelect, p as Brand, B as BrandLogo, ad as BrandLogosSelect, ac as BrandsSelect, c as CodeBlock, C as Config, D as Document, ap as DocumentCategoriesSelect, x as DocumentCategory, y as DocumentImage, aq as DocumentImagesSelect, ao as DocumentsSelect, E as EmailLog, _ as EmailLogsSelect, K as Form, L as FormSubmission, ax as FormSubmissionsSelect, aw as FormsSelect, au as GalleriesSelect, H as Gallery, J as GalleryImage, av as GalleryImagesSelect, I as IframeBlock, M as Media, Y as MediaSelect, G as Music, at as MusicsSelect, af as OrderProductsSelect, ae as OrdersSelect, N as PayloadKv, ay as PayloadKvSelect, Q as PayloadLockedDocument, az as PayloadLockedDocumentsSelect, W as PayloadMigration, aB as PayloadMigrationsSelect, V as PayloadPreference, aA as PayloadPreferencesSelect, b as PlayerBlock, z as Playlist, F as PlaylistImage, as as PlaylistImagesSelect, ar as PlaylistsSelect, s as Post, ak as PostCategoriesSelect, v as PostCategory, t as PostImage, am as PostImagesSelect, w as PostTag, al as PostTagsSelect, aj as PostsSelect, l as Product, a9 as ProductCategoriesSelect, n as ProductCategory, m as ProductImage, ab as ProductImagesSelect, a8 as ProductOptionsSelect, o as ProductTag, aa as ProductTagsSelect, q as ProductVariant, a7 as ProductVariantsSelect, a6 as ProductsSelect, R as Return, r as ReturnProduct, ah as ReturnProductsSelect, ag as ReturnsSelect, j as Subscription, a4 as SubscriptionsSelect, S as SupportedTimezones, e as Tenant, h as TenantLogo, a1 as TenantLogosSelect, a0 as TenantMetadataSelect, f as TenantMetadatum, g as TenantOgImage, a2 as TenantOgImagesSelect, $ as TenantsSelect, ai as TransactionsSelect, d as User, U as UserAuthOperations, X as UsersSelect } from './payload-types-BAZCcssT.cjs';
3
- import { F as FetchOptions, A as ApiQueryOptions, P as PayloadFindResponse, a as PayloadMutationResponse, C as ClientBrowserConfig, b as ClientState, c as ClientServerConfig } from './auth-DMvniYSs.cjs';
4
- export { t as API_URLS, f as ApiError, y as ApiQueryReactOptions, w as ClientMetadata, g as ConfigError, d as DebugConfig, D as DeepPartial, s as Environment, e as ErrorLogger, E as ExtractArrayType, J as JwtPayload, N as NetworkError, x as PaginationMeta, R as RetryConfig, S as SDKError, T as TimeoutError, U as UsageLimitError, V as ValidationError, q as createApiKey, o as createServerToken, p as decodeServerToken, k as isApiError, l as isConfigError, h as isNetworkError, i as isSDKError, m as isTimeoutError, n as isUsageLimitError, j as isValidationError, r as parseApiKey, u as resolveApiUrl, v as verifyServerToken } from './auth-DMvniYSs.cjs';
1
+ import { O as Order, a as OrderProduct, T as Transaction, F as Fulfillment, R as Return, C as CartItem, P as ProductOption } from './payload-types-XZDjUjRT.cjs';
2
+ export { k as ApiUsage, ae as ApiUsageSelect, A as Audience, a8 as AudiencesSelect, aX as Auth, K as Author, aI as AuthorsSelect, m as BillingHistory, ag as BillingHistorySelect, r as Brand, B as BrandLogo, ao as BrandLogosSelect, an as BrandsSelect, D as Cart, aB as CartItemsSelect, aA as CartsSelect, e as CodeBlock, b as Config, u as Customer, v as CustomerAddress, az as CustomerAddressesSelect, c as CustomerAuthOperations, ay as CustomersSelect, G as Discount, aC as DiscountsSelect, Q as Document, aK as DocumentCategoriesSelect, V as DocumentCategory, W as DocumentImage, aL as DocumentImagesSelect, aJ as DocumentsSelect, E as EmailLog, a9 as EmailLogsSelect, x as Exchange, y as ExchangeProduct, au as ExchangeProductsSelect, at as ExchangesSelect, a0 as Form, a1 as FormSubmission, aS as FormSubmissionsSelect, aR as FormsSelect, z as FulfillmentItem, aw as FulfillmentItemsSelect, av as FulfillmentsSelect, aP as GalleriesSelect, _ as Gallery, $ as GalleryImage, aQ as GalleryImagesSelect, I as IframeBlock, M as Media, a7 as MediaSelect, Z as Music, aO as MusicsSelect, aq as OrderProductsSelect, ap as OrdersSelect, a2 as PayloadKv, aT as PayloadKvSelect, a3 as PayloadLockedDocument, aU as PayloadLockedDocumentsSelect, a5 as PayloadMigration, aW as PayloadMigrationsSelect, a4 as PayloadPreference, aV as PayloadPreferencesSelect, d as PlayerBlock, X as Playlist, Y as PlaylistImage, aN as PlaylistImagesSelect, aM as PlaylistsSelect, H as Post, aF as PostCategoriesSelect, L as PostCategory, J as PostImage, aH as PostImagesSelect, N as PostTag, aG as PostTagsSelect, aE as PostsSelect, n as Product, ak as ProductCategoriesSelect, p as ProductCategory, o as ProductImage, am as ProductImagesSelect, aj as ProductOptionsSelect, q as ProductTag, al as ProductTagsSelect, t as ProductVariant, ai as ProductVariantsSelect, ah as ProductsSelect, w as ReturnProduct, as as ReturnProductsSelect, ar as ReturnsSelect, aD as ShippingPoliciesSelect, s as ShippingPolicy, l as Subscription, af as SubscriptionsSelect, S as SupportedTimezones, g as Tenant, j as TenantLogo, ac as TenantLogosSelect, ab as TenantMetadataSelect, h as TenantMetadatum, i as TenantOgImage, ad as TenantOgImagesSelect, aa as TenantsSelect, ax as TransactionsSelect, f as User, U as UserAuthOperations, a6 as UsersSelect } from './payload-types-XZDjUjRT.cjs';
3
+ import { F as FetchOptions, A as ApiQueryOptions, P as PayloadFindResponse, a as PayloadMutationResponse, C as ClientBrowserConfig, b as ClientState, c as ClientServerConfig } from './auth-BIQrgvB-.cjs';
4
+ export { t as API_URLS, f as ApiError, y as ApiQueryReactOptions, w as ClientMetadata, g as ConfigError, d as DebugConfig, D as DeepPartial, s as Environment, e as ErrorLogger, E as ExtractArrayType, J as JwtPayload, N as NetworkError, x as PaginationMeta, R as RetryConfig, S as SDKError, T as TimeoutError, U as UsageLimitError, V as ValidationError, q as createApiKey, o as createServerToken, p as decodeServerToken, k as isApiError, l as isConfigError, h as isNetworkError, i as isSDKError, m as isTimeoutError, n as isUsageLimitError, j as isValidationError, r as parseApiKey, u as resolveApiUrl, v as verifyServerToken } from './auth-BIQrgvB-.cjs';
5
5
  import * as _tanstack_react_query from '@tanstack/react-query';
6
6
  import { QueryClient } from '@tanstack/react-query';
7
- import { P as PublicCollection, C as CollectionType } from './webhook-DdNkaI-f.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-DdNkaI-f.cjs';
7
+ import { P as PublicCollection, C as CollectionType } from './webhook-BkbRPVAd.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-BkbRPVAd.cjs';
9
9
  export { RichTextContent, RichTextContentProps, RichTextData } from './components.cjs';
10
10
  import 'payload';
11
11
  import 'react';
@@ -13,12 +13,169 @@ import '@payloadcms/richtext-lexical';
13
13
  import '@payloadcms/richtext-lexical/lexical';
14
14
  import '@payloadcms/richtext-lexical/react';
15
15
 
16
+ interface OrderApiOptions {
17
+ clientKey: string;
18
+ secretKey: string;
19
+ baseUrl?: string;
20
+ }
21
+ type CreateOrderParams = {
22
+ paymentId: string;
23
+ orderNumber: string;
24
+ email: string;
25
+ shippingAddress: Order['shippingAddress'];
26
+ orderProducts: Omit<OrderProduct, 'id' | 'brand' | 'createdAt' | 'updatedAt' | 'order' | 'status'>[];
27
+ totalAmount: number;
28
+ };
29
+ type UpdateOrderParams = {
30
+ orderNumber: string;
31
+ status: Order['status'];
32
+ };
33
+ type UpdateTransactionParams = {
34
+ paymentId: string;
35
+ status: Transaction['status'];
36
+ paymentMethod: Transaction['paymentMethod'];
37
+ receiptUrl: Transaction['receiptUrl'];
38
+ };
39
+ type CheckoutParams = {
40
+ cartId: number;
41
+ paymentId: string;
42
+ orderNumber: string;
43
+ customerSnapshot: {
44
+ name?: string;
45
+ email: string;
46
+ phone?: string;
47
+ };
48
+ };
49
+ type CreateFulfillmentParams = {
50
+ orderNumber: string;
51
+ carrier?: string;
52
+ trackingNumber?: string;
53
+ items: Array<{
54
+ orderProduct: number;
55
+ quantity: number;
56
+ }>;
57
+ };
58
+ type GetOrderParams = {
59
+ orderNumber: string;
60
+ };
61
+ type CreateReturnParams = {
62
+ orderNumber: string;
63
+ reason?: 'change_of_mind' | 'defective' | 'wrong_delivery' | 'damaged' | 'other';
64
+ reasonDetail?: string;
65
+ returnProducts: Array<{
66
+ orderProduct: number;
67
+ quantity: number;
68
+ }>;
69
+ refundAmount: number;
70
+ };
71
+ type UpdateReturnParams = {
72
+ returnId: number;
73
+ status: 'processing' | 'approved' | 'rejected' | 'completed';
74
+ };
75
+ type ReturnWithRefundParams = {
76
+ orderNumber: string;
77
+ reason?: string;
78
+ reasonDetail?: string;
79
+ returnProducts: Array<{
80
+ orderProduct: number;
81
+ quantity: number;
82
+ }>;
83
+ refundAmount: number;
84
+ paymentId: string;
85
+ refundReceiptUrl?: string;
86
+ };
87
+ declare class OrderApi {
88
+ private readonly clientKey;
89
+ private readonly secretKey;
90
+ private readonly baseUrl?;
91
+ constructor(options: OrderApiOptions);
92
+ private request;
93
+ createOrder(params: CreateOrderParams): Promise<Order>;
94
+ updateOrder(params: UpdateOrderParams): Promise<Order>;
95
+ getOrder(params: GetOrderParams): Promise<Order>;
96
+ updateTransaction(params: UpdateTransactionParams): Promise<Transaction>;
97
+ checkout(params: CheckoutParams): Promise<Order>;
98
+ createFulfillment(params: CreateFulfillmentParams): Promise<Fulfillment>;
99
+ returnWithRefund(params: ReturnWithRefundParams): Promise<{
100
+ return: Return;
101
+ transaction: Transaction | null;
102
+ }>;
103
+ createReturn(params: CreateReturnParams): Promise<Return>;
104
+ updateReturn(params: UpdateReturnParams): Promise<Return>;
105
+ }
106
+
107
+ interface CartApiOptions {
108
+ clientKey: string;
109
+ secretKey?: string;
110
+ customerToken?: string | (() => string | null);
111
+ baseUrl?: string;
112
+ }
113
+ type AddItemParams = {
114
+ cartId: number;
115
+ product: number;
116
+ variant: number;
117
+ option: number;
118
+ quantity: number;
119
+ };
120
+ type UpdateItemParams = {
121
+ cartItemId: number;
122
+ quantity: number;
123
+ };
124
+ type RemoveItemParams = {
125
+ cartItemId: number;
126
+ };
127
+ declare class CartApi {
128
+ private readonly clientKey;
129
+ private readonly secretKey?;
130
+ private readonly customerToken?;
131
+ private readonly baseUrl?;
132
+ constructor(options: CartApiOptions);
133
+ private request;
134
+ addItem(params: AddItemParams): Promise<CartItem>;
135
+ updateItem(params: UpdateItemParams): Promise<CartItem>;
136
+ removeItem(params: RemoveItemParams): Promise<{
137
+ success: boolean;
138
+ }>;
139
+ }
140
+
141
+ interface ProductApiOptions {
142
+ clientKey: string;
143
+ secretKey: string;
144
+ baseUrl?: string;
145
+ }
146
+ type StockCheckParams = {
147
+ items: Array<{
148
+ optionId: number;
149
+ quantity: number;
150
+ }>;
151
+ };
152
+ type StockCheckResult = {
153
+ optionId: number;
154
+ available: boolean;
155
+ availableStock: number;
156
+ requestedQuantity: number;
157
+ error?: string;
158
+ };
159
+ type StockCheckResponse = {
160
+ results: StockCheckResult[];
161
+ allAvailable: boolean;
162
+ };
163
+ declare class ProductApi {
164
+ private readonly clientKey;
165
+ private readonly secretKey;
166
+ private readonly baseUrl?;
167
+ constructor(options: ProductApiOptions);
168
+ private request;
169
+ stockCheck(params: StockCheckParams): Promise<StockCheckResponse>;
170
+ }
171
+
16
172
  declare class HttpClient {
17
173
  protected clientKey: string;
18
174
  protected secretKey?: string;
19
175
  protected baseUrl?: string;
20
- protected defaultOptions: FetchOptions;
21
- constructor(clientKey: string, secretKey?: string, baseUrl?: string);
176
+ private getCustomerToken?;
177
+ constructor(clientKey: string, secretKey?: string, baseUrl?: string, getCustomerToken?: () => string | null);
178
+ protected get defaultOptions(): FetchOptions;
22
179
  protected buildUrl(endpoint: string, options?: ApiQueryOptions): string;
23
180
  protected assertJsonResponse(response: Response): void;
24
181
  /**
@@ -39,7 +196,7 @@ declare class HttpClient {
39
196
  }
40
197
 
41
198
  declare class CollectionClient extends HttpClient {
42
- constructor(clientKey: string, secretKey?: string, baseUrl?: string);
199
+ constructor(clientKey: string, secretKey?: string, baseUrl?: string, getCustomerToken?: () => string | null);
43
200
  from<T extends PublicCollection>(collection: T): CollectionQueryBuilder<T>;
44
201
  /**
45
202
  * Find documents (list query)
@@ -151,6 +308,106 @@ declare class CollectionQueryBuilder<T extends PublicCollection> {
151
308
  removeMany(where: ApiQueryOptions['where']): Promise<PayloadFindResponse<CollectionType<T>>>;
152
309
  }
153
310
 
311
+ interface CustomerAuthResponse {
312
+ token: string;
313
+ customer: CustomerProfile;
314
+ }
315
+ interface CustomerProfile {
316
+ id: number | string;
317
+ name: string;
318
+ email?: string | null;
319
+ phone?: string | null;
320
+ isVerified?: boolean | null;
321
+ }
322
+ interface CustomerRegisterData {
323
+ name: string;
324
+ email: string;
325
+ password: string;
326
+ phone?: string;
327
+ }
328
+ interface CustomerLoginData {
329
+ email: string;
330
+ password: string;
331
+ }
332
+ interface CustomerRefreshResponse {
333
+ token: string;
334
+ }
335
+ interface CustomerAuthOptions {
336
+ /** Initial token (e.g. from SSR cookie) */
337
+ token?: string;
338
+ /** Called when token changes (login/logout) — use to persist in localStorage/cookie */
339
+ onTokenChange?: (token: string | null) => void;
340
+ }
341
+
342
+ /**
343
+ * Customer authentication client for BrowserClient.
344
+ *
345
+ * Manages customer registration, login, logout, and token lifecycle.
346
+ * All requests include X-Client-Key for tenant resolution.
347
+ */
348
+ declare class CustomerAuth {
349
+ private clientKey;
350
+ private baseUrl;
351
+ private token;
352
+ private onTokenChange?;
353
+ constructor(clientKey: string, baseUrl: string, options?: CustomerAuthOptions);
354
+ /**
355
+ * Register a new customer account
356
+ */
357
+ register(data: CustomerRegisterData): Promise<{
358
+ customer: CustomerProfile;
359
+ }>;
360
+ /**
361
+ * Login with email and password. Stores the token internally.
362
+ */
363
+ login(data: CustomerLoginData): Promise<CustomerAuthResponse>;
364
+ /**
365
+ * Refresh the current token. Requires a valid (non-expired) token.
366
+ */
367
+ refreshToken(): Promise<CustomerRefreshResponse>;
368
+ /**
369
+ * Clear the stored token
370
+ */
371
+ logout(): void;
372
+ /**
373
+ * Get the current authenticated customer's profile
374
+ */
375
+ me(): Promise<CustomerProfile | null>;
376
+ /**
377
+ * Request a password reset email
378
+ */
379
+ forgotPassword(email: string): Promise<void>;
380
+ /**
381
+ * Reset password using a token from the reset email
382
+ */
383
+ resetPassword(token: string, password: string): Promise<void>;
384
+ /**
385
+ * Change the password of the currently authenticated customer
386
+ */
387
+ changePassword(currentPassword: string, newPassword: string): Promise<void>;
388
+ /**
389
+ * Verify email using the verification token
390
+ */
391
+ verifyEmail(token: string): Promise<void>;
392
+ /**
393
+ * Get the current token (or null if not authenticated)
394
+ */
395
+ getToken(): string | null;
396
+ /**
397
+ * Set the token manually (e.g. from SSR)
398
+ */
399
+ setToken(token: string | null): void;
400
+ /**
401
+ * Check if the customer is currently authenticated
402
+ */
403
+ isAuthenticated(): boolean;
404
+ /**
405
+ * Internal: make a request with timeout and error handling.
406
+ * Auth endpoints don't retry — failures are final.
407
+ */
408
+ private requestJson;
409
+ }
410
+
154
411
  declare function collectionKeys<T extends PublicCollection>(collection: T): {
155
412
  all: readonly [T];
156
413
  lists: () => readonly [T, "list"];
@@ -160,6 +417,10 @@ declare function collectionKeys<T extends PublicCollection>(collection: T): {
160
417
  infinites: () => readonly [T, "infinite"];
161
418
  infinite: (options?: Omit<ApiQueryOptions, "page">) => readonly [T, "infinite", Omit<ApiQueryOptions, "page"> | undefined];
162
419
  };
420
+ declare const customerKeys: {
421
+ all: readonly ["customer"];
422
+ me: () => readonly ["customer", "me"];
423
+ };
163
424
  interface CollectionQueryParams<T extends PublicCollection> {
164
425
  collection: T;
165
426
  options?: ApiQueryOptions;
@@ -174,10 +435,13 @@ interface CollectionInfiniteQueryParams<T extends PublicCollection> {
174
435
  options?: Omit<ApiQueryOptions, 'page'>;
175
436
  pageSize?: number;
176
437
  }
438
+ type ReadOnlyQueryHooks = Omit<QueryHooks, 'useCreate' | 'useUpdate' | 'useRemove'>;
177
439
  declare class QueryHooks {
178
440
  private queryClient;
179
441
  private collectionClient;
180
- constructor(queryClient: QueryClient, collectionClient: CollectionClient);
442
+ private customerAuth?;
443
+ constructor(queryClient: QueryClient, collectionClient: CollectionClient, customerAuth?: CustomerAuth);
444
+ private ensureCustomerAuth;
181
445
  useQuery<T extends PublicCollection>(params: CollectionQueryParams<T>, options?: {
182
446
  enabled?: boolean;
183
447
  staleTime?: number;
@@ -266,12 +530,76 @@ declare class QueryHooks {
266
530
  getQueryData<T extends PublicCollection>(collection: T, type: 'detail', id: string | number, options?: ApiQueryOptions): CollectionType<T> | null | undefined;
267
531
  setQueryData<T extends PublicCollection>(collection: T, type: 'list', data: CollectionType<T>[], options?: ApiQueryOptions): void;
268
532
  setQueryData<T extends PublicCollection>(collection: T, type: 'detail', id: string | number, data: CollectionType<T> | null, options?: ApiQueryOptions): void;
533
+ useCustomerMe(options?: {
534
+ enabled?: boolean;
535
+ staleTime?: number;
536
+ gcTime?: number;
537
+ refetchOnWindowFocus?: boolean;
538
+ refetchOnMount?: boolean;
539
+ refetchInterval?: number | false;
540
+ retry?: boolean | number;
541
+ }): _tanstack_react_query.UseQueryResult<CustomerProfile | null, Error>;
542
+ useCustomerLogin(options?: {
543
+ onSuccess?: (data: CustomerAuthResponse) => void;
544
+ onError?: (error: Error) => void;
545
+ onSettled?: () => void;
546
+ }): _tanstack_react_query.UseMutationResult<CustomerAuthResponse, Error, CustomerLoginData, unknown>;
547
+ useCustomerRegister(options?: {
548
+ onSuccess?: (data: {
549
+ customer: CustomerProfile;
550
+ }) => void;
551
+ onError?: (error: Error) => void;
552
+ onSettled?: () => void;
553
+ }): _tanstack_react_query.UseMutationResult<{
554
+ customer: CustomerProfile;
555
+ }, Error, CustomerRegisterData, unknown>;
556
+ useCustomerLogout(options?: {
557
+ onSuccess?: () => void;
558
+ onError?: (error: Error) => void;
559
+ onSettled?: () => void;
560
+ }): _tanstack_react_query.UseMutationResult<void, Error, void, unknown>;
561
+ useCustomerForgotPassword(options?: {
562
+ onSuccess?: () => void;
563
+ onError?: (error: Error) => void;
564
+ onSettled?: () => void;
565
+ }): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
566
+ useCustomerResetPassword(options?: {
567
+ onSuccess?: () => void;
568
+ onError?: (error: Error) => void;
569
+ onSettled?: () => void;
570
+ }): _tanstack_react_query.UseMutationResult<void, Error, {
571
+ token: string;
572
+ password: string;
573
+ }, unknown>;
574
+ useCustomerVerifyEmail(options?: {
575
+ onSuccess?: () => void;
576
+ onError?: (error: Error) => void;
577
+ onSettled?: () => void;
578
+ }): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
579
+ useCustomerRefreshToken(options?: {
580
+ onSuccess?: (data: CustomerRefreshResponse) => void;
581
+ onError?: (error: Error) => void;
582
+ onSettled?: () => void;
583
+ }): _tanstack_react_query.UseMutationResult<CustomerRefreshResponse, Error, void, unknown>;
584
+ useCustomerChangePassword(options?: {
585
+ onSuccess?: () => void;
586
+ onError?: (error: Error) => void;
587
+ onSettled?: () => void;
588
+ }): _tanstack_react_query.UseMutationResult<void, Error, {
589
+ currentPassword: string;
590
+ newPassword: string;
591
+ }, unknown>;
592
+ invalidateCustomerQueries(): Promise<void>;
593
+ getCustomerData(): CustomerProfile | null | undefined;
594
+ setCustomerData(data: CustomerProfile | null): void;
269
595
  }
270
596
 
271
597
  declare class BrowserClient {
272
- query: QueryHooks;
598
+ cart: CartApi;
599
+ query: ReadOnlyQueryHooks;
273
600
  collections: CollectionClient;
274
601
  queryClient: QueryClient;
602
+ customer: CustomerAuth;
275
603
  protected state: ClientState;
276
604
  protected config: ClientBrowserConfig;
277
605
  protected baseUrl: string;
@@ -281,42 +609,10 @@ declare class BrowserClient {
281
609
  }
282
610
  declare function createBrowserClient(options: ClientBrowserConfig): BrowserClient;
283
611
 
284
- interface OrderApiOptions {
285
- clientKey: string;
286
- secretKey: string;
287
- baseUrl?: string;
288
- }
289
- type CreateOrderParams = {
290
- paymentId: string;
291
- orderNumber: string;
292
- email: string;
293
- shippingAddress: Order['shippingAddress'];
294
- orderProducts: Omit<OrderProduct, 'id' | 'brand' | 'createdAt' | 'updatedAt' | 'order' | 'status'>[];
295
- totalAmount: number;
296
- };
297
- type UpdateOrderParams = {
298
- orderNumber: string;
299
- status: Order['status'];
300
- };
301
- type UpdateTransactionParams = {
302
- paymentId: string;
303
- status: Transaction['status'];
304
- paymentMethod: Transaction['paymentMethod'];
305
- receiptUrl: Transaction['receiptUrl'];
306
- };
307
- declare class OrderApi {
308
- private readonly clientKey;
309
- private readonly secretKey;
310
- private readonly baseUrl?;
311
- constructor(options: OrderApiOptions);
312
- private request;
313
- createOrder(params: CreateOrderParams): Promise<Order>;
314
- updateOrder(params: UpdateOrderParams): Promise<Order>;
315
- updateTransaction(params: UpdateTransactionParams): Promise<Transaction>;
316
- }
317
-
318
612
  declare class ServerClient {
319
613
  api: OrderApi;
614
+ cart: CartApi;
615
+ product: ProductApi;
320
616
  query: QueryHooks;
321
617
  collections: CollectionClient;
322
618
  queryClient: QueryClient;
@@ -349,4 +645,4 @@ declare const resolveRelation: <T>(ref: T | number | null | undefined) => T | nu
349
645
  /** @deprecated Use `resolveRelation` instead */
350
646
  declare const objectFor: <T>(ref: T | number | null | undefined) => T | null;
351
647
 
352
- export { ApiQueryOptions, BrowserClient, BrowserClient as BrowserClientType, ClientBrowserConfig, ClientServerConfig, ClientState, CollectionClient, type CollectionDetailQueryParams, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, type CreateOrderParams, Order, OrderApi, type OrderApiOptions, OrderProduct, PayloadFindResponse, PayloadMutationResponse, ProductOption, PublicCollection, QueryHooks, type ReadOnlyQueryBuilder, ServerClient, ServerClient as ServerClientType, Transaction, type UpdateOrderParams, type UpdateTransactionParams, collectionKeys, createBrowserClient, createServerClient, formatOrderName, generateOrderNumber, getQueryClient, objectFor, resolveRelation };
648
+ export { type AddItemParams, ApiQueryOptions, BrowserClient, BrowserClient as BrowserClientType, CartApi, type CartApiOptions, CartItem, type CheckoutParams, ClientBrowserConfig, ClientServerConfig, ClientState, CollectionClient, type CollectionDetailQueryParams, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, Fulfillment, type GetOrderParams, Order, OrderApi, type OrderApiOptions, OrderProduct, PayloadFindResponse, PayloadMutationResponse, ProductApi, type ProductApiOptions, ProductOption, PublicCollection, QueryHooks, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveItemParams, Return, type ReturnWithRefundParams, ServerClient, ServerClient as ServerClientType, type StockCheckParams, type StockCheckResponse, type StockCheckResult, Transaction, type UpdateItemParams, type UpdateOrderParams, type UpdateReturnParams, type UpdateTransactionParams, collectionKeys, createBrowserClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, objectFor, resolveRelation };