@01.software/sdk 0.32.0 → 0.34.0
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/README.md +253 -38
- package/dist/analytics/react.cjs.map +1 -1
- package/dist/analytics/react.js.map +1 -1
- package/dist/analytics.cjs.map +1 -1
- package/dist/analytics.js.map +1 -1
- package/dist/client.cjs +368 -24
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +7 -6
- package/dist/client.d.ts +7 -6
- package/dist/client.js +368 -24
- package/dist/client.js.map +1 -1
- package/dist/{collection-client-CORhppPb.d.cts → collection-client-CR2B8c1v.d.cts} +7 -3
- package/dist/{collection-client-DPGXnhoF.d.ts → collection-client-DkREjhQ9.d.ts} +7 -3
- package/dist/{const-DcY2_z9O.d.ts → const-BTvdrXtY.d.cts} +5 -5
- package/dist/{const-Brk2Ff0q.d.cts → const-CdqCauHQ.d.ts} +5 -5
- package/dist/index-CjA3U6X3.d.cts +186 -0
- package/dist/index-DK8_NXkh.d.ts +186 -0
- package/dist/index.cjs +1651 -260
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +74 -9
- package/dist/index.d.ts +74 -9
- package/dist/index.js +1651 -260
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-DVK1QCeU.d.cts → payload-types-C7tb7Xbs.d.cts} +2115 -1833
- package/dist/{payload-types-DVK1QCeU.d.ts → payload-types-C7tb7Xbs.d.ts} +2115 -1833
- package/dist/query.cjs +194 -35
- package/dist/query.cjs.map +1 -1
- package/dist/query.d.cts +45 -18
- package/dist/query.d.ts +45 -18
- package/dist/query.js +194 -35
- package/dist/query.js.map +1 -1
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.d.cts +2 -2
- package/dist/realtime.d.ts +2 -2
- package/dist/realtime.js.map +1 -1
- package/dist/{server-CrsPyqEc.d.cts → server-nXOezi4b.d.cts} +22 -6
- package/dist/{server-CrsPyqEc.d.ts → server-nXOezi4b.d.ts} +22 -6
- package/dist/server.cjs +474 -36
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +11 -179
- package/dist/server.d.ts +11 -179
- package/dist/server.js +474 -36
- package/dist/server.js.map +1 -1
- package/dist/{types-DUPC7Xn6.d.ts → types-1ylMrCuW.d.ts} +1 -1
- package/dist/{types-ByMrR_Z_.d.cts → types-Bx558PU6.d.cts} +1 -1
- package/dist/{types-CYMSBkJC.d.ts → types-Byo_Rty4.d.ts} +728 -75
- package/dist/{types-CAkWqIr6.d.cts → types-DDhtZI6E.d.cts} +728 -75
- package/dist/ui/canvas/server.cjs +231 -38
- package/dist/ui/canvas/server.cjs.map +1 -1
- package/dist/ui/canvas/server.d.cts +1 -1
- package/dist/ui/canvas/server.d.ts +1 -1
- package/dist/ui/canvas/server.js +221 -38
- package/dist/ui/canvas/server.js.map +1 -1
- package/dist/ui/canvas.cjs +320 -257
- package/dist/ui/canvas.cjs.map +1 -1
- package/dist/ui/canvas.d.cts +5 -19
- package/dist/ui/canvas.d.ts +5 -19
- package/dist/ui/canvas.js +323 -260
- package/dist/ui/canvas.js.map +1 -1
- package/dist/ui/form.d.cts +1 -1
- package/dist/ui/form.d.ts +1 -1
- package/dist/ui/video.d.cts +1 -1
- package/dist/ui/video.d.ts +1 -1
- package/dist/webhook.cjs +95 -0
- package/dist/webhook.cjs.map +1 -1
- package/dist/webhook.d.cts +20 -104
- package/dist/webhook.d.ts +20 -104
- package/dist/webhook.js +95 -0
- package/dist/webhook.js.map +1 -1
- package/package.json +4 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as PublicCollection } from './const-
|
|
2
|
-
import {
|
|
3
|
-
import { O as Order, i as Cart, j as CartItem, m as Transaction, n as Fulfillment, o as Return } from './payload-types-
|
|
1
|
+
import { P as PublicCollection, S as ServerCollection } from './const-BTvdrXtY.cjs';
|
|
2
|
+
import { C as CollectionType, P as PublicProduct } from './types-Bx558PU6.cjs';
|
|
3
|
+
import { O as Order, i as Cart, j as CartItem, m as Transaction, n as Fulfillment, o as Return } from './payload-types-C7tb7Xbs.cjs';
|
|
4
4
|
|
|
5
5
|
interface CommunityClientOptions {
|
|
6
6
|
publishableKey?: string;
|
|
@@ -10,28 +10,18 @@ interface CommunityClientOptions {
|
|
|
10
10
|
onUnauthorized?: () => Promise<string | null>;
|
|
11
11
|
onRequestId?: (id: string | null) => void;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
interface Comment {
|
|
26
|
-
id: string;
|
|
27
|
-
body: string;
|
|
28
|
-
post?: string;
|
|
29
|
-
parent?: string;
|
|
30
|
-
rootComment?: string;
|
|
31
|
-
createdAt?: string;
|
|
32
|
-
updatedAt?: string;
|
|
33
|
-
[key: string]: unknown;
|
|
34
|
-
}
|
|
13
|
+
/** Public read shape for `posts` (tenant-scoped author profiles). */
|
|
14
|
+
type CommunityPost = CollectionType<'posts'>;
|
|
15
|
+
/** Public read shape for `comments`. */
|
|
16
|
+
type CommunityComment = CollectionType<'comments'>;
|
|
17
|
+
/** @deprecated Use {@link CommunityComment}. */
|
|
18
|
+
type Comment = CommunityComment;
|
|
19
|
+
/** Public read shape for `post-categories`. */
|
|
20
|
+
type CommunityPostCategory = CollectionType<'post-categories'>;
|
|
21
|
+
/** Public read shape for `post-tags`. */
|
|
22
|
+
type CommunityPostTag = CollectionType<'post-tags'>;
|
|
23
|
+
type CommunityPostListSort = 'createdAt' | '-createdAt' | 'lastActivityAt' | '-lastActivityAt' | 'viewCount' | '-viewCount' | 'commentCount' | '-commentCount';
|
|
24
|
+
type CommunityCommentListSort = 'createdAt' | '-createdAt';
|
|
35
25
|
interface Reaction {
|
|
36
26
|
id: string;
|
|
37
27
|
post?: string;
|
|
@@ -79,6 +69,8 @@ declare class CommunityClient {
|
|
|
79
69
|
private readonly onRequestId?;
|
|
80
70
|
constructor(options: CommunityClientOptions);
|
|
81
71
|
private buildQuery;
|
|
72
|
+
private buildPostsListQuery;
|
|
73
|
+
private buildCommentsListQuery;
|
|
82
74
|
private execute;
|
|
83
75
|
createPost(params: {
|
|
84
76
|
title?: string | null;
|
|
@@ -86,6 +78,25 @@ declare class CommunityClient {
|
|
|
86
78
|
categories?: string[];
|
|
87
79
|
thumbnail?: string;
|
|
88
80
|
}): Promise<CommunityPost>;
|
|
81
|
+
/**
|
|
82
|
+
* Public post feed. Server applies the same visibility contract as
|
|
83
|
+
* `communityPostRead` (published + visible + moderation-safe).
|
|
84
|
+
*/
|
|
85
|
+
listPosts(params?: {
|
|
86
|
+
page?: number;
|
|
87
|
+
limit?: number;
|
|
88
|
+
categoryId?: string;
|
|
89
|
+
tagId?: string;
|
|
90
|
+
sort?: CommunityPostListSort;
|
|
91
|
+
}): Promise<PaginatedResponse<CommunityPost>>;
|
|
92
|
+
listPostCategories(params?: {
|
|
93
|
+
page?: number;
|
|
94
|
+
limit?: number;
|
|
95
|
+
}): Promise<PaginatedResponse<CommunityPostCategory>>;
|
|
96
|
+
listPostTags(params?: {
|
|
97
|
+
page?: number;
|
|
98
|
+
limit?: number;
|
|
99
|
+
}): Promise<PaginatedResponse<CommunityPostTag>>;
|
|
89
100
|
getMyPosts(params?: {
|
|
90
101
|
page?: number;
|
|
91
102
|
limit?: number;
|
|
@@ -94,6 +105,7 @@ declare class CommunityClient {
|
|
|
94
105
|
page?: number;
|
|
95
106
|
limit?: number;
|
|
96
107
|
period?: string;
|
|
108
|
+
metric?: 'reactions' | 'comments' | 'views' | 'activity';
|
|
97
109
|
}): Promise<PaginatedResponse<CommunityPost>>;
|
|
98
110
|
incrementView(params: {
|
|
99
111
|
postId: string;
|
|
@@ -111,17 +123,33 @@ declare class CommunityClient {
|
|
|
111
123
|
postId: string;
|
|
112
124
|
body: string;
|
|
113
125
|
parentId?: string;
|
|
114
|
-
}): Promise<
|
|
126
|
+
}): Promise<CommunityComment>;
|
|
127
|
+
/**
|
|
128
|
+
* List comments for a post.
|
|
129
|
+
*
|
|
130
|
+
* - Default: all visible comments on the post (any depth).
|
|
131
|
+
* - `topLevelOnly: true`: only root comments (`parent` unset).
|
|
132
|
+
* - `rootComment`: comments belonging to a thread rooted at that comment.
|
|
133
|
+
*/
|
|
115
134
|
listComments(params: {
|
|
116
135
|
postId: string;
|
|
117
136
|
page?: number;
|
|
118
137
|
limit?: number;
|
|
119
138
|
rootComment?: string;
|
|
120
|
-
|
|
139
|
+
topLevelOnly?: boolean;
|
|
140
|
+
sort?: CommunityCommentListSort;
|
|
141
|
+
}): Promise<PaginatedResponse<CommunityComment>>;
|
|
142
|
+
/** Direct replies to a comment (`where[parent][equals]`). */
|
|
143
|
+
listReplies(params: {
|
|
144
|
+
commentId: string;
|
|
145
|
+
page?: number;
|
|
146
|
+
limit?: number;
|
|
147
|
+
sort?: CommunityCommentListSort;
|
|
148
|
+
}): Promise<PaginatedResponse<CommunityComment>>;
|
|
121
149
|
updateComment(params: {
|
|
122
150
|
commentId: string;
|
|
123
151
|
body: string;
|
|
124
|
-
}): Promise<
|
|
152
|
+
}): Promise<CommunityComment>;
|
|
125
153
|
deleteComment(params: {
|
|
126
154
|
commentId: string;
|
|
127
155
|
}): Promise<{
|
|
@@ -136,7 +164,9 @@ declare class CommunityClient {
|
|
|
136
164
|
}>;
|
|
137
165
|
addReaction(params: {
|
|
138
166
|
postId: string;
|
|
139
|
-
|
|
167
|
+
typeSlug?: string;
|
|
168
|
+
/** @deprecated Use `typeSlug`. */
|
|
169
|
+
type?: string;
|
|
140
170
|
}): Promise<Reaction>;
|
|
141
171
|
removeReaction(params: {
|
|
142
172
|
postId: string;
|
|
@@ -146,7 +176,9 @@ declare class CommunityClient {
|
|
|
146
176
|
}>;
|
|
147
177
|
addCommentReaction(params: {
|
|
148
178
|
commentId: string;
|
|
149
|
-
|
|
179
|
+
typeSlug?: string;
|
|
180
|
+
/** @deprecated Use `typeSlug`. */
|
|
181
|
+
type?: string;
|
|
150
182
|
}): Promise<Reaction>;
|
|
151
183
|
removeCommentReaction(params: {
|
|
152
184
|
commentId: string;
|
|
@@ -157,6 +189,9 @@ declare class CommunityClient {
|
|
|
157
189
|
getReactionSummary(params: {
|
|
158
190
|
postId: string;
|
|
159
191
|
}): Promise<ReactionSummary>;
|
|
192
|
+
getCommentReactionSummary(params: {
|
|
193
|
+
commentId: string;
|
|
194
|
+
}): Promise<ReactionSummary>;
|
|
160
195
|
getReactionTypes(): Promise<PaginatedResponse<ReactionType>>;
|
|
161
196
|
addBookmark(params: {
|
|
162
197
|
postId: string;
|
|
@@ -170,6 +205,22 @@ declare class CommunityClient {
|
|
|
170
205
|
page?: number;
|
|
171
206
|
limit?: number;
|
|
172
207
|
}): Promise<PaginatedResponse<Bookmark>>;
|
|
208
|
+
listProfileLists(params?: {
|
|
209
|
+
page?: number;
|
|
210
|
+
limit?: number;
|
|
211
|
+
}): Promise<PaginatedResponse<CollectionType<'customer-profile-lists'>>>;
|
|
212
|
+
getProfileList(params: {
|
|
213
|
+
slug: string;
|
|
214
|
+
} | {
|
|
215
|
+
id: string;
|
|
216
|
+
}): Promise<CollectionType<'customer-profile-lists'> | null>;
|
|
217
|
+
updatePublicProfile(body: {
|
|
218
|
+
displayName?: string | null;
|
|
219
|
+
handle?: string | null;
|
|
220
|
+
avatar?: string | null;
|
|
221
|
+
bio?: string | null;
|
|
222
|
+
bioRichText?: CollectionType<'customer-profiles'>['bioRichText'];
|
|
223
|
+
}): Promise<CollectionType<'customer-profiles'>>;
|
|
173
224
|
}
|
|
174
225
|
|
|
175
226
|
interface ServerApiOptions {
|
|
@@ -191,6 +242,34 @@ declare abstract class BaseApi {
|
|
|
191
242
|
protected request<T>(endpoint: string, body: unknown, options?: RequestOptions): Promise<T>;
|
|
192
243
|
}
|
|
193
244
|
|
|
245
|
+
type ModerationApiOptions = ServerApiOptions;
|
|
246
|
+
interface CommunityBan {
|
|
247
|
+
id: string;
|
|
248
|
+
customer: string;
|
|
249
|
+
isPermanent?: boolean;
|
|
250
|
+
bannedUntil?: string;
|
|
251
|
+
reason?: string;
|
|
252
|
+
createdAt?: string;
|
|
253
|
+
updatedAt?: string;
|
|
254
|
+
[key: string]: unknown;
|
|
255
|
+
}
|
|
256
|
+
type BanCustomerParams = {
|
|
257
|
+
customerId: string;
|
|
258
|
+
isPermanent?: boolean;
|
|
259
|
+
bannedUntil?: string;
|
|
260
|
+
reason?: string;
|
|
261
|
+
};
|
|
262
|
+
type UnbanCustomerParams = {
|
|
263
|
+
customerId: string;
|
|
264
|
+
};
|
|
265
|
+
declare class ModerationApi extends BaseApi {
|
|
266
|
+
constructor(options: ModerationApiOptions);
|
|
267
|
+
banCustomer(params: BanCustomerParams): Promise<CommunityBan>;
|
|
268
|
+
unbanCustomer(params: UnbanCustomerParams): Promise<{
|
|
269
|
+
success: true;
|
|
270
|
+
}>;
|
|
271
|
+
}
|
|
272
|
+
|
|
194
273
|
interface CustomerAuthResponse {
|
|
195
274
|
token: string;
|
|
196
275
|
customer: CustomerProfile;
|
|
@@ -384,19 +463,81 @@ declare class CartApi {
|
|
|
384
463
|
}>;
|
|
385
464
|
}
|
|
386
465
|
|
|
466
|
+
type NormalizedOptionSwatch<TMedia = unknown> = {
|
|
467
|
+
type: 'color' | 'media' | null;
|
|
468
|
+
color?: string | null;
|
|
469
|
+
mediaItemId?: string | number | null;
|
|
470
|
+
/** Inlined swatch media when the API populated mediaItemId before pool indexing. */
|
|
471
|
+
inlineMedia?: TMedia | null;
|
|
472
|
+
};
|
|
473
|
+
declare function selectedSwatchMediaItemId(swatch: NormalizedOptionSwatch | null | undefined): string | null;
|
|
474
|
+
type ProductSelectionMediaSource = 'variant_media_selected' | 'variant_media_matching' | 'option_swatch' | 'none';
|
|
475
|
+
type ProductDisplayMediaSource = 'listing_primary' | 'product_primary' | 'product_pool' | 'none';
|
|
476
|
+
/** @deprecated Use {@link ProductSelectionMediaSource} or {@link ProductDisplayMediaSource}. */
|
|
477
|
+
type ProductMediaResolutionSource = ProductSelectionMediaSource | ProductDisplayMediaSource;
|
|
478
|
+
type ProductSelectionVariant<TMedia> = {
|
|
479
|
+
id?: string | number | null;
|
|
480
|
+
images?: Array<TMedia | string | number | null | undefined> | null;
|
|
481
|
+
};
|
|
482
|
+
type ProductSelectionOptionValue = {
|
|
483
|
+
id?: string | number | null;
|
|
484
|
+
swatch?: NormalizedOptionSwatch<unknown> | null;
|
|
485
|
+
};
|
|
486
|
+
type ProductSelectionMediaPointer = string | number | {
|
|
487
|
+
id?: string | number | null;
|
|
488
|
+
} | null;
|
|
489
|
+
type ResolveProductSelectionMediaInput<TMedia> = {
|
|
490
|
+
productMediaPool?: TMedia[] | null;
|
|
491
|
+
productPrimaryMediaItemId?: ProductSelectionMediaPointer;
|
|
492
|
+
selectedVariant?: ProductSelectionVariant<TMedia> | null;
|
|
493
|
+
matchingVariants?: Array<ProductSelectionVariant<TMedia> | null | undefined> | null;
|
|
494
|
+
selectedOptionValues?: Array<ProductSelectionOptionValue | null | undefined> | null;
|
|
495
|
+
};
|
|
496
|
+
type ResolveProductSelectionMediaResult<TMedia> = {
|
|
497
|
+
primaryImage: TMedia | null;
|
|
498
|
+
images: TMedia[];
|
|
499
|
+
source: ProductSelectionMediaSource;
|
|
500
|
+
};
|
|
501
|
+
type ResolveProductDisplayMediaInput<TMedia> = {
|
|
502
|
+
productMediaPool?: TMedia[] | null;
|
|
503
|
+
productPrimaryMediaItemId?: ProductSelectionMediaPointer;
|
|
504
|
+
listingPrimaryImage?: ProductSelectionMediaPointer;
|
|
505
|
+
};
|
|
506
|
+
type ResolveProductDisplayMediaResult<TMedia> = {
|
|
507
|
+
primaryImage: TMedia | null;
|
|
508
|
+
images: TMedia[];
|
|
509
|
+
source: ProductDisplayMediaSource;
|
|
510
|
+
};
|
|
511
|
+
declare function resolveProductSelectionMedia<TMedia>(input: ResolveProductSelectionMediaInput<TMedia>): ResolveProductSelectionMediaResult<TMedia>;
|
|
512
|
+
declare function resolveProductDisplayMedia<TMedia>(input: ResolveProductDisplayMediaInput<TMedia>): ResolveProductDisplayMediaResult<TMedia>;
|
|
513
|
+
type ListingPrimaryImageFallbackInput<TMedia> = {
|
|
514
|
+
productMediaPool?: TMedia[] | null;
|
|
515
|
+
productPrimaryMediaItemId?: ProductSelectionMediaPointer;
|
|
516
|
+
productThumbnail?: TMedia | string | number | null;
|
|
517
|
+
listingPrimaryImage?: TMedia | string | number | null;
|
|
518
|
+
resolvedPrimary?: TMedia | null;
|
|
519
|
+
resolvedSource?: ProductMediaResolutionSource;
|
|
520
|
+
};
|
|
521
|
+
declare function resolveListingPrimaryImagePointer<TMedia>(input: ListingPrimaryImageFallbackInput<TMedia>): string | null;
|
|
522
|
+
|
|
387
523
|
type EntityID = string;
|
|
388
524
|
type RelationshipValue = string | number | null | undefined | {
|
|
389
525
|
id?: string | number | null;
|
|
390
526
|
};
|
|
391
527
|
type MediaValue = ProductDetailMedia | null | undefined;
|
|
528
|
+
|
|
529
|
+
/** Raw Payload / REST swatch before strict public normalization. */
|
|
530
|
+
type ProductOptionValueSwatchInput = {
|
|
531
|
+
type?: 'color' | 'media' | null;
|
|
532
|
+
color?: string | null;
|
|
533
|
+
mediaItemId?: RelationshipValue;
|
|
534
|
+
};
|
|
392
535
|
interface ProductOptionValueShape {
|
|
393
536
|
id?: string | number | null;
|
|
394
537
|
option?: RelationshipValue;
|
|
395
538
|
value?: string | null;
|
|
396
539
|
slug?: string | null;
|
|
397
|
-
|
|
398
|
-
thumbnail?: MediaValue;
|
|
399
|
-
images?: MediaValue[] | null;
|
|
540
|
+
swatch?: ProductOptionValueSwatch | ProductOptionValueSwatchInput | null;
|
|
400
541
|
_order?: string | null;
|
|
401
542
|
'_product-option-values_values_order'?: string | null;
|
|
402
543
|
}
|
|
@@ -426,7 +567,11 @@ interface ProductVariantShape {
|
|
|
426
567
|
interface ProductListingProductShape {
|
|
427
568
|
id?: EntityID;
|
|
428
569
|
thumbnail?: MediaValue;
|
|
570
|
+
primaryMediaItemId?: MediaValue;
|
|
429
571
|
images?: MediaValue[] | null;
|
|
572
|
+
listing?: {
|
|
573
|
+
primaryImage?: MediaValue;
|
|
574
|
+
} | null;
|
|
430
575
|
}
|
|
431
576
|
type ProductOptionMatrixValue = {
|
|
432
577
|
id: string;
|
|
@@ -434,9 +579,7 @@ type ProductOptionMatrixValue = {
|
|
|
434
579
|
optionSlug: string;
|
|
435
580
|
label: string;
|
|
436
581
|
slug: string | null;
|
|
437
|
-
|
|
438
|
-
thumbnail?: MediaValue;
|
|
439
|
-
images?: MediaValue[] | null;
|
|
582
|
+
swatch: ProductOptionValueSwatch;
|
|
440
583
|
order: string;
|
|
441
584
|
};
|
|
442
585
|
type ProductOptionMatrixOption = {
|
|
@@ -477,12 +620,11 @@ type ProductListingProjection = {
|
|
|
477
620
|
type ProductListingGroup<TVariant extends ProductVariantShape = ProductVariantShape> = {
|
|
478
621
|
optionId: EntityID;
|
|
479
622
|
optionTitle: string;
|
|
623
|
+
optionSlug: string;
|
|
480
624
|
optionValueId: EntityID;
|
|
481
625
|
optionValueLabel: string;
|
|
482
626
|
optionValueSlug: string | null;
|
|
483
|
-
|
|
484
|
-
optionValueThumbnail?: MediaValue;
|
|
485
|
-
optionValueImages?: MediaValue[] | null;
|
|
627
|
+
optionValueSwatch: ProductOptionValueSwatch;
|
|
486
628
|
variantIds: EntityID[];
|
|
487
629
|
variantCount: number;
|
|
488
630
|
variants: TVariant[];
|
|
@@ -499,15 +641,16 @@ type ProductListingSwatch = {
|
|
|
499
641
|
optionId: EntityID;
|
|
500
642
|
optionValueId: EntityID;
|
|
501
643
|
label: string;
|
|
502
|
-
|
|
503
|
-
thumbnail: ProductDetailMedia | null;
|
|
644
|
+
swatch: ProductOptionValueSwatch<ProductDetailMedia>;
|
|
504
645
|
href: string;
|
|
505
646
|
availableForSale: boolean;
|
|
506
647
|
};
|
|
648
|
+
type ProductListingCardRepresentativeVariant = ProductListingGroupsItem['groups'][number]['variants'][number];
|
|
507
649
|
type ProductListingCard = {
|
|
508
650
|
id: EntityID;
|
|
509
651
|
href: string;
|
|
510
652
|
title: string;
|
|
653
|
+
representativeVariant?: ProductListingCardRepresentativeVariant | null;
|
|
511
654
|
primaryImage: ProductDetailMedia | null;
|
|
512
655
|
priceRange: ProductListingCardPriceRange;
|
|
513
656
|
availableForSale: boolean;
|
|
@@ -537,27 +680,39 @@ type CompatibilityProductSelectionParamEvent = {
|
|
|
537
680
|
searchParam: string;
|
|
538
681
|
};
|
|
539
682
|
type LegacyProductSelectionParamEvent = CompatibilityProductSelectionParamEvent;
|
|
683
|
+
type ProductSelectionUrlEmit = 'slug-compat' | 'canonical-id';
|
|
540
684
|
type ProductSelectionCodecOptions = {
|
|
685
|
+
emit?: ProductSelectionUrlEmit;
|
|
686
|
+
/**
|
|
687
|
+
* When true, `resolveProductSelection()` fills unselected options to reach a
|
|
688
|
+
* concrete variant. Does not change codec parse/stringify behavior.
|
|
689
|
+
*/
|
|
690
|
+
fillDefaults?: boolean;
|
|
541
691
|
onCompatibilityOptionIdParam?: (event: CompatibilityProductSelectionParamEvent) => void;
|
|
542
692
|
onLegacyOptionIdParam?: (event: LegacyProductSelectionParamEvent) => void;
|
|
543
693
|
};
|
|
544
694
|
type ProductSelectionResolutionContext = {
|
|
545
|
-
detail?: Pick<ProductDetail, 'images' | 'listing'>;
|
|
695
|
+
detail?: Pick<ProductDetail, 'images' | 'listing' | 'primaryMediaItemId'>;
|
|
546
696
|
images?: ProductDetail['images'];
|
|
547
697
|
listing?: ProductDetail['listing'];
|
|
698
|
+
primaryMediaItemId?: ProductDetail['primaryMediaItemId'];
|
|
699
|
+
};
|
|
700
|
+
type ProductSelectionAvailableSwatch = {
|
|
701
|
+
color?: string | null;
|
|
702
|
+
image?: MediaValue | null;
|
|
548
703
|
};
|
|
549
704
|
type ProductSelectionAvailableValue = {
|
|
550
705
|
valueId: string;
|
|
551
706
|
value: string;
|
|
707
|
+
label: string;
|
|
552
708
|
slug: string;
|
|
553
709
|
selected: boolean;
|
|
554
710
|
available: boolean;
|
|
711
|
+
exists: boolean;
|
|
555
712
|
availableForSale: boolean;
|
|
556
713
|
isUnlimited: boolean;
|
|
557
714
|
availableStock: number | null;
|
|
558
|
-
|
|
559
|
-
thumbnail?: MediaValue;
|
|
560
|
-
images?: MediaValue[] | null;
|
|
715
|
+
swatch: ProductOptionValueSwatch;
|
|
561
716
|
};
|
|
562
717
|
type ProductSelectionResolution = {
|
|
563
718
|
normalizedSelection: NormalizedProductSelection;
|
|
@@ -577,6 +732,7 @@ type ProductSelectionResolution = {
|
|
|
577
732
|
media: {
|
|
578
733
|
primaryImage: ProductDetailMedia | null;
|
|
579
734
|
images: ProductDetailMedia[];
|
|
735
|
+
source?: ProductMediaResolutionSource;
|
|
580
736
|
};
|
|
581
737
|
stock: {
|
|
582
738
|
availableForSale: boolean;
|
|
@@ -609,6 +765,7 @@ declare function createProductSelectionCodec(detail: ProductDetail, options?: Pr
|
|
|
609
765
|
};
|
|
610
766
|
declare function resolveProductSelectionFromMatrix(matrix: ProductOptionMatrix<ProductDetailVariant>, selection?: ProductSelectionInput, options?: ProductSelectionCodecOptions, context?: ProductSelectionResolutionContext): ProductSelectionResolution;
|
|
611
767
|
declare function resolveProductSelection(detail: ProductDetail, selection?: ProductSelectionInput, options?: ProductSelectionCodecOptions): ProductSelectionResolution;
|
|
768
|
+
declare function selectNext(detail: ProductDetail, current: ProductSelectionInput | undefined, optionSlug: string, valueSlug: string, options?: ProductSelectionCodecOptions): NormalizedProductSelection;
|
|
612
769
|
type ProductDetailImageMedia = Extract<ProductDetailMedia, {
|
|
613
770
|
id?: string | number | null;
|
|
614
771
|
url?: string | null;
|
|
@@ -636,13 +793,18 @@ type ProductHrefOptions = {
|
|
|
636
793
|
matrix?: ProductOptionMatrix<ProductDetailVariant>;
|
|
637
794
|
selection?: ProductSelectionInput;
|
|
638
795
|
trailingSlash?: boolean;
|
|
796
|
+
emit?: ProductSelectionUrlEmit;
|
|
797
|
+
preferCompleteVariantFromHint?: boolean;
|
|
639
798
|
};
|
|
640
|
-
|
|
641
|
-
declare function buildProductListingProjection(product: ProductListingProductShape | null | undefined, variants: ProductVariantShape[]): ProductListingProjection;
|
|
642
|
-
declare function buildProductListingCard(item: ProductListingGroupsItem, options?: {
|
|
799
|
+
type ProductListingCardOptions = {
|
|
643
800
|
basePath?: string;
|
|
644
801
|
trailingSlash?: boolean;
|
|
645
|
-
|
|
802
|
+
emit?: ProductSelectionUrlEmit;
|
|
803
|
+
preferCompleteVariantFromHint?: boolean;
|
|
804
|
+
};
|
|
805
|
+
declare function buildProductHref(product: ProductHrefProduct, group?: ProductHrefGroup | null, options?: ProductHrefOptions): string;
|
|
806
|
+
declare function buildProductListingProjection(product: ProductListingProductShape | null | undefined, variants: ProductVariantShape[]): ProductListingProjection;
|
|
807
|
+
declare function buildProductListingCard(item: ProductListingGroupsItem, options?: ProductListingCardOptions): ProductListingCard;
|
|
646
808
|
/**
|
|
647
809
|
* Builds product-first listing groups for one primary option.
|
|
648
810
|
*
|
|
@@ -681,13 +843,18 @@ type ListingGroupsParams = {
|
|
|
681
843
|
productIds: string[];
|
|
682
844
|
};
|
|
683
845
|
type ListingGroupingState = 'grouped' | 'no_primary_option' | 'empty';
|
|
846
|
+
type ListingGroupingEmptyReason = 'primary_option_not_linked' | 'primary_option_has_no_values' | 'no_variants_for_primary_option';
|
|
684
847
|
type ProductListingGroupVariant = Pick<ProductVariantShape, 'id' | 'optionValues' | 'price' | 'compareAtPrice' | 'stock' | 'isUnlimited' | 'isActive' | 'thumbnail' | 'images' | '_order'>;
|
|
685
848
|
type ProductListingGroupSummary = ProductListingGroup<ProductListingGroupVariant>;
|
|
686
849
|
type ProductListingGroupsProductVariants = NonNullable<PublicProduct['variants']>;
|
|
850
|
+
type ProductListingGroupsProductPrimaryMediaItemId = string | number | {
|
|
851
|
+
id?: string | number | null;
|
|
852
|
+
} | null;
|
|
687
853
|
type ProductListingGroupsProduct = Omit<PublicProduct, 'variants'> & {
|
|
688
854
|
id: string;
|
|
689
855
|
slug: string;
|
|
690
856
|
title: string;
|
|
857
|
+
primaryMediaItemId?: ProductListingGroupsProductPrimaryMediaItemId;
|
|
691
858
|
variants?: (Omit<ProductListingGroupsProductVariants, 'docs'> & {
|
|
692
859
|
docs: ProductListingGroupVariant[];
|
|
693
860
|
}) | null;
|
|
@@ -696,6 +863,8 @@ type ProductListingGroupsItem = {
|
|
|
696
863
|
product: ProductListingGroupsProduct;
|
|
697
864
|
primaryOptionId: string | null;
|
|
698
865
|
listingGroupingState: ListingGroupingState;
|
|
866
|
+
/** Present only when `listingGroupingState` is `empty`. */
|
|
867
|
+
listingGroupingEmptyReason: ListingGroupingEmptyReason | null;
|
|
699
868
|
groups: ProductListingGroupSummary[];
|
|
700
869
|
};
|
|
701
870
|
type ProductListingGroupsResponse = {
|
|
@@ -733,6 +902,20 @@ type ProductDetailMedia = string | number | {
|
|
|
733
902
|
width?: number | null;
|
|
734
903
|
height?: number | null;
|
|
735
904
|
};
|
|
905
|
+
type ProductOptionValueColorSwatch = {
|
|
906
|
+
type: 'color';
|
|
907
|
+
color: string;
|
|
908
|
+
mediaItemId?: null;
|
|
909
|
+
};
|
|
910
|
+
type ProductOptionValueMediaSwatch<TMedia = ProductDetailMedia> = {
|
|
911
|
+
type: 'media';
|
|
912
|
+
mediaItemId: TMedia;
|
|
913
|
+
color?: null;
|
|
914
|
+
};
|
|
915
|
+
type ProductOptionValueSwatch<TMedia = ProductDetailMedia> = ProductOptionValueColorSwatch | ProductOptionValueMediaSwatch<TMedia> | null;
|
|
916
|
+
type ProductUpsertSwatchInput = ProductOptionValueColorSwatch | ProductOptionValueMediaSwatch<string>;
|
|
917
|
+
type ProductDetailMediaValue = string | number | ProductDetailMedia | null;
|
|
918
|
+
type ProductDetailSelectionMediaSource = 'variant_media_selected' | 'variant_media_matching' | 'option_swatch' | 'none';
|
|
736
919
|
interface ProductDetailVariant {
|
|
737
920
|
id: string | number;
|
|
738
921
|
optionKey: string;
|
|
@@ -747,15 +930,18 @@ interface ProductDetailVariant {
|
|
|
747
930
|
isActive: boolean;
|
|
748
931
|
thumbnail?: ProductDetailMedia | null;
|
|
749
932
|
images?: ProductDetailMedia[];
|
|
933
|
+
media?: {
|
|
934
|
+
primaryImage: ProductDetailMedia | null;
|
|
935
|
+
images: ProductDetailMedia[];
|
|
936
|
+
source: ProductDetailSelectionMediaSource;
|
|
937
|
+
};
|
|
750
938
|
optionValues: ProductDetailVariantOptionValue[];
|
|
751
939
|
}
|
|
752
940
|
interface ProductDetailOptionValue {
|
|
753
941
|
id: string | number;
|
|
754
942
|
value: string;
|
|
755
943
|
slug: string;
|
|
756
|
-
|
|
757
|
-
thumbnail?: ProductDetailMedia | null;
|
|
758
|
-
images?: ProductDetailMedia[] | null;
|
|
944
|
+
swatch?: ProductOptionValueSwatch<ProductDetailMedia>;
|
|
759
945
|
}
|
|
760
946
|
interface ProductDetailOption {
|
|
761
947
|
id: string | number;
|
|
@@ -800,6 +986,36 @@ interface ProductDetailListing {
|
|
|
800
986
|
availableForSale?: boolean | null;
|
|
801
987
|
selectionHintVariant?: string | number | null;
|
|
802
988
|
}
|
|
989
|
+
type ProductDetailCatalogVariant = Omit<ProductDetailVariant, 'stock' | 'reservedStock'>;
|
|
990
|
+
type ProductDetailCatalogListing = Omit<ProductDetailListing, 'availableForSale'> & {
|
|
991
|
+
liveStockRequired: true;
|
|
992
|
+
};
|
|
993
|
+
interface ProductDetailCatalog {
|
|
994
|
+
product: Omit<ProductDetail['product'], 'totalInventory'>;
|
|
995
|
+
variants: ProductDetailCatalogVariant[];
|
|
996
|
+
options: ProductDetail['options'];
|
|
997
|
+
brand: ProductDetail['brand'];
|
|
998
|
+
categories: ProductDetail['categories'];
|
|
999
|
+
tags: ProductDetail['tags'];
|
|
1000
|
+
images: ProductDetail['images'];
|
|
1001
|
+
videos: ProductDetail['videos'];
|
|
1002
|
+
primaryMediaItemId?: ProductDetail['primaryMediaItemId'];
|
|
1003
|
+
listing: ProductDetailCatalogListing;
|
|
1004
|
+
}
|
|
1005
|
+
type StockSnapshotItemStatus = 'available' | 'not_published' | 'archived' | 'not_found';
|
|
1006
|
+
interface StockSnapshotItem {
|
|
1007
|
+
variantId: string;
|
|
1008
|
+
status: StockSnapshotItemStatus;
|
|
1009
|
+
availableStock: number;
|
|
1010
|
+
availableForSale: boolean;
|
|
1011
|
+
isUnlimited: boolean;
|
|
1012
|
+
}
|
|
1013
|
+
interface StockSnapshotResponse {
|
|
1014
|
+
snapshots: StockSnapshotItem[];
|
|
1015
|
+
}
|
|
1016
|
+
type StockSnapshotParams = {
|
|
1017
|
+
variantIds: string[];
|
|
1018
|
+
};
|
|
803
1019
|
interface ProductDetail {
|
|
804
1020
|
product: {
|
|
805
1021
|
id: string | number;
|
|
@@ -810,8 +1026,9 @@ interface ProductDetail {
|
|
|
810
1026
|
content?: unknown;
|
|
811
1027
|
publishedAt?: string | null;
|
|
812
1028
|
status: string;
|
|
813
|
-
totalInventory: number;
|
|
1029
|
+
totalInventory: number | null;
|
|
814
1030
|
totalVariants: number;
|
|
1031
|
+
hasUnlimitedVariant: boolean;
|
|
815
1032
|
hasOnlyDefaultVariant: boolean;
|
|
816
1033
|
};
|
|
817
1034
|
variants: ProductDetailVariant[];
|
|
@@ -821,15 +1038,30 @@ interface ProductDetail {
|
|
|
821
1038
|
tags: ProductDetailTag[];
|
|
822
1039
|
images: ProductDetailImage[];
|
|
823
1040
|
videos: ProductDetailVideo[];
|
|
1041
|
+
/** Canonical product primary pointer (pool member). */
|
|
1042
|
+
primaryMediaItemId?: ProductDetailMediaValue;
|
|
824
1043
|
listing: ProductDetailListing;
|
|
825
1044
|
}
|
|
1045
|
+
type ProductDetailUnavailableReason = 'not_found' | 'not_published' | 'feature_disabled';
|
|
1046
|
+
type ProductDetailResult = {
|
|
1047
|
+
found: true;
|
|
1048
|
+
product: ProductDetail;
|
|
1049
|
+
} | {
|
|
1050
|
+
found: false;
|
|
1051
|
+
reason: ProductDetailUnavailableReason;
|
|
1052
|
+
};
|
|
1053
|
+
type ProductDetailCatalogResult = {
|
|
1054
|
+
found: true;
|
|
1055
|
+
product: ProductDetailCatalog;
|
|
1056
|
+
} | {
|
|
1057
|
+
found: false;
|
|
1058
|
+
reason: ProductDetailUnavailableReason;
|
|
1059
|
+
};
|
|
826
1060
|
type ProductUpsertOptionValueInput = {
|
|
827
1061
|
id?: string;
|
|
828
1062
|
value: string;
|
|
829
1063
|
slug?: string;
|
|
830
|
-
|
|
831
|
-
thumbnail?: string | null;
|
|
832
|
-
images?: string[];
|
|
1064
|
+
swatch?: ProductUpsertSwatchInput | null;
|
|
833
1065
|
metadata?: unknown;
|
|
834
1066
|
};
|
|
835
1067
|
type ProductUpsertOptionInput = {
|
|
@@ -857,7 +1089,6 @@ type ProductUpsertVariantInput = {
|
|
|
857
1089
|
barcode?: string | null;
|
|
858
1090
|
externalId?: string | null;
|
|
859
1091
|
isActive?: boolean;
|
|
860
|
-
thumbnail?: string | null;
|
|
861
1092
|
images?: string[];
|
|
862
1093
|
metadata?: unknown;
|
|
863
1094
|
};
|
|
@@ -869,9 +1100,22 @@ type ProductUpsertParams = {
|
|
|
869
1100
|
options?: ProductUpsertOptionInput[];
|
|
870
1101
|
variants?: ProductUpsertVariantInput[];
|
|
871
1102
|
};
|
|
1103
|
+
/** Console `POST /api/products/upsert` field allowlist error reasons. */
|
|
1104
|
+
declare const PRODUCT_UPSERT_UNKNOWN_FIELD_REASON: "unknown_field";
|
|
1105
|
+
declare const PRODUCT_UPSERT_READONLY_FIELD_REASON: "product_field_readonly";
|
|
1106
|
+
type ProductUpsertFieldValidationErrorReason = typeof PRODUCT_UPSERT_UNKNOWN_FIELD_REASON | typeof PRODUCT_UPSERT_READONLY_FIELD_REASON;
|
|
1107
|
+
/** 400 response body when upsert rejects unknown or server-managed product fields. */
|
|
1108
|
+
type ProductUpsertFieldValidationErrorBody = {
|
|
1109
|
+
error: string;
|
|
1110
|
+
reason: ProductUpsertFieldValidationErrorReason;
|
|
1111
|
+
field: string;
|
|
1112
|
+
requestId?: string;
|
|
1113
|
+
};
|
|
1114
|
+
declare function isProductUpsertFieldValidationErrorBody(value: unknown): value is ProductUpsertFieldValidationErrorBody;
|
|
872
1115
|
type ProductUpsertResponse = {
|
|
873
1116
|
ok: true;
|
|
874
1117
|
product: PublicProduct;
|
|
1118
|
+
listingProjectionStale: boolean;
|
|
875
1119
|
} | {
|
|
876
1120
|
ok: false;
|
|
877
1121
|
failedEntity: 'product' | 'option' | 'option-value' | 'variant';
|
|
@@ -886,14 +1130,21 @@ declare class ProductApi extends BaseApi {
|
|
|
886
1130
|
* to remain available by the time an order is placed.
|
|
887
1131
|
*/
|
|
888
1132
|
stockCheck(params: StockCheckParams): Promise<StockCheckResponse>;
|
|
1133
|
+
stockSnapshot(params: StockSnapshotParams): Promise<StockSnapshotResponse>;
|
|
889
1134
|
listingGroups(params: ListingGroupsParams): Promise<ProductListingGroupsResponse>;
|
|
1135
|
+
listingGroupsCatalog(params: ListingGroupsParams): Promise<ProductListingGroupsResponse>;
|
|
890
1136
|
/**
|
|
891
1137
|
* Fetch full product detail by slug or id.
|
|
892
|
-
* Returns
|
|
893
|
-
*
|
|
894
|
-
*
|
|
1138
|
+
* Returns a discriminated result so storefronts can distinguish missing,
|
|
1139
|
+
* unpublished, and feature-disabled products.
|
|
1140
|
+
*
|
|
1141
|
+
* Only product-detail 404 responses carrying one of those allowlisted reasons
|
|
1142
|
+
* are mapped to `{ found: false, reason }`. Unknown or uncoded 404s, plus
|
|
1143
|
+
* permission/auth errors such as tenant mismatch, continue to throw typed SDK
|
|
1144
|
+
* errors instead of being collapsed into a storefront absence result.
|
|
895
1145
|
*/
|
|
896
|
-
detail(params: ProductDetailParams): Promise<
|
|
1146
|
+
detail(params: ProductDetailParams): Promise<ProductDetailResult>;
|
|
1147
|
+
detailCatalog(params: ProductDetailParams): Promise<ProductDetailCatalogResult>;
|
|
897
1148
|
/**
|
|
898
1149
|
* Atomically create or update a product together with its options,
|
|
899
1150
|
* option-values, and variants in a single transaction. Mirrors Shopify's
|
|
@@ -942,6 +1193,14 @@ declare class ShippingApi extends BaseApi {
|
|
|
942
1193
|
}
|
|
943
1194
|
|
|
944
1195
|
type OrderApiOptions = ServerApiOptions;
|
|
1196
|
+
/** Header-only; never sent in the JSON body. */
|
|
1197
|
+
type WithIdempotencyKey<T> = T & {
|
|
1198
|
+
/**
|
|
1199
|
+
* Client-generated key for safe retries. Sent as `X-Idempotency-Key` when the
|
|
1200
|
+
* server endpoint supports HTTP idempotency.
|
|
1201
|
+
*/
|
|
1202
|
+
idempotencyKey?: string;
|
|
1203
|
+
};
|
|
945
1204
|
type CustomerSnapshot = {
|
|
946
1205
|
name?: string;
|
|
947
1206
|
email: string;
|
|
@@ -969,7 +1228,7 @@ type CreateOrderItem = {
|
|
|
969
1228
|
*/
|
|
970
1229
|
totalPrice?: number;
|
|
971
1230
|
};
|
|
972
|
-
type CreateOrderParams = {
|
|
1231
|
+
type CreateOrderParams = WithIdempotencyKey<{
|
|
973
1232
|
orderNumber: string;
|
|
974
1233
|
customer?: string;
|
|
975
1234
|
customerSnapshot: CustomerSnapshot;
|
|
@@ -979,7 +1238,7 @@ type CreateOrderParams = {
|
|
|
979
1238
|
shippingAmount?: number;
|
|
980
1239
|
pgPaymentId?: string;
|
|
981
1240
|
discountCode?: string;
|
|
982
|
-
}
|
|
1241
|
+
}>;
|
|
983
1242
|
type UpdateOrderParams = {
|
|
984
1243
|
orderNumber: string;
|
|
985
1244
|
status: Order['status'];
|
|
@@ -993,7 +1252,7 @@ type UpdateTransactionParams = {
|
|
|
993
1252
|
paymentKey?: string;
|
|
994
1253
|
amount?: number;
|
|
995
1254
|
};
|
|
996
|
-
type ConfirmPaymentParams = {
|
|
1255
|
+
type ConfirmPaymentParams = WithIdempotencyKey<{
|
|
997
1256
|
orderNumber?: string;
|
|
998
1257
|
pgPaymentId: string;
|
|
999
1258
|
pgProvider: string;
|
|
@@ -1004,40 +1263,84 @@ type ConfirmPaymentParams = {
|
|
|
1004
1263
|
receiptUrl?: string;
|
|
1005
1264
|
approvedAt?: string;
|
|
1006
1265
|
providerStatus?: string;
|
|
1266
|
+
/** Provider event id; also used as idempotency key when `idempotencyKey` is omitted. */
|
|
1007
1267
|
providerEventId?: string;
|
|
1008
1268
|
confirmationSource?: 'provider_webhook' | 'provider_lookup' | 'provider_api_confirm' | 'manual_server';
|
|
1009
1269
|
metadata?: Record<string, unknown>;
|
|
1010
|
-
}
|
|
1270
|
+
}>;
|
|
1011
1271
|
type ConfirmPaymentResponse = {
|
|
1012
1272
|
orderId: string;
|
|
1013
1273
|
transactionId: string;
|
|
1014
1274
|
status: 'paid';
|
|
1015
1275
|
alreadyConfirmed?: boolean;
|
|
1016
1276
|
};
|
|
1277
|
+
type CancelReasonCode = 'customer' | 'inventory' | 'fraud' | 'declined' | 'staff' | 'other';
|
|
1278
|
+
type CancelOrderStatus = 'pending' | 'paid' | 'failed' | 'canceled' | 'refunded' | 'preparing' | 'shipped' | 'delivered' | 'confirmed' | 'return_requested' | 'return_processing' | 'returned';
|
|
1279
|
+
type CancelOrderReconciliationStatus = Exclude<CancelOrderStatus, 'pending' | 'failed' | 'canceled'>;
|
|
1280
|
+
type CancelOrderResponseBase = {
|
|
1281
|
+
orderId: string;
|
|
1282
|
+
};
|
|
1283
|
+
type CancelOrderUnpaidResponseFields = {
|
|
1284
|
+
refundedAmount: 0;
|
|
1285
|
+
providerRefunded: false;
|
|
1286
|
+
};
|
|
1287
|
+
type CancelOrderAlreadyCanceledResponseFields = {
|
|
1288
|
+
refundedAmount: number;
|
|
1289
|
+
providerRefunded: false;
|
|
1290
|
+
};
|
|
1291
|
+
type CancelOrderProviderRefundResponseFields = {
|
|
1292
|
+
transactionId: string;
|
|
1293
|
+
refundedAmount: number;
|
|
1294
|
+
refundSeq: number;
|
|
1295
|
+
providerRefunded: true;
|
|
1296
|
+
};
|
|
1297
|
+
type CancelOrderCommittedResponse = CancelOrderResponseBase & (CancelOrderUnpaidResponseFields | CancelOrderProviderRefundResponseFields) & {
|
|
1298
|
+
status: 'canceled';
|
|
1299
|
+
cancelCommitted: true;
|
|
1300
|
+
};
|
|
1301
|
+
type CancelOrderAlreadyCanceledResponse = CancelOrderResponseBase & CancelOrderAlreadyCanceledResponseFields & {
|
|
1302
|
+
status: 'canceled';
|
|
1303
|
+
cancelCommitted: false;
|
|
1304
|
+
alreadyCanceled: true;
|
|
1305
|
+
};
|
|
1306
|
+
type CancelOrderReconciliationResponse = CancelOrderResponseBase & CancelOrderProviderRefundResponseFields & {
|
|
1307
|
+
status: CancelOrderReconciliationStatus;
|
|
1308
|
+
cancelCommitted: false;
|
|
1309
|
+
reconciliationRequired: true;
|
|
1310
|
+
};
|
|
1311
|
+
type CancelOrderResponse = CancelOrderCommittedResponse | CancelOrderAlreadyCanceledResponse | CancelOrderReconciliationResponse;
|
|
1312
|
+
type CancelOrderParams = {
|
|
1313
|
+
orderNumber: string;
|
|
1314
|
+
reasonCode?: CancelReasonCode;
|
|
1315
|
+
reasonDetail?: string;
|
|
1316
|
+
idempotencyKey?: string;
|
|
1317
|
+
};
|
|
1017
1318
|
type RestockAction = 'return_to_stock' | 'discard';
|
|
1018
1319
|
type ReturnWithRefundItem = {
|
|
1019
1320
|
orderItem: string | number;
|
|
1020
1321
|
quantity: number;
|
|
1021
1322
|
restockAction?: RestockAction;
|
|
1323
|
+
restockingFee?: number;
|
|
1022
1324
|
};
|
|
1023
|
-
type ReturnWithRefundParams = {
|
|
1325
|
+
type ReturnWithRefundParams = WithIdempotencyKey<{
|
|
1024
1326
|
orderNumber: string;
|
|
1025
1327
|
reason?: ReturnReason;
|
|
1026
1328
|
reasonDetail?: string;
|
|
1027
1329
|
returnItems: ReturnWithRefundItem[];
|
|
1028
1330
|
refundAmount: number;
|
|
1331
|
+
returnShippingFee?: number;
|
|
1029
1332
|
pgPaymentId: string;
|
|
1030
1333
|
paymentKey?: string;
|
|
1031
1334
|
refundReceiptUrl?: string;
|
|
1032
|
-
}
|
|
1033
|
-
type CheckoutParams = {
|
|
1335
|
+
}>;
|
|
1336
|
+
type CheckoutParams = WithIdempotencyKey<{
|
|
1034
1337
|
cartId: string;
|
|
1035
1338
|
orderNumber: string;
|
|
1036
1339
|
customerSnapshot: CustomerSnapshot;
|
|
1037
1340
|
pgPaymentId?: string;
|
|
1038
1341
|
discountCode?: string;
|
|
1039
|
-
}
|
|
1040
|
-
type CreateFulfillmentParams = {
|
|
1342
|
+
}>;
|
|
1343
|
+
type CreateFulfillmentParams = WithIdempotencyKey<{
|
|
1041
1344
|
orderNumber: string;
|
|
1042
1345
|
carrier?: string;
|
|
1043
1346
|
trackingNumber?: string;
|
|
@@ -1045,7 +1348,7 @@ type CreateFulfillmentParams = {
|
|
|
1045
1348
|
orderItem: string;
|
|
1046
1349
|
quantity: number;
|
|
1047
1350
|
}>;
|
|
1048
|
-
}
|
|
1351
|
+
}>;
|
|
1049
1352
|
type UpdateFulfillmentParams = {
|
|
1050
1353
|
fulfillmentId: string;
|
|
1051
1354
|
status: 'packed' | 'shipped' | 'delivered' | 'failed';
|
|
@@ -1069,13 +1372,13 @@ type BulkImportFulfillmentsResponse = {
|
|
|
1069
1372
|
error: string;
|
|
1070
1373
|
}>;
|
|
1071
1374
|
};
|
|
1072
|
-
type CreateReturnParams = {
|
|
1375
|
+
type CreateReturnParams = WithIdempotencyKey<{
|
|
1073
1376
|
orderNumber: string;
|
|
1074
1377
|
reason?: ReturnReason;
|
|
1075
1378
|
reasonDetail?: string;
|
|
1076
1379
|
returnItems: ReturnItem[];
|
|
1077
1380
|
refundAmount: number;
|
|
1078
|
-
}
|
|
1381
|
+
}>;
|
|
1079
1382
|
type UpdateReturnParams = {
|
|
1080
1383
|
returnId: string;
|
|
1081
1384
|
status: 'processing' | 'approved' | 'rejected' | 'completed';
|
|
@@ -1086,6 +1389,7 @@ declare class OrderApi extends BaseApi {
|
|
|
1086
1389
|
updateOrder(params: UpdateOrderParams): Promise<Order>;
|
|
1087
1390
|
updateTransaction(params: UpdateTransactionParams): Promise<Transaction>;
|
|
1088
1391
|
confirmPayment(params: ConfirmPaymentParams): Promise<ConfirmPaymentResponse>;
|
|
1392
|
+
cancelOrder(params: CancelOrderParams): Promise<CancelOrderResponse>;
|
|
1089
1393
|
checkout(params: CheckoutParams): Promise<Order>;
|
|
1090
1394
|
createFulfillment(params: CreateFulfillmentParams): Promise<Fulfillment>;
|
|
1091
1395
|
updateFulfillment(params: UpdateFulfillmentParams): Promise<Fulfillment>;
|
|
@@ -1109,8 +1413,11 @@ interface CommerceClientOptions {
|
|
|
1109
1413
|
declare class CommerceClient {
|
|
1110
1414
|
readonly product: {
|
|
1111
1415
|
stockCheck: (params: StockCheckParams) => Promise<StockCheckResponse>;
|
|
1416
|
+
stockSnapshot: (params: StockSnapshotParams) => Promise<StockSnapshotResponse>;
|
|
1112
1417
|
listingGroups: (params: ListingGroupsParams) => Promise<ProductListingGroupsResponse>;
|
|
1113
|
-
|
|
1418
|
+
listingGroupsCatalog: (params: ListingGroupsParams) => Promise<ProductListingGroupsResponse>;
|
|
1419
|
+
detail: (params: ProductDetailParams) => Promise<ProductDetailResult>;
|
|
1420
|
+
detailCatalog: (params: ProductDetailParams) => Promise<ProductDetailCatalogResult>;
|
|
1114
1421
|
};
|
|
1115
1422
|
readonly cart: {
|
|
1116
1423
|
get: (cartId: string) => Promise<Cart>;
|
|
@@ -1142,6 +1449,59 @@ declare class CommerceClient {
|
|
|
1142
1449
|
constructor(options: CommerceClientOptions);
|
|
1143
1450
|
}
|
|
1144
1451
|
|
|
1452
|
+
interface ServerCommerceClientOptions {
|
|
1453
|
+
publishableKey?: string;
|
|
1454
|
+
secretKey: string;
|
|
1455
|
+
apiUrl?: string;
|
|
1456
|
+
onRequestId?: (id: string | null) => void;
|
|
1457
|
+
}
|
|
1458
|
+
declare class ServerCommerceClient {
|
|
1459
|
+
readonly product: {
|
|
1460
|
+
stockCheck: (params: StockCheckParams) => Promise<StockCheckResponse>;
|
|
1461
|
+
listingGroups: (params: ListingGroupsParams) => Promise<ProductListingGroupsResponse>;
|
|
1462
|
+
detail: (params: ProductDetailParams) => Promise<ProductDetailResult>;
|
|
1463
|
+
previewDetail: (params: ProductDetailPreviewParams, options: ProductDetailPreviewOptions) => Promise<ProductDetail | null>;
|
|
1464
|
+
upsert: (params: ProductUpsertParams) => Promise<ProductUpsertResponse>;
|
|
1465
|
+
};
|
|
1466
|
+
readonly cart: {
|
|
1467
|
+
get: (cartId: string) => Promise<Cart>;
|
|
1468
|
+
addItem: (params: AddItemParams) => Promise<CartItem>;
|
|
1469
|
+
updateItem: (params: UpdateItemParams) => Promise<CartItem>;
|
|
1470
|
+
removeItem: (params: RemoveItemParams) => Promise<{
|
|
1471
|
+
success: boolean;
|
|
1472
|
+
}>;
|
|
1473
|
+
applyDiscount: (params: ApplyDiscountParams) => Promise<Cart>;
|
|
1474
|
+
removeDiscount: (params: RemoveDiscountParams) => Promise<Cart>;
|
|
1475
|
+
clear: (params: ClearCartParams) => Promise<{
|
|
1476
|
+
success: boolean;
|
|
1477
|
+
}>;
|
|
1478
|
+
};
|
|
1479
|
+
readonly orders: {
|
|
1480
|
+
checkout: (params: CheckoutParams) => Promise<Order>;
|
|
1481
|
+
create: (params: CreateOrderParams) => Promise<Order>;
|
|
1482
|
+
update: (params: UpdateOrderParams) => Promise<Order>;
|
|
1483
|
+
updateTransaction: (params: UpdateTransactionParams) => Promise<Transaction>;
|
|
1484
|
+
confirmPayment: (params: ConfirmPaymentParams) => Promise<ConfirmPaymentResponse>;
|
|
1485
|
+
cancelOrder: (params: CancelOrderParams) => Promise<CancelOrderResponse>;
|
|
1486
|
+
createFulfillment: (params: CreateFulfillmentParams) => Promise<Fulfillment>;
|
|
1487
|
+
updateFulfillment: (params: UpdateFulfillmentParams) => Promise<Fulfillment>;
|
|
1488
|
+
bulkImportFulfillments: (params: BulkImportFulfillmentsParams) => Promise<BulkImportFulfillmentsResponse>;
|
|
1489
|
+
createReturn: (params: CreateReturnParams) => Promise<Return>;
|
|
1490
|
+
updateReturn: (params: UpdateReturnParams) => Promise<Return>;
|
|
1491
|
+
returnWithRefund: (params: ReturnWithRefundParams) => Promise<{
|
|
1492
|
+
return: Return;
|
|
1493
|
+
transaction: Transaction | null;
|
|
1494
|
+
}>;
|
|
1495
|
+
};
|
|
1496
|
+
readonly discounts: {
|
|
1497
|
+
validate: (params: ValidateDiscountParams) => Promise<ValidateDiscountResult>;
|
|
1498
|
+
};
|
|
1499
|
+
readonly shipping: {
|
|
1500
|
+
calculate: (params: CalculateShippingParams) => Promise<CalculateShippingResult>;
|
|
1501
|
+
};
|
|
1502
|
+
constructor(options: ServerCommerceClientOptions);
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1145
1505
|
/**
|
|
1146
1506
|
* Customer namespace. Currently exposes .auth; reserved for future customer-
|
|
1147
1507
|
* scoped capabilities (addresses, preferences, etc.).
|
|
@@ -1151,6 +1511,257 @@ declare class CustomerNamespace {
|
|
|
1151
1511
|
constructor(publishableKey: string, options?: CustomerAuthOptions, apiUrl?: string);
|
|
1152
1512
|
}
|
|
1153
1513
|
|
|
1514
|
+
interface EventsClientOptions {
|
|
1515
|
+
publishableKey?: string;
|
|
1516
|
+
apiUrl?: string;
|
|
1517
|
+
customerToken?: string | (() => string | null);
|
|
1518
|
+
onUnauthorized?: () => Promise<string | null>;
|
|
1519
|
+
onRequestId?: (id: string | null) => void;
|
|
1520
|
+
}
|
|
1521
|
+
type EventsDateParam = string | Date;
|
|
1522
|
+
interface EventsRangeParams {
|
|
1523
|
+
start: EventsDateParam;
|
|
1524
|
+
end: EventsDateParam;
|
|
1525
|
+
limit?: number;
|
|
1526
|
+
page?: number;
|
|
1527
|
+
calendar?: string | string[];
|
|
1528
|
+
calendarSlug?: string | string[];
|
|
1529
|
+
category?: string | string[];
|
|
1530
|
+
categorySlug?: string | string[];
|
|
1531
|
+
tag?: string | string[];
|
|
1532
|
+
tagSlug?: string | string[];
|
|
1533
|
+
}
|
|
1534
|
+
interface EventsTaxonomyItem {
|
|
1535
|
+
id: string | number;
|
|
1536
|
+
title?: string | null;
|
|
1537
|
+
slug?: string | null;
|
|
1538
|
+
description?: string | null;
|
|
1539
|
+
color?: string | null;
|
|
1540
|
+
}
|
|
1541
|
+
interface EventsCalendarItem extends EventsTaxonomyItem {
|
|
1542
|
+
timezone?: string | null;
|
|
1543
|
+
visibility?: string | null;
|
|
1544
|
+
}
|
|
1545
|
+
interface EventsLocation {
|
|
1546
|
+
type?: string | null;
|
|
1547
|
+
name?: string | null;
|
|
1548
|
+
address?: string | null;
|
|
1549
|
+
onlineUrl?: string | null;
|
|
1550
|
+
onlineNote?: string | null;
|
|
1551
|
+
}
|
|
1552
|
+
interface EventsOccurrenceLocation {
|
|
1553
|
+
name?: string | null;
|
|
1554
|
+
address?: string | null;
|
|
1555
|
+
onlineUrl?: string | null;
|
|
1556
|
+
note?: string | null;
|
|
1557
|
+
}
|
|
1558
|
+
interface EventsExternalSource {
|
|
1559
|
+
provider?: string | null;
|
|
1560
|
+
url?: string | null;
|
|
1561
|
+
}
|
|
1562
|
+
interface EventsRangeEvent {
|
|
1563
|
+
id: string | number;
|
|
1564
|
+
title?: string | null;
|
|
1565
|
+
slug?: string | null;
|
|
1566
|
+
description?: string | null;
|
|
1567
|
+
startsAt?: string | null;
|
|
1568
|
+
endsAt?: string | null;
|
|
1569
|
+
timezone?: string | null;
|
|
1570
|
+
isAllDay: boolean;
|
|
1571
|
+
visibility?: string | null;
|
|
1572
|
+
sourceType?: string | null;
|
|
1573
|
+
registrationPolicy?: string | null;
|
|
1574
|
+
externalRegistrationUrl?: string | null;
|
|
1575
|
+
externalSource: EventsExternalSource | null;
|
|
1576
|
+
location: EventsLocation | null;
|
|
1577
|
+
calendars: EventsCalendarItem[];
|
|
1578
|
+
categories: EventsTaxonomyItem[];
|
|
1579
|
+
tags: EventsTaxonomyItem[];
|
|
1580
|
+
}
|
|
1581
|
+
interface EventsRangeOccurrence {
|
|
1582
|
+
id: string | number;
|
|
1583
|
+
instanceKey?: string | null;
|
|
1584
|
+
startsAt?: string | null;
|
|
1585
|
+
endsAt?: string | null;
|
|
1586
|
+
timezone?: string | null;
|
|
1587
|
+
isAllDay: boolean;
|
|
1588
|
+
status?: string | null;
|
|
1589
|
+
capacity?: number;
|
|
1590
|
+
registrationCount?: number;
|
|
1591
|
+
waitlistCount?: number;
|
|
1592
|
+
locationOverride: EventsOccurrenceLocation | null;
|
|
1593
|
+
event: EventsRangeEvent;
|
|
1594
|
+
}
|
|
1595
|
+
interface EventsRangeResponse {
|
|
1596
|
+
range: {
|
|
1597
|
+
start: string;
|
|
1598
|
+
end: string;
|
|
1599
|
+
};
|
|
1600
|
+
docs: EventsRangeOccurrence[];
|
|
1601
|
+
calendars: EventsCalendarItem[];
|
|
1602
|
+
events: EventsRangeEvent[];
|
|
1603
|
+
categories: EventsTaxonomyItem[];
|
|
1604
|
+
tags: EventsTaxonomyItem[];
|
|
1605
|
+
totalDocs: number;
|
|
1606
|
+
limit: number;
|
|
1607
|
+
page: number;
|
|
1608
|
+
totalPages: number;
|
|
1609
|
+
hasNextPage: boolean;
|
|
1610
|
+
hasPrevPage: boolean;
|
|
1611
|
+
}
|
|
1612
|
+
interface EventRegistrationAttendeeInput {
|
|
1613
|
+
name?: string;
|
|
1614
|
+
email?: string;
|
|
1615
|
+
phone?: string;
|
|
1616
|
+
}
|
|
1617
|
+
interface EventRegistrationAnswerInput {
|
|
1618
|
+
question: string;
|
|
1619
|
+
answer?: string;
|
|
1620
|
+
}
|
|
1621
|
+
interface EventRegistrationRegisterParams {
|
|
1622
|
+
event: string;
|
|
1623
|
+
occurrence: string;
|
|
1624
|
+
quantity?: number;
|
|
1625
|
+
attendee?: EventRegistrationAttendeeInput;
|
|
1626
|
+
answers?: EventRegistrationAnswerInput[];
|
|
1627
|
+
}
|
|
1628
|
+
interface EventRegistrationPublic {
|
|
1629
|
+
id?: string | number;
|
|
1630
|
+
event?: unknown;
|
|
1631
|
+
occurrence?: unknown;
|
|
1632
|
+
registrationStatus?: string | null;
|
|
1633
|
+
attendanceStatus?: string | null;
|
|
1634
|
+
quantity?: number | null;
|
|
1635
|
+
guestTokenExpiresAt?: string | null;
|
|
1636
|
+
}
|
|
1637
|
+
interface EventGuestRegistration extends EventRegistrationPublic {
|
|
1638
|
+
attendee: {
|
|
1639
|
+
name: string | null;
|
|
1640
|
+
email: string | null;
|
|
1641
|
+
phone: string | null;
|
|
1642
|
+
} | null;
|
|
1643
|
+
attendeeEmail: string | null;
|
|
1644
|
+
answers: Array<{
|
|
1645
|
+
question: string;
|
|
1646
|
+
answer?: string;
|
|
1647
|
+
}>;
|
|
1648
|
+
}
|
|
1649
|
+
interface EventRegistrationRegisterResponse {
|
|
1650
|
+
registration: EventRegistrationPublic;
|
|
1651
|
+
guestToken: string;
|
|
1652
|
+
guestTokenExpiresAt: string;
|
|
1653
|
+
}
|
|
1654
|
+
interface EventGuestRegistrationResponse {
|
|
1655
|
+
registration: EventGuestRegistration;
|
|
1656
|
+
}
|
|
1657
|
+
interface EventGuestCancelParams {
|
|
1658
|
+
reason?: string;
|
|
1659
|
+
}
|
|
1660
|
+
declare class EventsClient {
|
|
1661
|
+
private readonly publishableKey;
|
|
1662
|
+
private readonly apiUrl?;
|
|
1663
|
+
private readonly customerToken?;
|
|
1664
|
+
private readonly onUnauthorized?;
|
|
1665
|
+
private readonly onRequestId?;
|
|
1666
|
+
constructor(options: EventsClientOptions);
|
|
1667
|
+
getRange(params: EventsRangeParams): Promise<EventsRangeResponse>;
|
|
1668
|
+
register(params: EventRegistrationRegisterParams): Promise<EventRegistrationRegisterResponse>;
|
|
1669
|
+
getGuestRegistration(token: string): Promise<EventGuestRegistrationResponse>;
|
|
1670
|
+
cancelGuestRegistration(token: string, params?: EventGuestCancelParams): Promise<EventGuestRegistrationResponse>;
|
|
1671
|
+
private execute;
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
type TenantIntrospectionApiOptions = ServerApiOptions;
|
|
1675
|
+
type TenantFeatureProgressFeature = 'ecommerce';
|
|
1676
|
+
interface TenantFeatureProgressInput {
|
|
1677
|
+
feature: TenantFeatureProgressFeature;
|
|
1678
|
+
includeEvidence?: boolean;
|
|
1679
|
+
}
|
|
1680
|
+
type TenantFeatureProgressStatus = 'ready' | 'attention' | 'blocked';
|
|
1681
|
+
type TenantFeatureProgressItemState = 'complete' | 'incomplete' | 'blocked' | 'attention' | 'optional' | 'unknown' | 'manual' | 'not-applicable';
|
|
1682
|
+
type TenantFeatureProgressSeverity = 'required' | 'recommended' | 'optional';
|
|
1683
|
+
type TenantFeatureProgressEvidenceValue = string | number | boolean | null;
|
|
1684
|
+
interface TenantFeatureProgressItem {
|
|
1685
|
+
id: string;
|
|
1686
|
+
title: string;
|
|
1687
|
+
state: TenantFeatureProgressItemState;
|
|
1688
|
+
severity: TenantFeatureProgressSeverity;
|
|
1689
|
+
summary: string;
|
|
1690
|
+
evidence?: Record<string, TenantFeatureProgressEvidenceValue>;
|
|
1691
|
+
}
|
|
1692
|
+
interface TenantFeatureProgressGroup {
|
|
1693
|
+
id: string;
|
|
1694
|
+
title: string;
|
|
1695
|
+
summary?: string;
|
|
1696
|
+
items: TenantFeatureProgressItem[];
|
|
1697
|
+
}
|
|
1698
|
+
interface TenantFeatureProgressResponse {
|
|
1699
|
+
schemaVersion: 1;
|
|
1700
|
+
feature: TenantFeatureProgressFeature;
|
|
1701
|
+
status: TenantFeatureProgressStatus;
|
|
1702
|
+
generatedAt: string;
|
|
1703
|
+
tenant: {
|
|
1704
|
+
id: string;
|
|
1705
|
+
name: string;
|
|
1706
|
+
plan: string;
|
|
1707
|
+
};
|
|
1708
|
+
capability: {
|
|
1709
|
+
effectiveFeatures: string[];
|
|
1710
|
+
planBlocked: string[];
|
|
1711
|
+
closureAdded: string[];
|
|
1712
|
+
};
|
|
1713
|
+
summary: {
|
|
1714
|
+
complete: number;
|
|
1715
|
+
total: number;
|
|
1716
|
+
blocking: number;
|
|
1717
|
+
manual: number;
|
|
1718
|
+
unknown: number;
|
|
1719
|
+
};
|
|
1720
|
+
groups: TenantFeatureProgressGroup[];
|
|
1721
|
+
}
|
|
1722
|
+
interface CollectionFieldSchema {
|
|
1723
|
+
name: string;
|
|
1724
|
+
path: string;
|
|
1725
|
+
type: string;
|
|
1726
|
+
required?: true;
|
|
1727
|
+
unique?: true;
|
|
1728
|
+
hasMany?: true;
|
|
1729
|
+
relationTo?: string | string[];
|
|
1730
|
+
options?: Array<{
|
|
1731
|
+
label: string;
|
|
1732
|
+
value: string;
|
|
1733
|
+
}>;
|
|
1734
|
+
hidden?: true;
|
|
1735
|
+
systemManaged?: true;
|
|
1736
|
+
writable?: boolean;
|
|
1737
|
+
fields?: CollectionFieldSchema[];
|
|
1738
|
+
}
|
|
1739
|
+
interface CollectionSchemaResponse {
|
|
1740
|
+
contractVersion: 1;
|
|
1741
|
+
mode: 'effective';
|
|
1742
|
+
collection: {
|
|
1743
|
+
slug: string;
|
|
1744
|
+
timestamps: boolean;
|
|
1745
|
+
alwaysActive: boolean;
|
|
1746
|
+
feature: string | null;
|
|
1747
|
+
systemFields: string[];
|
|
1748
|
+
visibility: {
|
|
1749
|
+
collectionHidden: boolean;
|
|
1750
|
+
hiddenFields: string[];
|
|
1751
|
+
};
|
|
1752
|
+
fields: CollectionFieldSchema[];
|
|
1753
|
+
};
|
|
1754
|
+
}
|
|
1755
|
+
interface TenantIntrospectionClient {
|
|
1756
|
+
collectionSchema: (collection: string) => Promise<CollectionSchemaResponse>;
|
|
1757
|
+
featureProgress: (params: TenantFeatureProgressInput) => Promise<TenantFeatureProgressResponse>;
|
|
1758
|
+
}
|
|
1759
|
+
declare class TenantIntrospectionApi extends BaseApi implements TenantIntrospectionClient {
|
|
1760
|
+
constructor(options: TenantIntrospectionApiOptions);
|
|
1761
|
+
collectionSchema(collection: string): Promise<CollectionSchemaResponse>;
|
|
1762
|
+
featureProgress(params: TenantFeatureProgressInput): Promise<TenantFeatureProgressResponse>;
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1154
1765
|
interface ClientConfig {
|
|
1155
1766
|
publishableKey: string;
|
|
1156
1767
|
/** API base URL for staging, self-hosted, preview, or proxy deployments. */
|
|
@@ -1302,21 +1913,63 @@ interface RootQueryLookup<T extends string> {
|
|
|
1302
1913
|
}>;
|
|
1303
1914
|
}
|
|
1304
1915
|
type RootReadOnlyQueryBuilder<T extends PublicCollection> = RootQueryLookup<T>;
|
|
1916
|
+
interface RootServerQueryBuilder<T extends ServerCollection> extends RootQueryLookup<T> {
|
|
1917
|
+
create(data: Partial<CollectionType<T>>, options?: {
|
|
1918
|
+
file?: File | Blob;
|
|
1919
|
+
filename?: string;
|
|
1920
|
+
}): Promise<PayloadMutationResponse<CollectionType<T>>>;
|
|
1921
|
+
update(id: string, data: Partial<CollectionType<T>>, options?: {
|
|
1922
|
+
file?: File | Blob;
|
|
1923
|
+
filename?: string;
|
|
1924
|
+
}): Promise<PayloadMutationResponse<CollectionType<T>>>;
|
|
1925
|
+
updateMany(where: ApiQueryOptions['where'], data: Partial<CollectionType<T>>): Promise<PayloadFindResponse<CollectionType<T>>>;
|
|
1926
|
+
remove(id: string): Promise<CollectionType<T>>;
|
|
1927
|
+
removeMany(where: ApiQueryOptions['where']): Promise<PayloadFindResponse<CollectionType<T>>>;
|
|
1928
|
+
}
|
|
1305
1929
|
interface RootCollectionClient {
|
|
1306
1930
|
from<T extends PublicCollection>(collection: T): RootReadOnlyQueryBuilder<T>;
|
|
1307
1931
|
}
|
|
1932
|
+
interface RootServerCollectionClient {
|
|
1933
|
+
from<T extends ServerCollection>(collection: T): RootServerQueryBuilder<T>;
|
|
1934
|
+
}
|
|
1308
1935
|
interface RootClient {
|
|
1309
1936
|
commerce: CommerceClient;
|
|
1310
1937
|
community: CommunityClient;
|
|
1938
|
+
/** Set on {@link createClient} return values; optional for structural mocks. */
|
|
1939
|
+
events?: EventsClient;
|
|
1311
1940
|
customer: CustomerNamespace;
|
|
1312
1941
|
collections: RootCollectionClient;
|
|
1313
1942
|
lastRequestId: string | null;
|
|
1314
1943
|
getState(): ClientState;
|
|
1315
1944
|
getConfig(): ClientConfig;
|
|
1316
1945
|
}
|
|
1946
|
+
interface RootServerClient {
|
|
1947
|
+
commerce: ServerCommerceClient;
|
|
1948
|
+
tenant: TenantIntrospectionClient;
|
|
1949
|
+
/** Set on {@link createServerClient} return values; optional for structural mocks. */
|
|
1950
|
+
events?: EventsClient;
|
|
1951
|
+
community: CommunityClient & {
|
|
1952
|
+
moderation: {
|
|
1953
|
+
banCustomer: (p: BanCustomerParams) => Promise<CommunityBan>;
|
|
1954
|
+
unbanCustomer: (p: UnbanCustomerParams) => Promise<{
|
|
1955
|
+
success: true;
|
|
1956
|
+
}>;
|
|
1957
|
+
};
|
|
1958
|
+
};
|
|
1959
|
+
collections: RootServerCollectionClient;
|
|
1960
|
+
lastRequestId: string | null;
|
|
1961
|
+
getState(): ClientState;
|
|
1962
|
+
getConfig(): Omit<ClientServerConfig, 'secretKey'>;
|
|
1963
|
+
}
|
|
1964
|
+
type RootClientWithEvents = RootClient & {
|
|
1965
|
+
events: EventsClient;
|
|
1966
|
+
};
|
|
1967
|
+
type RootServerClientWithEvents = RootServerClient & {
|
|
1968
|
+
events: EventsClient;
|
|
1969
|
+
};
|
|
1317
1970
|
type DeepPartial<T> = {
|
|
1318
1971
|
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
1319
1972
|
};
|
|
1320
1973
|
type ExtractArrayType<T> = T extends (infer U)[] ? U : never;
|
|
1321
1974
|
|
|
1322
|
-
export { type
|
|
1975
|
+
export { type TenantFeatureProgressGroup as $, type ApiQueryOptions as A, BaseApi as B, CommerceClient as C, type DebugConfig as D, EventsClient as E, type EventRegistrationRegisterResponse as F, type EventsCalendarItem as G, type EventsClientOptions as H, type EventsDateParam as I, type EventsExternalSource as J, type EventsLocation as K, type EventsOccurrenceLocation as L, type EventsRangeEvent as M, type EventsRangeOccurrence as N, type EventsRangeParams as O, type PayloadFindResponse as P, type EventsRangeResponse as Q, type RetryConfig as R, type Sort as S, type TenantIntrospectionClient as T, type UnbanCustomerParams as U, type EventsTaxonomyItem as V, type Where as W, ModerationApi as X, type RootServerClient as Y, type TenantFeatureProgressEvidenceValue as Z, type TenantFeatureProgressFeature as _, CommunityClient as a, type ListingGroupingEmptyReason as a$, type TenantFeatureProgressInput as a0, type TenantFeatureProgressItem as a1, type TenantFeatureProgressItemState as a2, type TenantFeatureProgressResponse as a3, type TenantFeatureProgressSeverity as a4, type TenantFeatureProgressStatus as a5, TenantIntrospectionApi as a6, type TenantIntrospectionApiOptions as a7, CustomerAuth as a8, type CustomerProfile as a9, type CancelOrderResponse as aA, type CancelReasonCode as aB, CartApi as aC, type CartApiOptions as aD, type CheckoutParams as aE, type ClearCartParams as aF, type Comment as aG, type CommerceClientOptions as aH, type CommunityClientOptions as aI, type CommunityComment as aJ, type CommunityCommentListSort as aK, type CommunityPost as aL, type CommunityPostCategory as aM, type CommunityPostListSort as aN, type CommunityPostTag as aO, type CompatibilityProductSelectionParamEvent as aP, type ConfirmPaymentParams as aQ, type ConfirmPaymentResponse as aR, type CreateFulfillmentParams as aS, type CreateOrderItem as aT, type CreateOrderParams as aU, type CreateReturnParams as aV, type CustomerAuthOptions as aW, type CustomerSnapshot as aX, DiscountApi as aY, type DiscountApiOptions as aZ, type LegacyProductSelectionParamEvent as a_, type CustomerAuthResponse as aa, type CustomerLoginData as ab, type CustomerRegisterResponse as ac, type CustomerRegisterData as ad, type CustomerRefreshResponse as ae, type UpdateProfileData as af, type ProductDetailParams as ag, type ProductDetailResult as ah, type ProductListingGroupsItem as ai, type ProductDetail as aj, type ProductDetailCatalog as ak, type StockSnapshotResponse as al, type ProductSelectionMediaSource as am, type ProductDisplayMediaSource as an, type ResolveProductSelectionMediaInput as ao, type ResolveProductSelectionMediaResult as ap, type ProductSelectionMediaPointer as aq, type RootClientWithEvents as ar, type AddItemParams as as, type ApplyDiscountParams as at, type BulkImportFulfillmentsParams as au, type BulkImportFulfillmentsResponse as av, type CalculateShippingParams as aw, type CalculateShippingResult as ax, type CancelOrderParams as ay, type CancelOrderReconciliationStatus as az, CustomerNamespace as b, type ProductUpsertFieldValidationErrorBody as b$, type ListingGroupingState as b0, type ListingGroupsParams as b1, type ListingPrimaryImageFallbackInput as b2, type MediaValue as b3, type NormalizedOptionSwatch as b4, type NormalizedProductSelection as b5, OrderApi as b6, type OrderApiOptions as b7, PRODUCT_UPSERT_READONLY_FIELD_REASON as b8, PRODUCT_UPSERT_UNKNOWN_FIELD_REASON as b9, type ProductListingGroupSummary as bA, type ProductListingGroupVariant as bB, type ProductListingGroupsProduct as bC, type ProductListingGroupsResponse as bD, type ProductListingProductShape as bE, type ProductListingProjection as bF, type ProductListingSwatch as bG, type ProductMediaResolutionSource as bH, type ProductOptionMatrix as bI, type ProductOptionMatrixOption as bJ, type ProductOptionMatrixValue as bK, type ProductOptionMatrixVariant as bL, type ProductOptionShape as bM, type ProductOptionValueShape as bN, type ProductOptionValueSwatch as bO, type ProductOptionValueSwatchInput as bP, type ProductSelectionAvailableSwatch as bQ, type ProductSelectionAvailableValue as bR, type ProductSelectionByOptionValue as bS, ProductSelectionCodecError as bT, type ProductSelectionCodecOptions as bU, type ProductSelectionInput as bV, type ProductSelectionOptionValue as bW, type ProductSelectionResolution as bX, type ProductSelectionResolutionContext as bY, type ProductSelectionUrlEmit as bZ, type ProductSelectionVariant as b_, ProductApi as ba, type ProductApiOptions as bb, type ProductDetailBrand as bc, type ProductDetailCatalogListing as bd, type ProductDetailCatalogResult as be, type ProductDetailCatalogVariant as bf, type ProductDetailCategory as bg, type ProductDetailImage as bh, type ProductDetailImageMedia as bi, type ProductDetailListing as bj, type ProductDetailMedia as bk, type ProductDetailOption as bl, type ProductDetailOptionValue as bm, type ProductDetailTag as bn, type ProductDetailUnavailableReason as bo, type ProductDetailVariant as bp, type ProductDetailVariantOptionValue as bq, type ProductDetailVideo as br, type ProductHrefGroup as bs, type ProductHrefOptions as bt, type ProductHrefProduct as bu, type ProductListingCard as bv, type ProductListingCardOptions as bw, type ProductListingCardPriceRange as bx, type ProductListingCardRepresentativeVariant as by, type ProductListingGroup as bz, type ClientState as c, type ProductUpsertFieldValidationErrorReason as c0, type ProductVariantShape as c1, type RemoveDiscountParams as c2, type RemoveItemParams as c3, type RequestOptions as c4, type ResolveProductDisplayMediaInput as c5, type ResolveProductDisplayMediaResult as c6, type ReturnItem as c7, type ReturnReason as c8, type ReturnWithRefundItem as c9, isProductUpsertFieldValidationErrorBody as cA, normalizeProductSelection as cB, normalizeProductSelectionFromMatrix as cC, normalizeSelectedValueIds as cD, parseProductSelection as cE, resolveListingPrimaryImagePointer as cF, resolveProductDisplayMedia as cG, resolveProductSelection as cH, resolveProductSelectionFromMatrix as cI, resolveProductSelectionMedia as cJ, resolveVariantForSelection as cK, selectNext as cL, selectedSwatchMediaItemId as cM, stringifyProductSelection as cN, type ReturnWithRefundParams as ca, ShippingApi as cb, type ShippingApiOptions as cc, type StockCheckParams as cd, type StockCheckResponse as ce, type StockCheckResult as cf, type StockSnapshotItem as cg, type StockSnapshotParams as ch, type UpdateFulfillmentParams as ci, type UpdateItemParams as cj, type UpdateOrderParams as ck, type UpdateReturnParams as cl, type UpdateTransactionParams as cm, type ValidateDiscountParams as cn, type ValidateDiscountResult as co, type WithIdempotencyKey as cp, buildProductHref as cq, buildProductListingCard as cr, buildProductListingGroupsByOption as cs, buildProductListingProjection as ct, buildProductOptionMatrix as cu, buildProductOptionMatrixFromDetail as cv, createProductSelectionCodec as cw, getAvailableOptionValues as cx, getProductSelectionImages as cy, getSelectedValueByOptionId as cz, type ClientConfig as d, type ClientMetadata as e, type DeepPartial as f, type ExtractArrayType as g, type PayloadMutationResponse as h, type RootClient as i, type RootCollectionClient as j, type RootReadOnlyQueryBuilder as k, type ServerApiOptions as l, ServerCommerceClient as m, type BanCustomerParams as n, type CommunityBan as o, type ClientServerConfig as p, type RootServerClientWithEvents as q, type CollectionFieldSchema as r, type CollectionSchemaResponse as s, type EventGuestCancelParams as t, type EventGuestRegistration as u, type EventGuestRegistrationResponse as v, type EventRegistrationAnswerInput as w, type EventRegistrationAttendeeInput as x, type EventRegistrationPublic as y, type EventRegistrationRegisterParams as z };
|