@putiikkipalvelu/storefront-sdk 0.12.0 → 0.14.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/dist/index.d.cts +176 -168
- package/dist/index.d.ts +176 -168
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Product Types
|
|
3
|
+
*
|
|
4
|
+
* Types for product-related API endpoints.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Product variation option (e.g., Size: Large)
|
|
9
|
+
*/
|
|
10
|
+
interface VariationOption {
|
|
11
|
+
/** Option value (e.g., "Large", "Red") */
|
|
12
|
+
value: string;
|
|
13
|
+
/** Option type information */
|
|
14
|
+
optionType: {
|
|
15
|
+
/** Option type name (e.g., "Size", "Color") */
|
|
16
|
+
name: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Product variation for listings (minimal fields)
|
|
21
|
+
*/
|
|
22
|
+
interface ProductVariationListing {
|
|
23
|
+
/** Unique variation identifier */
|
|
24
|
+
id: string;
|
|
25
|
+
/** Variation price in cents */
|
|
26
|
+
price: number;
|
|
27
|
+
/** Sale price in cents (null if not on sale) */
|
|
28
|
+
salePrice: number | null;
|
|
29
|
+
/** Sale discount percentage as string (null if not on sale) */
|
|
30
|
+
salePercent: string | null;
|
|
31
|
+
/** Sale start date (ISO 8601), null = immediate */
|
|
32
|
+
saleStartDate: string | null;
|
|
33
|
+
/** Sale end date (ISO 8601), null = no end */
|
|
34
|
+
saleEndDate: string | null;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Full product variation (for product detail page)
|
|
38
|
+
*/
|
|
39
|
+
interface ProductVariation extends ProductVariationListing {
|
|
40
|
+
/** Variation weight in kg (null = use product weight) */
|
|
41
|
+
weight: number | null;
|
|
42
|
+
/** Available quantity (null = unlimited) */
|
|
43
|
+
quantity: number | null;
|
|
44
|
+
/** Stock keeping unit */
|
|
45
|
+
sku: string | null;
|
|
46
|
+
/** Variation-specific images */
|
|
47
|
+
images: string[];
|
|
48
|
+
/** Variation-specific description */
|
|
49
|
+
description: string | null;
|
|
50
|
+
/** Whether variation is visible on store */
|
|
51
|
+
showOnStore: boolean;
|
|
52
|
+
/** Variation options (size, color, etc.) */
|
|
53
|
+
options: VariationOption[];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Product for listing (cards, grids)
|
|
57
|
+
* Used by: /latest-products, /sorted-products
|
|
58
|
+
*/
|
|
59
|
+
interface Product {
|
|
60
|
+
/** Unique product identifier */
|
|
61
|
+
id: string;
|
|
62
|
+
/** Product display name */
|
|
63
|
+
name: string;
|
|
64
|
+
/** URL-friendly slug */
|
|
65
|
+
slug: string;
|
|
66
|
+
/** Product description */
|
|
67
|
+
description: string;
|
|
68
|
+
/** Base price in cents */
|
|
69
|
+
price: number;
|
|
70
|
+
/** Product images (URLs) */
|
|
71
|
+
images: string[];
|
|
72
|
+
/** Available quantity (null = unlimited) */
|
|
73
|
+
quantity: number | null;
|
|
74
|
+
/** Sale price in cents (null if not on sale) */
|
|
75
|
+
salePrice: number | null;
|
|
76
|
+
/** Sale discount percentage as string (null if not on sale) */
|
|
77
|
+
salePercent: string | null;
|
|
78
|
+
/** Sale start date (ISO 8601), null = immediate */
|
|
79
|
+
saleStartDate: string | null;
|
|
80
|
+
/** Sale end date (ISO 8601), null = no end */
|
|
81
|
+
saleEndDate: string | null;
|
|
82
|
+
/** True if this product is delivered as a digital download (no shipping) */
|
|
83
|
+
isDigital?: boolean;
|
|
84
|
+
/** Product variations (minimal fields for listing) */
|
|
85
|
+
variations: ProductVariationListing[];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Full product detail (single product page)
|
|
89
|
+
* Used by: /product/{slug}
|
|
90
|
+
*/
|
|
91
|
+
/**
|
|
92
|
+
* Ticket info attached to a ticket product
|
|
93
|
+
*/
|
|
94
|
+
interface ProductTicketInfo {
|
|
95
|
+
/** Ticket info ID */
|
|
96
|
+
id: string;
|
|
97
|
+
/** Whether holder name is required per ticket at checkout */
|
|
98
|
+
requiresHolder: boolean;
|
|
99
|
+
/** Maximum uses per ticket (0 = unlimited) */
|
|
100
|
+
maxUses: number;
|
|
101
|
+
/** Ticket sales start (ISO 8601), null = sales open immediately */
|
|
102
|
+
salesStart: string | null;
|
|
103
|
+
/** Ticket sales end (ISO 8601), null = sales never end */
|
|
104
|
+
salesEnd: string | null;
|
|
105
|
+
}
|
|
106
|
+
interface ProductDetail extends Omit<Product, "variations"> {
|
|
107
|
+
/** Product weight in kg (for shipping calculations) */
|
|
108
|
+
weight: number;
|
|
109
|
+
/** Stock keeping unit */
|
|
110
|
+
sku: string | null;
|
|
111
|
+
/** SEO meta title */
|
|
112
|
+
metaTitle: string | null;
|
|
113
|
+
/** SEO meta description */
|
|
114
|
+
metaDescription: string | null;
|
|
115
|
+
/** Product categories */
|
|
116
|
+
categories: CategoryReference[];
|
|
117
|
+
/** Full product variations */
|
|
118
|
+
variations: ProductVariation[];
|
|
119
|
+
/** Ticket info (present if product is a ticket, null otherwise) */
|
|
120
|
+
ticketInfo: ProductTicketInfo | null;
|
|
121
|
+
/**
|
|
122
|
+
* HTML instructions shown to the buyer after a digital purchase.
|
|
123
|
+
* Only populated when isDigital=true; null otherwise.
|
|
124
|
+
*/
|
|
125
|
+
digitalContent?: string | null;
|
|
126
|
+
/** Average rating across approved reviews (null when there are none) */
|
|
127
|
+
averageRating: number | null;
|
|
128
|
+
/** Number of approved reviews */
|
|
129
|
+
reviewCount: number;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Response from /sorted-products
|
|
133
|
+
*/
|
|
134
|
+
interface ProductListResponse {
|
|
135
|
+
/** Category/collection name */
|
|
136
|
+
name: string;
|
|
137
|
+
/** Products in the list */
|
|
138
|
+
products: Product[];
|
|
139
|
+
/** Total count for pagination (only in sorted-products) */
|
|
140
|
+
totalCount?: number;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Response from /products-count
|
|
144
|
+
*/
|
|
145
|
+
interface ProductCountResponse {
|
|
146
|
+
/** Number of products */
|
|
147
|
+
count: number;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Sort options for product listing
|
|
151
|
+
*/
|
|
152
|
+
type ProductSortOption = "newest" | "price_asc" | "price_desc" | "popularity" | "relevance"
|
|
153
|
+
/** The merchant's manual per-category order (set in the dashboard). Only
|
|
154
|
+
* meaningful within a category; falls back to "newest" on all-products. */
|
|
155
|
+
| "featured";
|
|
156
|
+
/**
|
|
157
|
+
* Parameters for sorted products
|
|
158
|
+
*/
|
|
159
|
+
interface ProductListParams {
|
|
160
|
+
/** Category slugs to filter by (omit for all products) */
|
|
161
|
+
slugs?: string[];
|
|
162
|
+
/** Page number (1-based, default: 1) */
|
|
163
|
+
page?: number;
|
|
164
|
+
/** Products per page (default: 12, max: 100) */
|
|
165
|
+
pageSize?: number;
|
|
166
|
+
/** Sort order */
|
|
167
|
+
sort?: ProductSortOption;
|
|
168
|
+
/** Full-text search query */
|
|
169
|
+
query?: string;
|
|
170
|
+
}
|
|
171
|
+
|
|
1
172
|
/**
|
|
2
173
|
* Store Configuration Types
|
|
3
174
|
*
|
|
4
175
|
* Types for the store config endpoint response.
|
|
5
176
|
*/
|
|
177
|
+
|
|
6
178
|
/**
|
|
7
179
|
* Complete store configuration returned by the API.
|
|
8
180
|
* Includes business info, SEO settings, payments, campaigns, and feature flags.
|
|
@@ -70,6 +242,10 @@ interface StoreInfo {
|
|
|
70
242
|
logoUrl: string | null;
|
|
71
243
|
/** Product image aspect ratio: SQUARE (1:1) or PORTRAIT (3:4) */
|
|
72
244
|
imageAspectRatio: ImageAspectRatio;
|
|
245
|
+
/** Default product sort for storefront category pages before the shopper
|
|
246
|
+
* picks a sort. "featured" = the merchant's manual per-category order.
|
|
247
|
+
* Optional for backward compatibility with older backends. */
|
|
248
|
+
defaultProductSort?: ProductSortOption;
|
|
73
249
|
}
|
|
74
250
|
/**
|
|
75
251
|
* Store SEO and social media configuration
|
|
@@ -276,174 +452,6 @@ interface CategoryReference {
|
|
|
276
452
|
parentId: string | null;
|
|
277
453
|
}
|
|
278
454
|
|
|
279
|
-
/**
|
|
280
|
-
* Product Types
|
|
281
|
-
*
|
|
282
|
-
* Types for product-related API endpoints.
|
|
283
|
-
*/
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Product variation option (e.g., Size: Large)
|
|
287
|
-
*/
|
|
288
|
-
interface VariationOption {
|
|
289
|
-
/** Option value (e.g., "Large", "Red") */
|
|
290
|
-
value: string;
|
|
291
|
-
/** Option type information */
|
|
292
|
-
optionType: {
|
|
293
|
-
/** Option type name (e.g., "Size", "Color") */
|
|
294
|
-
name: string;
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* Product variation for listings (minimal fields)
|
|
299
|
-
*/
|
|
300
|
-
interface ProductVariationListing {
|
|
301
|
-
/** Unique variation identifier */
|
|
302
|
-
id: string;
|
|
303
|
-
/** Variation price in cents */
|
|
304
|
-
price: number;
|
|
305
|
-
/** Sale price in cents (null if not on sale) */
|
|
306
|
-
salePrice: number | null;
|
|
307
|
-
/** Sale discount percentage as string (null if not on sale) */
|
|
308
|
-
salePercent: string | null;
|
|
309
|
-
/** Sale start date (ISO 8601), null = immediate */
|
|
310
|
-
saleStartDate: string | null;
|
|
311
|
-
/** Sale end date (ISO 8601), null = no end */
|
|
312
|
-
saleEndDate: string | null;
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* Full product variation (for product detail page)
|
|
316
|
-
*/
|
|
317
|
-
interface ProductVariation extends ProductVariationListing {
|
|
318
|
-
/** Variation weight in kg (null = use product weight) */
|
|
319
|
-
weight: number | null;
|
|
320
|
-
/** Available quantity (null = unlimited) */
|
|
321
|
-
quantity: number | null;
|
|
322
|
-
/** Stock keeping unit */
|
|
323
|
-
sku: string | null;
|
|
324
|
-
/** Variation-specific images */
|
|
325
|
-
images: string[];
|
|
326
|
-
/** Variation-specific description */
|
|
327
|
-
description: string | null;
|
|
328
|
-
/** Whether variation is visible on store */
|
|
329
|
-
showOnStore: boolean;
|
|
330
|
-
/** Variation options (size, color, etc.) */
|
|
331
|
-
options: VariationOption[];
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* Product for listing (cards, grids)
|
|
335
|
-
* Used by: /latest-products, /sorted-products
|
|
336
|
-
*/
|
|
337
|
-
interface Product {
|
|
338
|
-
/** Unique product identifier */
|
|
339
|
-
id: string;
|
|
340
|
-
/** Product display name */
|
|
341
|
-
name: string;
|
|
342
|
-
/** URL-friendly slug */
|
|
343
|
-
slug: string;
|
|
344
|
-
/** Product description */
|
|
345
|
-
description: string;
|
|
346
|
-
/** Base price in cents */
|
|
347
|
-
price: number;
|
|
348
|
-
/** Product images (URLs) */
|
|
349
|
-
images: string[];
|
|
350
|
-
/** Available quantity (null = unlimited) */
|
|
351
|
-
quantity: number | null;
|
|
352
|
-
/** Sale price in cents (null if not on sale) */
|
|
353
|
-
salePrice: number | null;
|
|
354
|
-
/** Sale discount percentage as string (null if not on sale) */
|
|
355
|
-
salePercent: string | null;
|
|
356
|
-
/** Sale start date (ISO 8601), null = immediate */
|
|
357
|
-
saleStartDate: string | null;
|
|
358
|
-
/** Sale end date (ISO 8601), null = no end */
|
|
359
|
-
saleEndDate: string | null;
|
|
360
|
-
/** True if this product is delivered as a digital download (no shipping) */
|
|
361
|
-
isDigital?: boolean;
|
|
362
|
-
/** Product variations (minimal fields for listing) */
|
|
363
|
-
variations: ProductVariationListing[];
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
* Full product detail (single product page)
|
|
367
|
-
* Used by: /product/{slug}
|
|
368
|
-
*/
|
|
369
|
-
/**
|
|
370
|
-
* Ticket info attached to a ticket product
|
|
371
|
-
*/
|
|
372
|
-
interface ProductTicketInfo {
|
|
373
|
-
/** Ticket info ID */
|
|
374
|
-
id: string;
|
|
375
|
-
/** Whether holder name is required per ticket at checkout */
|
|
376
|
-
requiresHolder: boolean;
|
|
377
|
-
/** Maximum uses per ticket (0 = unlimited) */
|
|
378
|
-
maxUses: number;
|
|
379
|
-
/** Ticket sales start (ISO 8601), null = sales open immediately */
|
|
380
|
-
salesStart: string | null;
|
|
381
|
-
/** Ticket sales end (ISO 8601), null = sales never end */
|
|
382
|
-
salesEnd: string | null;
|
|
383
|
-
}
|
|
384
|
-
interface ProductDetail extends Omit<Product, "variations"> {
|
|
385
|
-
/** Product weight in kg (for shipping calculations) */
|
|
386
|
-
weight: number;
|
|
387
|
-
/** Stock keeping unit */
|
|
388
|
-
sku: string | null;
|
|
389
|
-
/** SEO meta title */
|
|
390
|
-
metaTitle: string | null;
|
|
391
|
-
/** SEO meta description */
|
|
392
|
-
metaDescription: string | null;
|
|
393
|
-
/** Product categories */
|
|
394
|
-
categories: CategoryReference[];
|
|
395
|
-
/** Full product variations */
|
|
396
|
-
variations: ProductVariation[];
|
|
397
|
-
/** Ticket info (present if product is a ticket, null otherwise) */
|
|
398
|
-
ticketInfo: ProductTicketInfo | null;
|
|
399
|
-
/**
|
|
400
|
-
* HTML instructions shown to the buyer after a digital purchase.
|
|
401
|
-
* Only populated when isDigital=true; null otherwise.
|
|
402
|
-
*/
|
|
403
|
-
digitalContent?: string | null;
|
|
404
|
-
/** Average rating across approved reviews (null when there are none) */
|
|
405
|
-
averageRating: number | null;
|
|
406
|
-
/** Number of approved reviews */
|
|
407
|
-
reviewCount: number;
|
|
408
|
-
}
|
|
409
|
-
/**
|
|
410
|
-
* Response from /sorted-products
|
|
411
|
-
*/
|
|
412
|
-
interface ProductListResponse {
|
|
413
|
-
/** Category/collection name */
|
|
414
|
-
name: string;
|
|
415
|
-
/** Products in the list */
|
|
416
|
-
products: Product[];
|
|
417
|
-
/** Total count for pagination (only in sorted-products) */
|
|
418
|
-
totalCount?: number;
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* Response from /products-count
|
|
422
|
-
*/
|
|
423
|
-
interface ProductCountResponse {
|
|
424
|
-
/** Number of products */
|
|
425
|
-
count: number;
|
|
426
|
-
}
|
|
427
|
-
/**
|
|
428
|
-
* Sort options for product listing
|
|
429
|
-
*/
|
|
430
|
-
type ProductSortOption = "newest" | "price_asc" | "price_desc" | "popularity" | "relevance";
|
|
431
|
-
/**
|
|
432
|
-
* Parameters for sorted products
|
|
433
|
-
*/
|
|
434
|
-
interface ProductListParams {
|
|
435
|
-
/** Category slugs to filter by (omit for all products) */
|
|
436
|
-
slugs?: string[];
|
|
437
|
-
/** Page number (1-based, default: 1) */
|
|
438
|
-
page?: number;
|
|
439
|
-
/** Products per page (default: 12, max: 100) */
|
|
440
|
-
pageSize?: number;
|
|
441
|
-
/** Sort order */
|
|
442
|
-
sort?: ProductSortOption;
|
|
443
|
-
/** Full-text search query */
|
|
444
|
-
query?: string;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
455
|
/**
|
|
448
456
|
* Category Types
|
|
449
457
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Product Types
|
|
3
|
+
*
|
|
4
|
+
* Types for product-related API endpoints.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Product variation option (e.g., Size: Large)
|
|
9
|
+
*/
|
|
10
|
+
interface VariationOption {
|
|
11
|
+
/** Option value (e.g., "Large", "Red") */
|
|
12
|
+
value: string;
|
|
13
|
+
/** Option type information */
|
|
14
|
+
optionType: {
|
|
15
|
+
/** Option type name (e.g., "Size", "Color") */
|
|
16
|
+
name: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Product variation for listings (minimal fields)
|
|
21
|
+
*/
|
|
22
|
+
interface ProductVariationListing {
|
|
23
|
+
/** Unique variation identifier */
|
|
24
|
+
id: string;
|
|
25
|
+
/** Variation price in cents */
|
|
26
|
+
price: number;
|
|
27
|
+
/** Sale price in cents (null if not on sale) */
|
|
28
|
+
salePrice: number | null;
|
|
29
|
+
/** Sale discount percentage as string (null if not on sale) */
|
|
30
|
+
salePercent: string | null;
|
|
31
|
+
/** Sale start date (ISO 8601), null = immediate */
|
|
32
|
+
saleStartDate: string | null;
|
|
33
|
+
/** Sale end date (ISO 8601), null = no end */
|
|
34
|
+
saleEndDate: string | null;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Full product variation (for product detail page)
|
|
38
|
+
*/
|
|
39
|
+
interface ProductVariation extends ProductVariationListing {
|
|
40
|
+
/** Variation weight in kg (null = use product weight) */
|
|
41
|
+
weight: number | null;
|
|
42
|
+
/** Available quantity (null = unlimited) */
|
|
43
|
+
quantity: number | null;
|
|
44
|
+
/** Stock keeping unit */
|
|
45
|
+
sku: string | null;
|
|
46
|
+
/** Variation-specific images */
|
|
47
|
+
images: string[];
|
|
48
|
+
/** Variation-specific description */
|
|
49
|
+
description: string | null;
|
|
50
|
+
/** Whether variation is visible on store */
|
|
51
|
+
showOnStore: boolean;
|
|
52
|
+
/** Variation options (size, color, etc.) */
|
|
53
|
+
options: VariationOption[];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Product for listing (cards, grids)
|
|
57
|
+
* Used by: /latest-products, /sorted-products
|
|
58
|
+
*/
|
|
59
|
+
interface Product {
|
|
60
|
+
/** Unique product identifier */
|
|
61
|
+
id: string;
|
|
62
|
+
/** Product display name */
|
|
63
|
+
name: string;
|
|
64
|
+
/** URL-friendly slug */
|
|
65
|
+
slug: string;
|
|
66
|
+
/** Product description */
|
|
67
|
+
description: string;
|
|
68
|
+
/** Base price in cents */
|
|
69
|
+
price: number;
|
|
70
|
+
/** Product images (URLs) */
|
|
71
|
+
images: string[];
|
|
72
|
+
/** Available quantity (null = unlimited) */
|
|
73
|
+
quantity: number | null;
|
|
74
|
+
/** Sale price in cents (null if not on sale) */
|
|
75
|
+
salePrice: number | null;
|
|
76
|
+
/** Sale discount percentage as string (null if not on sale) */
|
|
77
|
+
salePercent: string | null;
|
|
78
|
+
/** Sale start date (ISO 8601), null = immediate */
|
|
79
|
+
saleStartDate: string | null;
|
|
80
|
+
/** Sale end date (ISO 8601), null = no end */
|
|
81
|
+
saleEndDate: string | null;
|
|
82
|
+
/** True if this product is delivered as a digital download (no shipping) */
|
|
83
|
+
isDigital?: boolean;
|
|
84
|
+
/** Product variations (minimal fields for listing) */
|
|
85
|
+
variations: ProductVariationListing[];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Full product detail (single product page)
|
|
89
|
+
* Used by: /product/{slug}
|
|
90
|
+
*/
|
|
91
|
+
/**
|
|
92
|
+
* Ticket info attached to a ticket product
|
|
93
|
+
*/
|
|
94
|
+
interface ProductTicketInfo {
|
|
95
|
+
/** Ticket info ID */
|
|
96
|
+
id: string;
|
|
97
|
+
/** Whether holder name is required per ticket at checkout */
|
|
98
|
+
requiresHolder: boolean;
|
|
99
|
+
/** Maximum uses per ticket (0 = unlimited) */
|
|
100
|
+
maxUses: number;
|
|
101
|
+
/** Ticket sales start (ISO 8601), null = sales open immediately */
|
|
102
|
+
salesStart: string | null;
|
|
103
|
+
/** Ticket sales end (ISO 8601), null = sales never end */
|
|
104
|
+
salesEnd: string | null;
|
|
105
|
+
}
|
|
106
|
+
interface ProductDetail extends Omit<Product, "variations"> {
|
|
107
|
+
/** Product weight in kg (for shipping calculations) */
|
|
108
|
+
weight: number;
|
|
109
|
+
/** Stock keeping unit */
|
|
110
|
+
sku: string | null;
|
|
111
|
+
/** SEO meta title */
|
|
112
|
+
metaTitle: string | null;
|
|
113
|
+
/** SEO meta description */
|
|
114
|
+
metaDescription: string | null;
|
|
115
|
+
/** Product categories */
|
|
116
|
+
categories: CategoryReference[];
|
|
117
|
+
/** Full product variations */
|
|
118
|
+
variations: ProductVariation[];
|
|
119
|
+
/** Ticket info (present if product is a ticket, null otherwise) */
|
|
120
|
+
ticketInfo: ProductTicketInfo | null;
|
|
121
|
+
/**
|
|
122
|
+
* HTML instructions shown to the buyer after a digital purchase.
|
|
123
|
+
* Only populated when isDigital=true; null otherwise.
|
|
124
|
+
*/
|
|
125
|
+
digitalContent?: string | null;
|
|
126
|
+
/** Average rating across approved reviews (null when there are none) */
|
|
127
|
+
averageRating: number | null;
|
|
128
|
+
/** Number of approved reviews */
|
|
129
|
+
reviewCount: number;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Response from /sorted-products
|
|
133
|
+
*/
|
|
134
|
+
interface ProductListResponse {
|
|
135
|
+
/** Category/collection name */
|
|
136
|
+
name: string;
|
|
137
|
+
/** Products in the list */
|
|
138
|
+
products: Product[];
|
|
139
|
+
/** Total count for pagination (only in sorted-products) */
|
|
140
|
+
totalCount?: number;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Response from /products-count
|
|
144
|
+
*/
|
|
145
|
+
interface ProductCountResponse {
|
|
146
|
+
/** Number of products */
|
|
147
|
+
count: number;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Sort options for product listing
|
|
151
|
+
*/
|
|
152
|
+
type ProductSortOption = "newest" | "price_asc" | "price_desc" | "popularity" | "relevance"
|
|
153
|
+
/** The merchant's manual per-category order (set in the dashboard). Only
|
|
154
|
+
* meaningful within a category; falls back to "newest" on all-products. */
|
|
155
|
+
| "featured";
|
|
156
|
+
/**
|
|
157
|
+
* Parameters for sorted products
|
|
158
|
+
*/
|
|
159
|
+
interface ProductListParams {
|
|
160
|
+
/** Category slugs to filter by (omit for all products) */
|
|
161
|
+
slugs?: string[];
|
|
162
|
+
/** Page number (1-based, default: 1) */
|
|
163
|
+
page?: number;
|
|
164
|
+
/** Products per page (default: 12, max: 100) */
|
|
165
|
+
pageSize?: number;
|
|
166
|
+
/** Sort order */
|
|
167
|
+
sort?: ProductSortOption;
|
|
168
|
+
/** Full-text search query */
|
|
169
|
+
query?: string;
|
|
170
|
+
}
|
|
171
|
+
|
|
1
172
|
/**
|
|
2
173
|
* Store Configuration Types
|
|
3
174
|
*
|
|
4
175
|
* Types for the store config endpoint response.
|
|
5
176
|
*/
|
|
177
|
+
|
|
6
178
|
/**
|
|
7
179
|
* Complete store configuration returned by the API.
|
|
8
180
|
* Includes business info, SEO settings, payments, campaigns, and feature flags.
|
|
@@ -70,6 +242,10 @@ interface StoreInfo {
|
|
|
70
242
|
logoUrl: string | null;
|
|
71
243
|
/** Product image aspect ratio: SQUARE (1:1) or PORTRAIT (3:4) */
|
|
72
244
|
imageAspectRatio: ImageAspectRatio;
|
|
245
|
+
/** Default product sort for storefront category pages before the shopper
|
|
246
|
+
* picks a sort. "featured" = the merchant's manual per-category order.
|
|
247
|
+
* Optional for backward compatibility with older backends. */
|
|
248
|
+
defaultProductSort?: ProductSortOption;
|
|
73
249
|
}
|
|
74
250
|
/**
|
|
75
251
|
* Store SEO and social media configuration
|
|
@@ -276,174 +452,6 @@ interface CategoryReference {
|
|
|
276
452
|
parentId: string | null;
|
|
277
453
|
}
|
|
278
454
|
|
|
279
|
-
/**
|
|
280
|
-
* Product Types
|
|
281
|
-
*
|
|
282
|
-
* Types for product-related API endpoints.
|
|
283
|
-
*/
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Product variation option (e.g., Size: Large)
|
|
287
|
-
*/
|
|
288
|
-
interface VariationOption {
|
|
289
|
-
/** Option value (e.g., "Large", "Red") */
|
|
290
|
-
value: string;
|
|
291
|
-
/** Option type information */
|
|
292
|
-
optionType: {
|
|
293
|
-
/** Option type name (e.g., "Size", "Color") */
|
|
294
|
-
name: string;
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* Product variation for listings (minimal fields)
|
|
299
|
-
*/
|
|
300
|
-
interface ProductVariationListing {
|
|
301
|
-
/** Unique variation identifier */
|
|
302
|
-
id: string;
|
|
303
|
-
/** Variation price in cents */
|
|
304
|
-
price: number;
|
|
305
|
-
/** Sale price in cents (null if not on sale) */
|
|
306
|
-
salePrice: number | null;
|
|
307
|
-
/** Sale discount percentage as string (null if not on sale) */
|
|
308
|
-
salePercent: string | null;
|
|
309
|
-
/** Sale start date (ISO 8601), null = immediate */
|
|
310
|
-
saleStartDate: string | null;
|
|
311
|
-
/** Sale end date (ISO 8601), null = no end */
|
|
312
|
-
saleEndDate: string | null;
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* Full product variation (for product detail page)
|
|
316
|
-
*/
|
|
317
|
-
interface ProductVariation extends ProductVariationListing {
|
|
318
|
-
/** Variation weight in kg (null = use product weight) */
|
|
319
|
-
weight: number | null;
|
|
320
|
-
/** Available quantity (null = unlimited) */
|
|
321
|
-
quantity: number | null;
|
|
322
|
-
/** Stock keeping unit */
|
|
323
|
-
sku: string | null;
|
|
324
|
-
/** Variation-specific images */
|
|
325
|
-
images: string[];
|
|
326
|
-
/** Variation-specific description */
|
|
327
|
-
description: string | null;
|
|
328
|
-
/** Whether variation is visible on store */
|
|
329
|
-
showOnStore: boolean;
|
|
330
|
-
/** Variation options (size, color, etc.) */
|
|
331
|
-
options: VariationOption[];
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* Product for listing (cards, grids)
|
|
335
|
-
* Used by: /latest-products, /sorted-products
|
|
336
|
-
*/
|
|
337
|
-
interface Product {
|
|
338
|
-
/** Unique product identifier */
|
|
339
|
-
id: string;
|
|
340
|
-
/** Product display name */
|
|
341
|
-
name: string;
|
|
342
|
-
/** URL-friendly slug */
|
|
343
|
-
slug: string;
|
|
344
|
-
/** Product description */
|
|
345
|
-
description: string;
|
|
346
|
-
/** Base price in cents */
|
|
347
|
-
price: number;
|
|
348
|
-
/** Product images (URLs) */
|
|
349
|
-
images: string[];
|
|
350
|
-
/** Available quantity (null = unlimited) */
|
|
351
|
-
quantity: number | null;
|
|
352
|
-
/** Sale price in cents (null if not on sale) */
|
|
353
|
-
salePrice: number | null;
|
|
354
|
-
/** Sale discount percentage as string (null if not on sale) */
|
|
355
|
-
salePercent: string | null;
|
|
356
|
-
/** Sale start date (ISO 8601), null = immediate */
|
|
357
|
-
saleStartDate: string | null;
|
|
358
|
-
/** Sale end date (ISO 8601), null = no end */
|
|
359
|
-
saleEndDate: string | null;
|
|
360
|
-
/** True if this product is delivered as a digital download (no shipping) */
|
|
361
|
-
isDigital?: boolean;
|
|
362
|
-
/** Product variations (minimal fields for listing) */
|
|
363
|
-
variations: ProductVariationListing[];
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
* Full product detail (single product page)
|
|
367
|
-
* Used by: /product/{slug}
|
|
368
|
-
*/
|
|
369
|
-
/**
|
|
370
|
-
* Ticket info attached to a ticket product
|
|
371
|
-
*/
|
|
372
|
-
interface ProductTicketInfo {
|
|
373
|
-
/** Ticket info ID */
|
|
374
|
-
id: string;
|
|
375
|
-
/** Whether holder name is required per ticket at checkout */
|
|
376
|
-
requiresHolder: boolean;
|
|
377
|
-
/** Maximum uses per ticket (0 = unlimited) */
|
|
378
|
-
maxUses: number;
|
|
379
|
-
/** Ticket sales start (ISO 8601), null = sales open immediately */
|
|
380
|
-
salesStart: string | null;
|
|
381
|
-
/** Ticket sales end (ISO 8601), null = sales never end */
|
|
382
|
-
salesEnd: string | null;
|
|
383
|
-
}
|
|
384
|
-
interface ProductDetail extends Omit<Product, "variations"> {
|
|
385
|
-
/** Product weight in kg (for shipping calculations) */
|
|
386
|
-
weight: number;
|
|
387
|
-
/** Stock keeping unit */
|
|
388
|
-
sku: string | null;
|
|
389
|
-
/** SEO meta title */
|
|
390
|
-
metaTitle: string | null;
|
|
391
|
-
/** SEO meta description */
|
|
392
|
-
metaDescription: string | null;
|
|
393
|
-
/** Product categories */
|
|
394
|
-
categories: CategoryReference[];
|
|
395
|
-
/** Full product variations */
|
|
396
|
-
variations: ProductVariation[];
|
|
397
|
-
/** Ticket info (present if product is a ticket, null otherwise) */
|
|
398
|
-
ticketInfo: ProductTicketInfo | null;
|
|
399
|
-
/**
|
|
400
|
-
* HTML instructions shown to the buyer after a digital purchase.
|
|
401
|
-
* Only populated when isDigital=true; null otherwise.
|
|
402
|
-
*/
|
|
403
|
-
digitalContent?: string | null;
|
|
404
|
-
/** Average rating across approved reviews (null when there are none) */
|
|
405
|
-
averageRating: number | null;
|
|
406
|
-
/** Number of approved reviews */
|
|
407
|
-
reviewCount: number;
|
|
408
|
-
}
|
|
409
|
-
/**
|
|
410
|
-
* Response from /sorted-products
|
|
411
|
-
*/
|
|
412
|
-
interface ProductListResponse {
|
|
413
|
-
/** Category/collection name */
|
|
414
|
-
name: string;
|
|
415
|
-
/** Products in the list */
|
|
416
|
-
products: Product[];
|
|
417
|
-
/** Total count for pagination (only in sorted-products) */
|
|
418
|
-
totalCount?: number;
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* Response from /products-count
|
|
422
|
-
*/
|
|
423
|
-
interface ProductCountResponse {
|
|
424
|
-
/** Number of products */
|
|
425
|
-
count: number;
|
|
426
|
-
}
|
|
427
|
-
/**
|
|
428
|
-
* Sort options for product listing
|
|
429
|
-
*/
|
|
430
|
-
type ProductSortOption = "newest" | "price_asc" | "price_desc" | "popularity" | "relevance";
|
|
431
|
-
/**
|
|
432
|
-
* Parameters for sorted products
|
|
433
|
-
*/
|
|
434
|
-
interface ProductListParams {
|
|
435
|
-
/** Category slugs to filter by (omit for all products) */
|
|
436
|
-
slugs?: string[];
|
|
437
|
-
/** Page number (1-based, default: 1) */
|
|
438
|
-
page?: number;
|
|
439
|
-
/** Products per page (default: 12, max: 100) */
|
|
440
|
-
pageSize?: number;
|
|
441
|
-
/** Sort order */
|
|
442
|
-
sort?: ProductSortOption;
|
|
443
|
-
/** Full-text search query */
|
|
444
|
-
query?: string;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
455
|
/**
|
|
448
456
|
* Category Types
|
|
449
457
|
*
|