@01.software/sdk 0.2.9-dev.260306.4e16dd4 → 0.2.9-dev.260310.cf511cb
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/{auth-D_6MQo4x.d.ts → auth-CVVo5UT5.d.ts} +13 -2
- package/dist/{auth-Hs3cAUfV.d.cts → auth-CqgrT1qd.d.cts} +13 -2
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +2 -2
- package/dist/auth.d.ts +2 -2
- package/dist/auth.js.map +1 -1
- package/dist/components.d.cts +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/flow.cjs +319 -61
- package/dist/flow.cjs.map +1 -1
- package/dist/flow.d.cts +88 -44
- package/dist/flow.d.ts +88 -44
- package/dist/flow.js +316 -57
- package/dist/flow.js.map +1 -1
- package/dist/index.cjs +248 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +229 -44
- package/dist/index.d.ts +229 -44
- package/dist/index.js +248 -51
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-p9NaGmQA.d.cts → payload-types-Cq93wqIe.d.cts} +2612 -896
- package/dist/{payload-types-p9NaGmQA.d.ts → payload-types-Cq93wqIe.d.ts} +2612 -896
- package/dist/{webhook-B9foVPGW.d.cts → webhook-C_7s0K66.d.ts} +2 -2
- package/dist/{webhook-CjgnfIo6.d.ts → webhook-NRdVwXN7.d.cts} +2 -2
- package/dist/webhook.cjs +1 -1
- package/dist/webhook.cjs.map +1 -1
- package/dist/webhook.d.cts +2 -2
- package/dist/webhook.d.ts +2 -2
- package/dist/webhook.js +1 -1
- package/dist/webhook.js.map +1 -1
- package/package.json +1 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, C as CartItem, P as
|
|
2
|
-
export {
|
|
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-
|
|
4
|
-
export {
|
|
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';
|
|
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-
|
|
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-
|
|
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';
|
|
9
9
|
import { Metadata } from 'next';
|
|
10
10
|
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
11
|
import 'payload';
|
|
@@ -16,12 +16,19 @@ interface OrderApiOptions {
|
|
|
16
16
|
baseUrl?: string;
|
|
17
17
|
}
|
|
18
18
|
type CreateOrderParams = {
|
|
19
|
-
paymentId: string;
|
|
20
19
|
orderNumber: string;
|
|
21
|
-
|
|
20
|
+
customer?: string;
|
|
21
|
+
customerSnapshot: {
|
|
22
|
+
name?: string;
|
|
23
|
+
email: string;
|
|
24
|
+
phone?: string;
|
|
25
|
+
};
|
|
22
26
|
shippingAddress: Order['shippingAddress'];
|
|
23
27
|
orderProducts: Omit<OrderProduct, 'id' | 'brand' | 'createdAt' | 'updatedAt' | 'order' | 'status'>[];
|
|
24
28
|
totalAmount: number;
|
|
29
|
+
shippingFee?: number;
|
|
30
|
+
paymentId?: string;
|
|
31
|
+
discountCode?: string;
|
|
25
32
|
};
|
|
26
33
|
type UpdateOrderParams = {
|
|
27
34
|
orderNumber: string;
|
|
@@ -30,18 +37,45 @@ type UpdateOrderParams = {
|
|
|
30
37
|
type UpdateTransactionParams = {
|
|
31
38
|
paymentId: string;
|
|
32
39
|
status: Transaction['status'];
|
|
33
|
-
paymentMethod
|
|
34
|
-
receiptUrl
|
|
40
|
+
paymentMethod?: string;
|
|
41
|
+
receiptUrl?: string;
|
|
35
42
|
};
|
|
36
43
|
type CheckoutParams = {
|
|
37
44
|
cartId: string;
|
|
38
|
-
paymentId: string;
|
|
39
45
|
orderNumber: string;
|
|
40
46
|
customerSnapshot: {
|
|
41
47
|
name?: string;
|
|
42
48
|
email: string;
|
|
43
49
|
phone?: string;
|
|
44
50
|
};
|
|
51
|
+
paymentId?: string;
|
|
52
|
+
discountCode?: string;
|
|
53
|
+
};
|
|
54
|
+
type ValidateDiscountParams = {
|
|
55
|
+
code: string;
|
|
56
|
+
orderAmount: number;
|
|
57
|
+
customerId?: string;
|
|
58
|
+
};
|
|
59
|
+
type ValidateDiscountResult = {
|
|
60
|
+
valid: boolean;
|
|
61
|
+
code: string;
|
|
62
|
+
type?: 'percentage' | 'fixed_amount' | 'free_shipping' | 'tiered';
|
|
63
|
+
discountAmount: number;
|
|
64
|
+
freeShipping?: boolean;
|
|
65
|
+
reason?: string;
|
|
66
|
+
};
|
|
67
|
+
type CalculateShippingParams = {
|
|
68
|
+
shippingPolicyId?: string;
|
|
69
|
+
orderAmount: number;
|
|
70
|
+
postalCode?: string;
|
|
71
|
+
};
|
|
72
|
+
type CalculateShippingResult = {
|
|
73
|
+
shippingFee: number;
|
|
74
|
+
baseFee: number;
|
|
75
|
+
extraFee: number;
|
|
76
|
+
freeShipping: boolean;
|
|
77
|
+
freeShippingThreshold: number | null;
|
|
78
|
+
isJeju: boolean;
|
|
45
79
|
};
|
|
46
80
|
type CreateFulfillmentParams = {
|
|
47
81
|
orderNumber: string;
|
|
@@ -52,6 +86,12 @@ type CreateFulfillmentParams = {
|
|
|
52
86
|
quantity: number;
|
|
53
87
|
}>;
|
|
54
88
|
};
|
|
89
|
+
type UpdateFulfillmentParams = {
|
|
90
|
+
fulfillmentId: string;
|
|
91
|
+
status: 'packed' | 'shipped' | 'delivered' | 'failed';
|
|
92
|
+
carrier?: string;
|
|
93
|
+
trackingNumber?: string;
|
|
94
|
+
};
|
|
55
95
|
type GetOrderParams = {
|
|
56
96
|
orderNumber: string;
|
|
57
97
|
};
|
|
@@ -71,7 +111,7 @@ type UpdateReturnParams = {
|
|
|
71
111
|
};
|
|
72
112
|
type ReturnWithRefundParams = {
|
|
73
113
|
orderNumber: string;
|
|
74
|
-
reason?:
|
|
114
|
+
reason?: 'change_of_mind' | 'defective' | 'wrong_delivery' | 'damaged' | 'other';
|
|
75
115
|
reasonDetail?: string;
|
|
76
116
|
returnProducts: Array<{
|
|
77
117
|
orderProduct: string;
|
|
@@ -81,6 +121,19 @@ type ReturnWithRefundParams = {
|
|
|
81
121
|
paymentId: string;
|
|
82
122
|
refundReceiptUrl?: string;
|
|
83
123
|
};
|
|
124
|
+
type CreateExchangeParams = {
|
|
125
|
+
orderNumber: string;
|
|
126
|
+
reason?: 'wrong_size' | 'wrong_color' | 'defective' | 'other';
|
|
127
|
+
reasonDetail?: string;
|
|
128
|
+
exchangeProducts: Array<{
|
|
129
|
+
orderProduct: string;
|
|
130
|
+
quantity: number;
|
|
131
|
+
}>;
|
|
132
|
+
};
|
|
133
|
+
type UpdateExchangeParams = {
|
|
134
|
+
exchangeId: string;
|
|
135
|
+
status: 'processing' | 'shipped' | 'completed' | 'rejected';
|
|
136
|
+
};
|
|
84
137
|
declare class OrderApi {
|
|
85
138
|
private readonly clientKey;
|
|
86
139
|
private readonly secretKey;
|
|
@@ -93,12 +146,17 @@ declare class OrderApi {
|
|
|
93
146
|
updateTransaction(params: UpdateTransactionParams): Promise<Transaction>;
|
|
94
147
|
checkout(params: CheckoutParams): Promise<Order>;
|
|
95
148
|
createFulfillment(params: CreateFulfillmentParams): Promise<Fulfillment>;
|
|
149
|
+
updateFulfillment(params: UpdateFulfillmentParams): Promise<Fulfillment>;
|
|
96
150
|
returnWithRefund(params: ReturnWithRefundParams): Promise<{
|
|
97
151
|
return: Return;
|
|
98
152
|
transaction: Transaction | null;
|
|
99
153
|
}>;
|
|
100
154
|
createReturn(params: CreateReturnParams): Promise<Return>;
|
|
101
155
|
updateReturn(params: UpdateReturnParams): Promise<Return>;
|
|
156
|
+
validateDiscount(params: ValidateDiscountParams): Promise<ValidateDiscountResult>;
|
|
157
|
+
calculateShipping(params: CalculateShippingParams): Promise<CalculateShippingResult>;
|
|
158
|
+
createExchange(params: CreateExchangeParams): Promise<Exchange>;
|
|
159
|
+
updateExchange(params: UpdateExchangeParams): Promise<Exchange>;
|
|
102
160
|
}
|
|
103
161
|
|
|
104
162
|
interface CartApiOptions {
|
|
@@ -106,6 +164,7 @@ interface CartApiOptions {
|
|
|
106
164
|
secretKey?: string;
|
|
107
165
|
customerToken?: string | (() => string | null);
|
|
108
166
|
baseUrl?: string;
|
|
167
|
+
onUnauthorized?: () => Promise<string | null>;
|
|
109
168
|
}
|
|
110
169
|
type AddItemParams = {
|
|
111
170
|
cartId: string;
|
|
@@ -121,18 +180,35 @@ type UpdateItemParams = {
|
|
|
121
180
|
type RemoveItemParams = {
|
|
122
181
|
cartItemId: string;
|
|
123
182
|
};
|
|
183
|
+
type ApplyDiscountParams = {
|
|
184
|
+
cartId: string;
|
|
185
|
+
discountCode: string;
|
|
186
|
+
};
|
|
187
|
+
type RemoveDiscountParams = {
|
|
188
|
+
cartId: string;
|
|
189
|
+
};
|
|
190
|
+
type ClearCartParams = {
|
|
191
|
+
cartId: string;
|
|
192
|
+
};
|
|
124
193
|
declare class CartApi {
|
|
125
194
|
private readonly clientKey;
|
|
126
195
|
private readonly secretKey?;
|
|
127
196
|
private readonly customerToken?;
|
|
128
197
|
private readonly baseUrl?;
|
|
198
|
+
private readonly onUnauthorized?;
|
|
129
199
|
constructor(options: CartApiOptions);
|
|
130
|
-
private
|
|
200
|
+
private execute;
|
|
201
|
+
getCart(cartId: string): Promise<Cart>;
|
|
131
202
|
addItem(params: AddItemParams): Promise<CartItem>;
|
|
132
203
|
updateItem(params: UpdateItemParams): Promise<CartItem>;
|
|
133
204
|
removeItem(params: RemoveItemParams): Promise<{
|
|
134
205
|
success: boolean;
|
|
135
206
|
}>;
|
|
207
|
+
applyDiscount(params: ApplyDiscountParams): Promise<Cart>;
|
|
208
|
+
removeDiscount(params: RemoveDiscountParams): Promise<Cart>;
|
|
209
|
+
clearCart(params: ClearCartParams): Promise<{
|
|
210
|
+
success: boolean;
|
|
211
|
+
}>;
|
|
136
212
|
}
|
|
137
213
|
|
|
138
214
|
interface ProductApiOptions {
|
|
@@ -167,8 +243,6 @@ declare class ProductApi {
|
|
|
167
243
|
}
|
|
168
244
|
|
|
169
245
|
interface GenerateMetadataOptions {
|
|
170
|
-
title?: string;
|
|
171
|
-
description?: string;
|
|
172
246
|
siteName?: string;
|
|
173
247
|
}
|
|
174
248
|
|
|
@@ -177,7 +251,8 @@ declare class HttpClient {
|
|
|
177
251
|
protected secretKey?: string;
|
|
178
252
|
protected baseUrl?: string;
|
|
179
253
|
private getCustomerToken?;
|
|
180
|
-
|
|
254
|
+
private onUnauthorized?;
|
|
255
|
+
constructor(clientKey: string, secretKey?: string, baseUrl?: string, getCustomerToken?: () => string | null, onUnauthorized?: () => Promise<string | null>);
|
|
181
256
|
protected get defaultOptions(): FetchOptions;
|
|
182
257
|
protected buildUrl(endpoint: string, options?: ApiQueryOptions): string;
|
|
183
258
|
protected assertJsonResponse(response: Response): void;
|
|
@@ -199,7 +274,7 @@ declare class HttpClient {
|
|
|
199
274
|
}
|
|
200
275
|
|
|
201
276
|
declare class CollectionClient extends HttpClient {
|
|
202
|
-
constructor(clientKey: string, secretKey?: string, baseUrl?: string, getCustomerToken?: () => string | null);
|
|
277
|
+
constructor(clientKey: string, secretKey?: string, baseUrl?: string, getCustomerToken?: () => string | null, onUnauthorized?: () => Promise<string | null>);
|
|
203
278
|
from<T extends PublicCollection>(collection: T): CollectionQueryBuilder<T>;
|
|
204
279
|
/**
|
|
205
280
|
* Find documents (list query)
|
|
@@ -368,6 +443,11 @@ interface CustomerLoginData {
|
|
|
368
443
|
interface CustomerRefreshResponse {
|
|
369
444
|
token: string;
|
|
370
445
|
}
|
|
446
|
+
interface UpdateProfileData {
|
|
447
|
+
name?: string;
|
|
448
|
+
phone?: string;
|
|
449
|
+
marketingConsent?: boolean;
|
|
450
|
+
}
|
|
371
451
|
interface CustomerAuthOptions {
|
|
372
452
|
/**
|
|
373
453
|
* Automatically persist token in localStorage.
|
|
@@ -395,6 +475,7 @@ declare class CustomerAuth {
|
|
|
395
475
|
private baseUrl;
|
|
396
476
|
private token;
|
|
397
477
|
private onTokenChange?;
|
|
478
|
+
private refreshPromise;
|
|
398
479
|
constructor(clientKey: string, baseUrl: string, options?: CustomerAuthOptions);
|
|
399
480
|
/**
|
|
400
481
|
* Register a new customer account
|
|
@@ -410,6 +491,7 @@ declare class CustomerAuth {
|
|
|
410
491
|
* Refresh the current token. Requires a valid (non-expired) token.
|
|
411
492
|
*/
|
|
412
493
|
refreshToken(): Promise<CustomerRefreshResponse>;
|
|
494
|
+
private _doRefreshToken;
|
|
413
495
|
/**
|
|
414
496
|
* Clear the stored token
|
|
415
497
|
*/
|
|
@@ -426,6 +508,10 @@ declare class CustomerAuth {
|
|
|
426
508
|
* Reset password using a token from the reset email
|
|
427
509
|
*/
|
|
428
510
|
resetPassword(token: string, password: string): Promise<void>;
|
|
511
|
+
/**
|
|
512
|
+
* Update the authenticated customer's profile (name, phone, marketingConsent)
|
|
513
|
+
*/
|
|
514
|
+
updateProfile(data: UpdateProfileData): Promise<CustomerProfile>;
|
|
429
515
|
/**
|
|
430
516
|
* Change the password of the currently authenticated customer
|
|
431
517
|
*/
|
|
@@ -434,6 +520,14 @@ declare class CustomerAuth {
|
|
|
434
520
|
* Verify email using the verification token
|
|
435
521
|
*/
|
|
436
522
|
verifyEmail(token: string): Promise<void>;
|
|
523
|
+
/**
|
|
524
|
+
* Get the authenticated customer's orders with pagination and optional status filter
|
|
525
|
+
*/
|
|
526
|
+
getMyOrders(options?: {
|
|
527
|
+
page?: number;
|
|
528
|
+
limit?: number;
|
|
529
|
+
status?: string;
|
|
530
|
+
}): Promise<PayloadFindResponse<Order>>;
|
|
437
531
|
/**
|
|
438
532
|
* Get the current token (or null if not authenticated)
|
|
439
533
|
*/
|
|
@@ -550,9 +644,9 @@ declare class QueryHooks {
|
|
|
550
644
|
collection: T;
|
|
551
645
|
}, options?: {
|
|
552
646
|
onSuccess?: (data: PayloadMutationResponse<CollectionType<T>>) => void;
|
|
553
|
-
onError?: (error:
|
|
647
|
+
onError?: (error: SDKError) => void;
|
|
554
648
|
onSettled?: () => void;
|
|
555
|
-
}): _tanstack_react_query.UseMutationResult<PayloadMutationResponse<CollectionType<T>>,
|
|
649
|
+
}): _tanstack_react_query.UseMutationResult<PayloadMutationResponse<CollectionType<T>>, SDKError, {
|
|
556
650
|
data: Partial<CollectionType<T>>;
|
|
557
651
|
file?: File | Blob;
|
|
558
652
|
filename?: string;
|
|
@@ -561,9 +655,9 @@ declare class QueryHooks {
|
|
|
561
655
|
collection: T;
|
|
562
656
|
}, options?: {
|
|
563
657
|
onSuccess?: (data: PayloadMutationResponse<CollectionType<T>>) => void;
|
|
564
|
-
onError?: (error:
|
|
658
|
+
onError?: (error: SDKError) => void;
|
|
565
659
|
onSettled?: () => void;
|
|
566
|
-
}): _tanstack_react_query.UseMutationResult<PayloadMutationResponse<CollectionType<T>>,
|
|
660
|
+
}): _tanstack_react_query.UseMutationResult<PayloadMutationResponse<CollectionType<T>>, SDKError, {
|
|
567
661
|
id: string;
|
|
568
662
|
data: Partial<CollectionType<T>>;
|
|
569
663
|
file?: File | Blob;
|
|
@@ -573,9 +667,9 @@ declare class QueryHooks {
|
|
|
573
667
|
collection: T;
|
|
574
668
|
}, options?: {
|
|
575
669
|
onSuccess?: (data: CollectionType<T>) => void;
|
|
576
|
-
onError?: (error:
|
|
670
|
+
onError?: (error: SDKError) => void;
|
|
577
671
|
onSettled?: () => void;
|
|
578
|
-
}): _tanstack_react_query.UseMutationResult<CollectionType<T>,
|
|
672
|
+
}): _tanstack_react_query.UseMutationResult<CollectionType<T>, SDKError, string, unknown>;
|
|
579
673
|
invalidateQueries<T extends PublicCollection>(collection: T, type?: 'list' | 'detail' | 'infinite'): Promise<void>;
|
|
580
674
|
getQueryData<T extends PublicCollection>(collection: T, type: 'list', options?: ApiQueryOptions): CollectionType<T>[] | undefined;
|
|
581
675
|
getQueryData<T extends PublicCollection>(collection: T, type: 'detail', id: string, options?: ApiQueryOptions): CollectionType<T> | null | undefined;
|
|
@@ -592,51 +686,56 @@ declare class QueryHooks {
|
|
|
592
686
|
}): _tanstack_react_query.UseQueryResult<CustomerProfile | null, Error>;
|
|
593
687
|
useCustomerLogin(options?: {
|
|
594
688
|
onSuccess?: (data: CustomerAuthResponse) => void;
|
|
595
|
-
onError?: (error:
|
|
689
|
+
onError?: (error: SDKError) => void;
|
|
596
690
|
onSettled?: () => void;
|
|
597
|
-
}): _tanstack_react_query.UseMutationResult<CustomerAuthResponse,
|
|
691
|
+
}): _tanstack_react_query.UseMutationResult<CustomerAuthResponse, SDKError, CustomerLoginData, unknown>;
|
|
598
692
|
useCustomerRegister(options?: {
|
|
599
693
|
onSuccess?: (data: {
|
|
600
694
|
customer: CustomerProfile;
|
|
601
695
|
}) => void;
|
|
602
|
-
onError?: (error:
|
|
696
|
+
onError?: (error: SDKError) => void;
|
|
603
697
|
onSettled?: () => void;
|
|
604
698
|
}): _tanstack_react_query.UseMutationResult<{
|
|
605
699
|
customer: CustomerProfile;
|
|
606
|
-
},
|
|
700
|
+
}, SDKError, CustomerRegisterData, unknown>;
|
|
607
701
|
useCustomerLogout(options?: {
|
|
608
702
|
onSuccess?: () => void;
|
|
609
|
-
onError?: (error:
|
|
703
|
+
onError?: (error: SDKError) => void;
|
|
610
704
|
onSettled?: () => void;
|
|
611
|
-
}): _tanstack_react_query.UseMutationResult<void,
|
|
705
|
+
}): _tanstack_react_query.UseMutationResult<void, SDKError, void, unknown>;
|
|
612
706
|
useCustomerForgotPassword(options?: {
|
|
613
707
|
onSuccess?: () => void;
|
|
614
|
-
onError?: (error:
|
|
708
|
+
onError?: (error: SDKError) => void;
|
|
615
709
|
onSettled?: () => void;
|
|
616
|
-
}): _tanstack_react_query.UseMutationResult<void,
|
|
710
|
+
}): _tanstack_react_query.UseMutationResult<void, SDKError, string, unknown>;
|
|
617
711
|
useCustomerResetPassword(options?: {
|
|
618
712
|
onSuccess?: () => void;
|
|
619
|
-
onError?: (error:
|
|
713
|
+
onError?: (error: SDKError) => void;
|
|
620
714
|
onSettled?: () => void;
|
|
621
|
-
}): _tanstack_react_query.UseMutationResult<void,
|
|
715
|
+
}): _tanstack_react_query.UseMutationResult<void, SDKError, {
|
|
622
716
|
token: string;
|
|
623
717
|
password: string;
|
|
624
718
|
}, unknown>;
|
|
625
719
|
useCustomerVerifyEmail(options?: {
|
|
626
720
|
onSuccess?: () => void;
|
|
627
|
-
onError?: (error:
|
|
721
|
+
onError?: (error: SDKError) => void;
|
|
628
722
|
onSettled?: () => void;
|
|
629
|
-
}): _tanstack_react_query.UseMutationResult<void,
|
|
723
|
+
}): _tanstack_react_query.UseMutationResult<void, SDKError, string, unknown>;
|
|
630
724
|
useCustomerRefreshToken(options?: {
|
|
631
725
|
onSuccess?: (data: CustomerRefreshResponse) => void;
|
|
632
|
-
onError?: (error:
|
|
726
|
+
onError?: (error: SDKError) => void;
|
|
633
727
|
onSettled?: () => void;
|
|
634
|
-
}): _tanstack_react_query.UseMutationResult<CustomerRefreshResponse,
|
|
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>;
|
|
635
734
|
useCustomerChangePassword(options?: {
|
|
636
735
|
onSuccess?: () => void;
|
|
637
|
-
onError?: (error:
|
|
736
|
+
onError?: (error: SDKError) => void;
|
|
638
737
|
onSettled?: () => void;
|
|
639
|
-
}): _tanstack_react_query.UseMutationResult<void,
|
|
738
|
+
}): _tanstack_react_query.UseMutationResult<void, SDKError, {
|
|
640
739
|
currentPassword: string;
|
|
641
740
|
newPassword: string;
|
|
642
741
|
}, unknown>;
|
|
@@ -657,6 +756,7 @@ declare class BrowserClient {
|
|
|
657
756
|
constructor(options: ClientBrowserConfig);
|
|
658
757
|
from<T extends PublicCollection>(collection: T): ReadOnlyQueryBuilder<T>;
|
|
659
758
|
getState(): ClientState;
|
|
759
|
+
getConfig(): ClientBrowserConfig;
|
|
660
760
|
}
|
|
661
761
|
declare function createBrowserClient(options: ClientBrowserConfig): BrowserClient;
|
|
662
762
|
|
|
@@ -681,7 +781,10 @@ declare function getQueryClient(): QueryClient;
|
|
|
681
781
|
|
|
682
782
|
declare const generateOrderNumber: () => string;
|
|
683
783
|
|
|
684
|
-
|
|
784
|
+
type OrderItem = {
|
|
785
|
+
product: Product | string | null | undefined;
|
|
786
|
+
};
|
|
787
|
+
declare const formatOrderName: (items: OrderItem[]) => string;
|
|
685
788
|
|
|
686
789
|
/**
|
|
687
790
|
* Resolves a Payload CMS relation field value.
|
|
@@ -692,8 +795,90 @@ declare const formatOrderName: (options: ProductOption[]) => string;
|
|
|
692
795
|
* @param ref - The relation field value (T, string, number, null, or undefined)
|
|
693
796
|
* @returns The resolved document object, or null if not populated
|
|
694
797
|
*/
|
|
695
|
-
declare const resolveRelation: <T>(ref: T | string | null | undefined) => T | null;
|
|
696
|
-
|
|
697
|
-
|
|
798
|
+
declare const resolveRelation: <T>(ref: T | string | number | null | undefined) => T | null;
|
|
799
|
+
|
|
800
|
+
interface VideoThumbnailOptions {
|
|
801
|
+
/** Width in pixels (default: 640) */
|
|
802
|
+
width?: number;
|
|
803
|
+
/** Height in pixels (auto if omitted) */
|
|
804
|
+
height?: number;
|
|
805
|
+
/** Time offset in seconds (default: 0) */
|
|
806
|
+
time?: number;
|
|
807
|
+
/** Fit mode (default: 'smartcrop') */
|
|
808
|
+
fitMode?: 'preserve' | 'stretch' | 'crop' | 'smartcrop' | 'pad';
|
|
809
|
+
/** Flip horizontally */
|
|
810
|
+
flipH?: boolean;
|
|
811
|
+
/** Flip vertically */
|
|
812
|
+
flipV?: boolean;
|
|
813
|
+
/** Rotation in degrees (90, 180, 270) */
|
|
814
|
+
rotate?: 90 | 180 | 270;
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Returns a Mux thumbnail URL for a video.
|
|
818
|
+
*
|
|
819
|
+
* @example
|
|
820
|
+
* ```ts
|
|
821
|
+
* getVideoThumbnail('abc123')
|
|
822
|
+
* // => 'https://image.mux.com/abc123/thumbnail.jpg?width=640'
|
|
823
|
+
*
|
|
824
|
+
* getVideoThumbnail('abc123', { width: 320, time: 5 })
|
|
825
|
+
* // => 'https://image.mux.com/abc123/thumbnail.jpg?width=320&time=5'
|
|
826
|
+
* ```
|
|
827
|
+
*/
|
|
828
|
+
declare function getVideoThumbnail(playbackId: string, options?: VideoThumbnailOptions): string;
|
|
829
|
+
interface VideoGifOptions {
|
|
830
|
+
/** Width in pixels (default: 320) */
|
|
831
|
+
width?: number;
|
|
832
|
+
/** Start time in seconds (default: 0) */
|
|
833
|
+
start?: number;
|
|
834
|
+
/** End time in seconds (default: start + 5) */
|
|
835
|
+
end?: number;
|
|
836
|
+
/** Frames per second (default: 15) */
|
|
837
|
+
fps?: number;
|
|
838
|
+
}
|
|
839
|
+
/**
|
|
840
|
+
* Returns a Mux animated GIF URL for a video.
|
|
841
|
+
*
|
|
842
|
+
* @example
|
|
843
|
+
* ```ts
|
|
844
|
+
* getVideoGif('abc123')
|
|
845
|
+
* // => 'https://image.mux.com/abc123/animated.gif?width=320'
|
|
846
|
+
*
|
|
847
|
+
* getVideoGif('abc123', { width: 240, start: 2, end: 6 })
|
|
848
|
+
* // => 'https://image.mux.com/abc123/animated.gif?width=240&start=2&end=6'
|
|
849
|
+
* ```
|
|
850
|
+
*/
|
|
851
|
+
declare function getVideoGif(playbackId: string, options?: VideoGifOptions): string;
|
|
852
|
+
/**
|
|
853
|
+
* Returns a Mux storyboard VTT URL for timeline hover previews.
|
|
854
|
+
*
|
|
855
|
+
* @example
|
|
856
|
+
* ```ts
|
|
857
|
+
* getVideoStoryboard('abc123')
|
|
858
|
+
* // => 'https://image.mux.com/abc123/storyboard.vtt'
|
|
859
|
+
* ```
|
|
860
|
+
*/
|
|
861
|
+
declare function getVideoStoryboard(playbackId: string): string;
|
|
862
|
+
/**
|
|
863
|
+
* Returns the HLS stream URL for a video.
|
|
864
|
+
*
|
|
865
|
+
* @example
|
|
866
|
+
* ```ts
|
|
867
|
+
* getVideoStreamUrl('abc123')
|
|
868
|
+
* // => 'https://stream.mux.com/abc123.m3u8'
|
|
869
|
+
* ```
|
|
870
|
+
*/
|
|
871
|
+
declare function getVideoStreamUrl(playbackId: string): string;
|
|
872
|
+
/**
|
|
873
|
+
* Returns a Mux MP4 download URL for a video.
|
|
874
|
+
* Only available if the asset was created with `mp4_support` enabled.
|
|
875
|
+
*
|
|
876
|
+
* @example
|
|
877
|
+
* ```ts
|
|
878
|
+
* getVideoMp4Url('abc123', 'high')
|
|
879
|
+
* // => 'https://stream.mux.com/abc123/high.mp4'
|
|
880
|
+
* ```
|
|
881
|
+
*/
|
|
882
|
+
declare function getVideoMp4Url(playbackId: string, resolution?: 'high' | 'medium' | 'low'): string;
|
|
698
883
|
|
|
699
|
-
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 GenerateMetadataOptions, type GetOrderParams, Order, OrderApi, type OrderApiOptions, OrderProduct, PayloadFindResponse, PayloadMutationResponse, ProductApi, type ProductApiOptions,
|
|
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 };
|