@01.software/sdk 0.2.9-dev.260306.4e16dd4 → 0.2.9-dev.260309.c56872d
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-BieKA-OQ.d.ts} +13 -2
- package/dist/{auth-Hs3cAUfV.d.cts → auth-CAV8xgZk.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 +210 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +227 -39
- package/dist/index.d.ts +227 -39
- package/dist/index.js +210 -24
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-p9NaGmQA.d.cts → payload-types-2wbfaDxp.d.cts} +979 -161
- package/dist/{payload-types-p9NaGmQA.d.ts → payload-types-2wbfaDxp.d.ts} +979 -161
- package/dist/{webhook-CjgnfIo6.d.ts → webhook-Byzl1A0g.d.cts} +2 -2
- package/dist/{webhook-B9foVPGW.d.cts → webhook-I6ZDGW1d.d.ts} +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 +22 -21
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-2wbfaDxp.cjs';
|
|
2
|
+
export { m as ApiUsage, ap as ApiUsageSelect, A as Audience, al as AudiencesSelect, bm as Auth, o as BillingHistory, ar as BillingHistorySelect, w as Brand, B as BrandLogo, aB as BrandLogosSelect, aA as BrandsSelect, aT as CartItemsSelect, aS as CartsSelect, g as CodeBlock, bl as CollectionsWidget, d as Config, y as Customer, G as CustomerAddress, aP as CustomerAddressesSelect, e as CustomerAuthOperations, z as CustomerGroup, D as CustomerGroupImage, aR as CustomerGroupImagesSelect, aQ as CustomerGroupsSelect, aO as CustomersSelect, N as Discount, aU as DiscountsSelect, Z as Document, a$ as DocumentCategoriesSelect, a0 as DocumentCategory, $ as DocumentImage, b1 as DocumentImagesSelect, _ as DocumentType, b0 as DocumentTypesSelect, a_ as DocumentsSelect, j as EmailLog, am as EmailLogsSelect, K as ExchangeProduct, aM as ExchangeProductsSelect, aL as ExchangesSelect, a7 as Flow, a9 as FlowEdgeType, ba as FlowEdgeTypesSelect, aa as FlowImage, bb as FlowImagesSelect, a8 as FlowNodeType, b9 as FlowNodeTypesSelect, b8 as FlowsSelect, F as Form, ae as FormSubmission, bg as FormSubmissionsSelect, bf as FormsSelect, H as FulfillmentItem, aI as FulfillmentItemsSelect, aH as FulfillmentsSelect, b5 as GalleriesSelect, a4 as Gallery, b7 as GalleryCategoriesSelect, a6 as GalleryCategory, a5 as GalleryImage, b6 as GalleryImagesSelect, I as IframeBlock, ac as LiveStream, ad as LiveStreamImage, be as LiveStreamImagesSelect, bd as LiveStreamsSelect, M as Media, ak as MediaSelect, a2 as Music, b3 as MusicsSelect, aE as OrderProductsSelect, L as OrderStatusLog, aG as OrderStatusLogsSelect, aD as OrdersSelect, af as PayloadKv, bh as PayloadKvSelect, ag as PayloadLockedDocument, bi as PayloadLockedDocumentsSelect, ai as PayloadMigration, bk as PayloadMigrationsSelect, ah as PayloadPreference, bj as PayloadPreferencesSelect, f as PlayerBlock, a1 as Playlist, a3 as PlaylistImage, b4 as PlaylistImagesSelect, b2 as PlaylistsSelect, Q as Post, W as PostAuthor, aW as PostAuthorsSelect, aX as PostCategoriesSelect, X as PostCategory, V as PostImage, aZ as PostImagesSelect, Y as PostTag, aY as PostTagsSelect, aV as PostsSelect, ax as ProductCategoriesSelect, t as ProductCategory, v as ProductCollection, az as ProductCollectionsSelect, q as ProductImage, aC as ProductImagesSelect, s as ProductOption, aw as ProductOptionsSelect, u as ProductTag, ay as ProductTagsSelect, r as ProductVariant, av as ProductVariantsSelect, au as ProductsSelect, J as ReturnProduct, aK as ReturnProductsSelect, aJ as ReturnsSelect, aN as ShippingPoliciesSelect, x as ShippingPolicy, n as Subscription, aq as SubscriptionsSelect, S as SupportedTimezones, i as Tenant, p as TenantLogo, as as TenantLogosSelect, ao as TenantMetadataSelect, k as TenantMetadatum, l as TenantOgImage, at as TenantOgImagesSelect, an as TenantsSelect, aF as TransactionsSelect, h as User, U as UserAuthOperations, aj as UsersSelect, ab as Video, bc as VideosSelect } from './payload-types-2wbfaDxp.cjs';
|
|
3
|
+
import { F as FetchOptions, A as ApiQueryOptions, P as PayloadFindResponse, a as PayloadMutationResponse, S as SDKError, C as ClientBrowserConfig, b as ClientState, c as ClientServerConfig } from './auth-CAV8xgZk.cjs';
|
|
4
|
+
export { x as API_URLS, f as ApiError, H as ApiQueryReactOptions, z as ClientMetadata, g as ConfigError, d as DebugConfig, D as DeepPartial, w as Environment, e as ErrorLogger, E as ExtractArrayType, G as GoneError, J as JwtPayload, N as NetworkError, B as PaginationMeta, R as RetryConfig, h as ServiceUnavailableError, T as TimeoutError, U as UsageLimitError, V as ValidationError, t as createApiKey, r as createServerToken, s as decodeServerToken, l as isApiError, m as isConfigError, o as isGoneError, j as isNetworkError, i as isSDKError, p as isServiceUnavailableError, n as isTimeoutError, q as isUsageLimitError, k as isValidationError, u as parseApiKey, y as resolveApiUrl, v as verifyServerToken } from './auth-CAV8xgZk.cjs';
|
|
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-Byzl1A0g.cjs';
|
|
8
|
+
export { b as COLLECTIONS, a as Collection, c as WebhookEvent, d as WebhookHandler, W as WebhookOperation, e as WebhookOptions, f as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-Byzl1A0g.cjs';
|
|
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,18 @@ 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
|
+
paymentId?: string;
|
|
30
|
+
discountCode?: string;
|
|
25
31
|
};
|
|
26
32
|
type UpdateOrderParams = {
|
|
27
33
|
orderNumber: string;
|
|
@@ -30,18 +36,45 @@ type UpdateOrderParams = {
|
|
|
30
36
|
type UpdateTransactionParams = {
|
|
31
37
|
paymentId: string;
|
|
32
38
|
status: Transaction['status'];
|
|
33
|
-
paymentMethod
|
|
34
|
-
receiptUrl
|
|
39
|
+
paymentMethod?: string;
|
|
40
|
+
receiptUrl?: string;
|
|
35
41
|
};
|
|
36
42
|
type CheckoutParams = {
|
|
37
43
|
cartId: string;
|
|
38
|
-
paymentId: string;
|
|
39
44
|
orderNumber: string;
|
|
40
45
|
customerSnapshot: {
|
|
41
46
|
name?: string;
|
|
42
47
|
email: string;
|
|
43
48
|
phone?: string;
|
|
44
49
|
};
|
|
50
|
+
paymentId?: string;
|
|
51
|
+
discountCode?: string;
|
|
52
|
+
};
|
|
53
|
+
type ValidateDiscountParams = {
|
|
54
|
+
code: string;
|
|
55
|
+
orderAmount: number;
|
|
56
|
+
customerId?: string;
|
|
57
|
+
};
|
|
58
|
+
type ValidateDiscountResult = {
|
|
59
|
+
valid: boolean;
|
|
60
|
+
code: string;
|
|
61
|
+
type?: 'percentage' | 'fixed_amount' | 'free_shipping' | 'tiered';
|
|
62
|
+
discountAmount: number;
|
|
63
|
+
freeShipping?: boolean;
|
|
64
|
+
reason?: string;
|
|
65
|
+
};
|
|
66
|
+
type CalculateShippingParams = {
|
|
67
|
+
shippingPolicyId?: string;
|
|
68
|
+
orderAmount: number;
|
|
69
|
+
postalCode?: string;
|
|
70
|
+
};
|
|
71
|
+
type CalculateShippingResult = {
|
|
72
|
+
shippingFee: number;
|
|
73
|
+
baseFee: number;
|
|
74
|
+
extraFee: number;
|
|
75
|
+
freeShipping: boolean;
|
|
76
|
+
freeShippingThreshold: number | null;
|
|
77
|
+
isJeju: boolean;
|
|
45
78
|
};
|
|
46
79
|
type CreateFulfillmentParams = {
|
|
47
80
|
orderNumber: string;
|
|
@@ -52,6 +85,12 @@ type CreateFulfillmentParams = {
|
|
|
52
85
|
quantity: number;
|
|
53
86
|
}>;
|
|
54
87
|
};
|
|
88
|
+
type UpdateFulfillmentParams = {
|
|
89
|
+
fulfillmentId: string;
|
|
90
|
+
status: 'packed' | 'shipped' | 'delivered' | 'failed';
|
|
91
|
+
carrier?: string;
|
|
92
|
+
trackingNumber?: string;
|
|
93
|
+
};
|
|
55
94
|
type GetOrderParams = {
|
|
56
95
|
orderNumber: string;
|
|
57
96
|
};
|
|
@@ -71,7 +110,7 @@ type UpdateReturnParams = {
|
|
|
71
110
|
};
|
|
72
111
|
type ReturnWithRefundParams = {
|
|
73
112
|
orderNumber: string;
|
|
74
|
-
reason?:
|
|
113
|
+
reason?: 'change_of_mind' | 'defective' | 'wrong_delivery' | 'damaged' | 'other';
|
|
75
114
|
reasonDetail?: string;
|
|
76
115
|
returnProducts: Array<{
|
|
77
116
|
orderProduct: string;
|
|
@@ -81,6 +120,19 @@ type ReturnWithRefundParams = {
|
|
|
81
120
|
paymentId: string;
|
|
82
121
|
refundReceiptUrl?: string;
|
|
83
122
|
};
|
|
123
|
+
type CreateExchangeParams = {
|
|
124
|
+
orderNumber: string;
|
|
125
|
+
reason?: 'wrong_size' | 'wrong_color' | 'defective' | 'other';
|
|
126
|
+
reasonDetail?: string;
|
|
127
|
+
exchangeProducts: Array<{
|
|
128
|
+
orderProduct: string;
|
|
129
|
+
quantity: number;
|
|
130
|
+
}>;
|
|
131
|
+
};
|
|
132
|
+
type UpdateExchangeParams = {
|
|
133
|
+
exchangeId: string;
|
|
134
|
+
status: 'processing' | 'shipped' | 'completed' | 'rejected';
|
|
135
|
+
};
|
|
84
136
|
declare class OrderApi {
|
|
85
137
|
private readonly clientKey;
|
|
86
138
|
private readonly secretKey;
|
|
@@ -93,12 +145,17 @@ declare class OrderApi {
|
|
|
93
145
|
updateTransaction(params: UpdateTransactionParams): Promise<Transaction>;
|
|
94
146
|
checkout(params: CheckoutParams): Promise<Order>;
|
|
95
147
|
createFulfillment(params: CreateFulfillmentParams): Promise<Fulfillment>;
|
|
148
|
+
updateFulfillment(params: UpdateFulfillmentParams): Promise<Fulfillment>;
|
|
96
149
|
returnWithRefund(params: ReturnWithRefundParams): Promise<{
|
|
97
150
|
return: Return;
|
|
98
151
|
transaction: Transaction | null;
|
|
99
152
|
}>;
|
|
100
153
|
createReturn(params: CreateReturnParams): Promise<Return>;
|
|
101
154
|
updateReturn(params: UpdateReturnParams): Promise<Return>;
|
|
155
|
+
validateDiscount(params: ValidateDiscountParams): Promise<ValidateDiscountResult>;
|
|
156
|
+
calculateShipping(params: CalculateShippingParams): Promise<CalculateShippingResult>;
|
|
157
|
+
createExchange(params: CreateExchangeParams): Promise<Exchange>;
|
|
158
|
+
updateExchange(params: UpdateExchangeParams): Promise<Exchange>;
|
|
102
159
|
}
|
|
103
160
|
|
|
104
161
|
interface CartApiOptions {
|
|
@@ -106,6 +163,7 @@ interface CartApiOptions {
|
|
|
106
163
|
secretKey?: string;
|
|
107
164
|
customerToken?: string | (() => string | null);
|
|
108
165
|
baseUrl?: string;
|
|
166
|
+
onUnauthorized?: () => Promise<string | null>;
|
|
109
167
|
}
|
|
110
168
|
type AddItemParams = {
|
|
111
169
|
cartId: string;
|
|
@@ -121,18 +179,35 @@ type UpdateItemParams = {
|
|
|
121
179
|
type RemoveItemParams = {
|
|
122
180
|
cartItemId: string;
|
|
123
181
|
};
|
|
182
|
+
type ApplyDiscountParams = {
|
|
183
|
+
cartId: string;
|
|
184
|
+
discountCode: string;
|
|
185
|
+
};
|
|
186
|
+
type RemoveDiscountParams = {
|
|
187
|
+
cartId: string;
|
|
188
|
+
};
|
|
189
|
+
type ClearCartParams = {
|
|
190
|
+
cartId: string;
|
|
191
|
+
};
|
|
124
192
|
declare class CartApi {
|
|
125
193
|
private readonly clientKey;
|
|
126
194
|
private readonly secretKey?;
|
|
127
195
|
private readonly customerToken?;
|
|
128
196
|
private readonly baseUrl?;
|
|
197
|
+
private readonly onUnauthorized?;
|
|
129
198
|
constructor(options: CartApiOptions);
|
|
130
|
-
private
|
|
199
|
+
private execute;
|
|
200
|
+
getCart(cartId: string): Promise<Cart>;
|
|
131
201
|
addItem(params: AddItemParams): Promise<CartItem>;
|
|
132
202
|
updateItem(params: UpdateItemParams): Promise<CartItem>;
|
|
133
203
|
removeItem(params: RemoveItemParams): Promise<{
|
|
134
204
|
success: boolean;
|
|
135
205
|
}>;
|
|
206
|
+
applyDiscount(params: ApplyDiscountParams): Promise<Cart>;
|
|
207
|
+
removeDiscount(params: RemoveDiscountParams): Promise<Cart>;
|
|
208
|
+
clearCart(params: ClearCartParams): Promise<{
|
|
209
|
+
success: boolean;
|
|
210
|
+
}>;
|
|
136
211
|
}
|
|
137
212
|
|
|
138
213
|
interface ProductApiOptions {
|
|
@@ -177,7 +252,8 @@ declare class HttpClient {
|
|
|
177
252
|
protected secretKey?: string;
|
|
178
253
|
protected baseUrl?: string;
|
|
179
254
|
private getCustomerToken?;
|
|
180
|
-
|
|
255
|
+
private onUnauthorized?;
|
|
256
|
+
constructor(clientKey: string, secretKey?: string, baseUrl?: string, getCustomerToken?: () => string | null, onUnauthorized?: () => Promise<string | null>);
|
|
181
257
|
protected get defaultOptions(): FetchOptions;
|
|
182
258
|
protected buildUrl(endpoint: string, options?: ApiQueryOptions): string;
|
|
183
259
|
protected assertJsonResponse(response: Response): void;
|
|
@@ -199,7 +275,7 @@ declare class HttpClient {
|
|
|
199
275
|
}
|
|
200
276
|
|
|
201
277
|
declare class CollectionClient extends HttpClient {
|
|
202
|
-
constructor(clientKey: string, secretKey?: string, baseUrl?: string, getCustomerToken?: () => string | null);
|
|
278
|
+
constructor(clientKey: string, secretKey?: string, baseUrl?: string, getCustomerToken?: () => string | null, onUnauthorized?: () => Promise<string | null>);
|
|
203
279
|
from<T extends PublicCollection>(collection: T): CollectionQueryBuilder<T>;
|
|
204
280
|
/**
|
|
205
281
|
* Find documents (list query)
|
|
@@ -368,6 +444,11 @@ interface CustomerLoginData {
|
|
|
368
444
|
interface CustomerRefreshResponse {
|
|
369
445
|
token: string;
|
|
370
446
|
}
|
|
447
|
+
interface UpdateProfileData {
|
|
448
|
+
name?: string;
|
|
449
|
+
phone?: string;
|
|
450
|
+
marketingConsent?: boolean;
|
|
451
|
+
}
|
|
371
452
|
interface CustomerAuthOptions {
|
|
372
453
|
/**
|
|
373
454
|
* Automatically persist token in localStorage.
|
|
@@ -395,6 +476,7 @@ declare class CustomerAuth {
|
|
|
395
476
|
private baseUrl;
|
|
396
477
|
private token;
|
|
397
478
|
private onTokenChange?;
|
|
479
|
+
private refreshPromise;
|
|
398
480
|
constructor(clientKey: string, baseUrl: string, options?: CustomerAuthOptions);
|
|
399
481
|
/**
|
|
400
482
|
* Register a new customer account
|
|
@@ -410,6 +492,7 @@ declare class CustomerAuth {
|
|
|
410
492
|
* Refresh the current token. Requires a valid (non-expired) token.
|
|
411
493
|
*/
|
|
412
494
|
refreshToken(): Promise<CustomerRefreshResponse>;
|
|
495
|
+
private _doRefreshToken;
|
|
413
496
|
/**
|
|
414
497
|
* Clear the stored token
|
|
415
498
|
*/
|
|
@@ -426,6 +509,10 @@ declare class CustomerAuth {
|
|
|
426
509
|
* Reset password using a token from the reset email
|
|
427
510
|
*/
|
|
428
511
|
resetPassword(token: string, password: string): Promise<void>;
|
|
512
|
+
/**
|
|
513
|
+
* Update the authenticated customer's profile (name, phone, marketingConsent)
|
|
514
|
+
*/
|
|
515
|
+
updateProfile(data: UpdateProfileData): Promise<CustomerProfile>;
|
|
429
516
|
/**
|
|
430
517
|
* Change the password of the currently authenticated customer
|
|
431
518
|
*/
|
|
@@ -434,6 +521,14 @@ declare class CustomerAuth {
|
|
|
434
521
|
* Verify email using the verification token
|
|
435
522
|
*/
|
|
436
523
|
verifyEmail(token: string): Promise<void>;
|
|
524
|
+
/**
|
|
525
|
+
* Get the authenticated customer's orders with pagination and optional status filter
|
|
526
|
+
*/
|
|
527
|
+
getMyOrders(options?: {
|
|
528
|
+
page?: number;
|
|
529
|
+
limit?: number;
|
|
530
|
+
status?: string;
|
|
531
|
+
}): Promise<unknown>;
|
|
437
532
|
/**
|
|
438
533
|
* Get the current token (or null if not authenticated)
|
|
439
534
|
*/
|
|
@@ -550,9 +645,9 @@ declare class QueryHooks {
|
|
|
550
645
|
collection: T;
|
|
551
646
|
}, options?: {
|
|
552
647
|
onSuccess?: (data: PayloadMutationResponse<CollectionType<T>>) => void;
|
|
553
|
-
onError?: (error:
|
|
648
|
+
onError?: (error: SDKError) => void;
|
|
554
649
|
onSettled?: () => void;
|
|
555
|
-
}): _tanstack_react_query.UseMutationResult<PayloadMutationResponse<CollectionType<T>>,
|
|
650
|
+
}): _tanstack_react_query.UseMutationResult<PayloadMutationResponse<CollectionType<T>>, SDKError, {
|
|
556
651
|
data: Partial<CollectionType<T>>;
|
|
557
652
|
file?: File | Blob;
|
|
558
653
|
filename?: string;
|
|
@@ -561,9 +656,9 @@ declare class QueryHooks {
|
|
|
561
656
|
collection: T;
|
|
562
657
|
}, options?: {
|
|
563
658
|
onSuccess?: (data: PayloadMutationResponse<CollectionType<T>>) => void;
|
|
564
|
-
onError?: (error:
|
|
659
|
+
onError?: (error: SDKError) => void;
|
|
565
660
|
onSettled?: () => void;
|
|
566
|
-
}): _tanstack_react_query.UseMutationResult<PayloadMutationResponse<CollectionType<T>>,
|
|
661
|
+
}): _tanstack_react_query.UseMutationResult<PayloadMutationResponse<CollectionType<T>>, SDKError, {
|
|
567
662
|
id: string;
|
|
568
663
|
data: Partial<CollectionType<T>>;
|
|
569
664
|
file?: File | Blob;
|
|
@@ -573,9 +668,9 @@ declare class QueryHooks {
|
|
|
573
668
|
collection: T;
|
|
574
669
|
}, options?: {
|
|
575
670
|
onSuccess?: (data: CollectionType<T>) => void;
|
|
576
|
-
onError?: (error:
|
|
671
|
+
onError?: (error: SDKError) => void;
|
|
577
672
|
onSettled?: () => void;
|
|
578
|
-
}): _tanstack_react_query.UseMutationResult<CollectionType<T>,
|
|
673
|
+
}): _tanstack_react_query.UseMutationResult<CollectionType<T>, SDKError, string, unknown>;
|
|
579
674
|
invalidateQueries<T extends PublicCollection>(collection: T, type?: 'list' | 'detail' | 'infinite'): Promise<void>;
|
|
580
675
|
getQueryData<T extends PublicCollection>(collection: T, type: 'list', options?: ApiQueryOptions): CollectionType<T>[] | undefined;
|
|
581
676
|
getQueryData<T extends PublicCollection>(collection: T, type: 'detail', id: string, options?: ApiQueryOptions): CollectionType<T> | null | undefined;
|
|
@@ -592,51 +687,56 @@ declare class QueryHooks {
|
|
|
592
687
|
}): _tanstack_react_query.UseQueryResult<CustomerProfile | null, Error>;
|
|
593
688
|
useCustomerLogin(options?: {
|
|
594
689
|
onSuccess?: (data: CustomerAuthResponse) => void;
|
|
595
|
-
onError?: (error:
|
|
690
|
+
onError?: (error: SDKError) => void;
|
|
596
691
|
onSettled?: () => void;
|
|
597
|
-
}): _tanstack_react_query.UseMutationResult<CustomerAuthResponse,
|
|
692
|
+
}): _tanstack_react_query.UseMutationResult<CustomerAuthResponse, SDKError, CustomerLoginData, unknown>;
|
|
598
693
|
useCustomerRegister(options?: {
|
|
599
694
|
onSuccess?: (data: {
|
|
600
695
|
customer: CustomerProfile;
|
|
601
696
|
}) => void;
|
|
602
|
-
onError?: (error:
|
|
697
|
+
onError?: (error: SDKError) => void;
|
|
603
698
|
onSettled?: () => void;
|
|
604
699
|
}): _tanstack_react_query.UseMutationResult<{
|
|
605
700
|
customer: CustomerProfile;
|
|
606
|
-
},
|
|
701
|
+
}, SDKError, CustomerRegisterData, unknown>;
|
|
607
702
|
useCustomerLogout(options?: {
|
|
608
703
|
onSuccess?: () => void;
|
|
609
|
-
onError?: (error:
|
|
704
|
+
onError?: (error: SDKError) => void;
|
|
610
705
|
onSettled?: () => void;
|
|
611
|
-
}): _tanstack_react_query.UseMutationResult<void,
|
|
706
|
+
}): _tanstack_react_query.UseMutationResult<void, SDKError, void, unknown>;
|
|
612
707
|
useCustomerForgotPassword(options?: {
|
|
613
708
|
onSuccess?: () => void;
|
|
614
|
-
onError?: (error:
|
|
709
|
+
onError?: (error: SDKError) => void;
|
|
615
710
|
onSettled?: () => void;
|
|
616
|
-
}): _tanstack_react_query.UseMutationResult<void,
|
|
711
|
+
}): _tanstack_react_query.UseMutationResult<void, SDKError, string, unknown>;
|
|
617
712
|
useCustomerResetPassword(options?: {
|
|
618
713
|
onSuccess?: () => void;
|
|
619
|
-
onError?: (error:
|
|
714
|
+
onError?: (error: SDKError) => void;
|
|
620
715
|
onSettled?: () => void;
|
|
621
|
-
}): _tanstack_react_query.UseMutationResult<void,
|
|
716
|
+
}): _tanstack_react_query.UseMutationResult<void, SDKError, {
|
|
622
717
|
token: string;
|
|
623
718
|
password: string;
|
|
624
719
|
}, unknown>;
|
|
625
720
|
useCustomerVerifyEmail(options?: {
|
|
626
721
|
onSuccess?: () => void;
|
|
627
|
-
onError?: (error:
|
|
722
|
+
onError?: (error: SDKError) => void;
|
|
628
723
|
onSettled?: () => void;
|
|
629
|
-
}): _tanstack_react_query.UseMutationResult<void,
|
|
724
|
+
}): _tanstack_react_query.UseMutationResult<void, SDKError, string, unknown>;
|
|
630
725
|
useCustomerRefreshToken(options?: {
|
|
631
726
|
onSuccess?: (data: CustomerRefreshResponse) => void;
|
|
632
|
-
onError?: (error:
|
|
727
|
+
onError?: (error: SDKError) => void;
|
|
633
728
|
onSettled?: () => void;
|
|
634
|
-
}): _tanstack_react_query.UseMutationResult<CustomerRefreshResponse,
|
|
729
|
+
}): _tanstack_react_query.UseMutationResult<CustomerRefreshResponse, SDKError, void, unknown>;
|
|
730
|
+
useCustomerUpdateProfile(options?: {
|
|
731
|
+
onSuccess?: (data: CustomerProfile) => void;
|
|
732
|
+
onError?: (error: SDKError) => void;
|
|
733
|
+
onSettled?: () => void;
|
|
734
|
+
}): _tanstack_react_query.UseMutationResult<CustomerProfile, SDKError, UpdateProfileData, unknown>;
|
|
635
735
|
useCustomerChangePassword(options?: {
|
|
636
736
|
onSuccess?: () => void;
|
|
637
|
-
onError?: (error:
|
|
737
|
+
onError?: (error: SDKError) => void;
|
|
638
738
|
onSettled?: () => void;
|
|
639
|
-
}): _tanstack_react_query.UseMutationResult<void,
|
|
739
|
+
}): _tanstack_react_query.UseMutationResult<void, SDKError, {
|
|
640
740
|
currentPassword: string;
|
|
641
741
|
newPassword: string;
|
|
642
742
|
}, unknown>;
|
|
@@ -657,6 +757,7 @@ declare class BrowserClient {
|
|
|
657
757
|
constructor(options: ClientBrowserConfig);
|
|
658
758
|
from<T extends PublicCollection>(collection: T): ReadOnlyQueryBuilder<T>;
|
|
659
759
|
getState(): ClientState;
|
|
760
|
+
getConfig(): ClientBrowserConfig;
|
|
660
761
|
}
|
|
661
762
|
declare function createBrowserClient(options: ClientBrowserConfig): BrowserClient;
|
|
662
763
|
|
|
@@ -681,7 +782,10 @@ declare function getQueryClient(): QueryClient;
|
|
|
681
782
|
|
|
682
783
|
declare const generateOrderNumber: () => string;
|
|
683
784
|
|
|
684
|
-
|
|
785
|
+
type OrderItem = {
|
|
786
|
+
product: Product | string | null | undefined;
|
|
787
|
+
};
|
|
788
|
+
declare const formatOrderName: (items: OrderItem[]) => string;
|
|
685
789
|
|
|
686
790
|
/**
|
|
687
791
|
* Resolves a Payload CMS relation field value.
|
|
@@ -696,4 +800,88 @@ declare const resolveRelation: <T>(ref: T | string | null | undefined) => T | nu
|
|
|
696
800
|
/** @deprecated Use `resolveRelation` instead */
|
|
697
801
|
declare const objectFor: <T>(ref: T | string | null | undefined) => T | null;
|
|
698
802
|
|
|
699
|
-
|
|
803
|
+
interface VideoThumbnailOptions {
|
|
804
|
+
/** Width in pixels (default: 640) */
|
|
805
|
+
width?: number;
|
|
806
|
+
/** Height in pixels (auto if omitted) */
|
|
807
|
+
height?: number;
|
|
808
|
+
/** Time offset in seconds (default: 0) */
|
|
809
|
+
time?: number;
|
|
810
|
+
/** Fit mode (default: 'smartcrop') */
|
|
811
|
+
fitMode?: 'preserve' | 'stretch' | 'crop' | 'smartcrop' | 'pad';
|
|
812
|
+
/** Flip horizontally */
|
|
813
|
+
flipH?: boolean;
|
|
814
|
+
/** Flip vertically */
|
|
815
|
+
flipV?: boolean;
|
|
816
|
+
/** Rotation in degrees (90, 180, 270) */
|
|
817
|
+
rotate?: 90 | 180 | 270;
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
* Returns a Mux thumbnail URL for a video.
|
|
821
|
+
*
|
|
822
|
+
* @example
|
|
823
|
+
* ```ts
|
|
824
|
+
* getVideoThumbnail('abc123')
|
|
825
|
+
* // => 'https://image.mux.com/abc123/thumbnail.jpg?width=640'
|
|
826
|
+
*
|
|
827
|
+
* getVideoThumbnail('abc123', { width: 320, time: 5 })
|
|
828
|
+
* // => 'https://image.mux.com/abc123/thumbnail.jpg?width=320&time=5'
|
|
829
|
+
* ```
|
|
830
|
+
*/
|
|
831
|
+
declare function getVideoThumbnail(playbackId: string, options?: VideoThumbnailOptions): string;
|
|
832
|
+
interface VideoGifOptions {
|
|
833
|
+
/** Width in pixels (default: 320) */
|
|
834
|
+
width?: number;
|
|
835
|
+
/** Start time in seconds (default: 0) */
|
|
836
|
+
start?: number;
|
|
837
|
+
/** End time in seconds (default: start + 5) */
|
|
838
|
+
end?: number;
|
|
839
|
+
/** Frames per second (default: 15) */
|
|
840
|
+
fps?: number;
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* Returns a Mux animated GIF URL for a video.
|
|
844
|
+
*
|
|
845
|
+
* @example
|
|
846
|
+
* ```ts
|
|
847
|
+
* getVideoGif('abc123')
|
|
848
|
+
* // => 'https://image.mux.com/abc123/animated.gif?width=320'
|
|
849
|
+
*
|
|
850
|
+
* getVideoGif('abc123', { width: 240, start: 2, end: 6 })
|
|
851
|
+
* // => 'https://image.mux.com/abc123/animated.gif?width=240&start=2&end=6'
|
|
852
|
+
* ```
|
|
853
|
+
*/
|
|
854
|
+
declare function getVideoGif(playbackId: string, options?: VideoGifOptions): string;
|
|
855
|
+
/**
|
|
856
|
+
* Returns a Mux storyboard VTT URL for timeline hover previews.
|
|
857
|
+
*
|
|
858
|
+
* @example
|
|
859
|
+
* ```ts
|
|
860
|
+
* getVideoStoryboard('abc123')
|
|
861
|
+
* // => 'https://image.mux.com/abc123/storyboard.vtt'
|
|
862
|
+
* ```
|
|
863
|
+
*/
|
|
864
|
+
declare function getVideoStoryboard(playbackId: string): string;
|
|
865
|
+
/**
|
|
866
|
+
* Returns the HLS stream URL for a video.
|
|
867
|
+
*
|
|
868
|
+
* @example
|
|
869
|
+
* ```ts
|
|
870
|
+
* getVideoStreamUrl('abc123')
|
|
871
|
+
* // => 'https://stream.mux.com/abc123.m3u8'
|
|
872
|
+
* ```
|
|
873
|
+
*/
|
|
874
|
+
declare function getVideoStreamUrl(playbackId: string): string;
|
|
875
|
+
/**
|
|
876
|
+
* Returns a Mux MP4 download URL for a video.
|
|
877
|
+
* Only available if the asset was created with `mp4_support` enabled.
|
|
878
|
+
*
|
|
879
|
+
* @example
|
|
880
|
+
* ```ts
|
|
881
|
+
* getVideoMp4Url('abc123', 'high')
|
|
882
|
+
* // => 'https://stream.mux.com/abc123/high.mp4'
|
|
883
|
+
* ```
|
|
884
|
+
*/
|
|
885
|
+
declare function getVideoMp4Url(playbackId: string, resolution?: 'high' | 'medium' | 'low'): string;
|
|
886
|
+
|
|
887
|
+
export { type AddItemParams, ApiQueryOptions, type ApplyDiscountParams, BrowserClient, BrowserClient as BrowserClientType, type CalculateShippingParams, type CalculateShippingResult, Cart, CartApi, type CartApiOptions, CartItem, type CheckoutParams, type ClearCartParams, ClientBrowserConfig, ClientServerConfig, ClientState, CollectionClient, type CollectionDetailQueryParams, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, type CreateExchangeParams, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, Exchange, Fulfillment, type GenerateMetadataOptions, type GetOrderParams, Order, OrderApi, type OrderApiOptions, OrderProduct, PayloadFindResponse, PayloadMutationResponse, Product, ProductApi, type ProductApiOptions, PublicCollection, QueryHooks, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveDiscountParams, type RemoveItemParams, Return, type ReturnWithRefundParams, SDKError, ServerClient, ServerClient as ServerClientType, type StockCheckParams, type StockCheckResponse, type StockCheckResult, Transaction, type UpdateExchangeParams, type UpdateFulfillmentParams, type UpdateItemParams, type UpdateOrderParams, type UpdateProfileData, type UpdateReturnParams, type UpdateTransactionParams, type ValidateDiscountParams, type ValidateDiscountResult, type VideoGifOptions, type VideoThumbnailOptions, collectionKeys, createBrowserClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, getVideoGif, getVideoMp4Url, getVideoStoryboard, getVideoStreamUrl, getVideoThumbnail, objectFor, resolveRelation };
|