@lightspeed/ecom-headless 0.1.0 → 0.1.1
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/CHANGELOG.md +10 -4
- package/dist/api/index.cjs +1 -1
- package/dist/api/index.d.cts +291 -310
- package/dist/api/index.d.mts +291 -310
- package/dist/api/index.d.ts +291 -310
- package/dist/api/index.mjs +1 -1
- package/dist/index.cjs +2 -1
- package/dist/index.d.cts +22 -2
- package/dist/index.d.mts +22 -2
- package/dist/index.d.ts +22 -2
- package/dist/index.mjs +2 -1
- package/dist/plugin-visualizer/bundle.html +4949 -0
- package/dist/storefront/index.cjs +1 -1
- package/dist/storefront/index.d.cts +1 -3
- package/dist/storefront/index.d.mts +1 -3
- package/dist/storefront/index.d.ts +1 -3
- package/dist/storefront/index.mjs +1 -1
- package/package.json +11 -7
- package/dist/chunks/download-product-file-mock.cjs +0 -1
- package/dist/chunks/download-product-file-mock.mjs +0 -1
- package/dist/chunks/get-product-mock.cjs +0 -1
- package/dist/chunks/get-product-mock.mjs +0 -1
- package/dist/chunks/get-store-profile-mock.cjs +0 -5
- package/dist/chunks/get-store-profile-mock.mjs +0 -5
- package/dist/chunks/search-categories-mock.cjs +0 -1
- package/dist/chunks/search-categories-mock.mjs +0 -1
- package/dist/chunks/search-products-mock.cjs +0 -1
- package/dist/chunks/search-products-mock.mjs +0 -1
- package/dist/shared/ecom-headless.BCjY03ea.mjs +0 -1
- package/dist/shared/ecom-headless.Cr34mwOt.cjs +0 -1
package/dist/api/index.d.ts
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
import { Blob } from 'buffer';
|
|
2
2
|
|
|
3
|
+
interface Category {
|
|
4
|
+
id: number;
|
|
5
|
+
name: string;
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
description?: string;
|
|
8
|
+
subcategories?: Category[];
|
|
9
|
+
url?: string;
|
|
10
|
+
imageUrl?: string;
|
|
11
|
+
originalImageUrl?: string;
|
|
12
|
+
thumbnail?: string;
|
|
13
|
+
orderBy?: number;
|
|
14
|
+
parentId?: number;
|
|
15
|
+
productCount?: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
3
18
|
/**
|
|
4
19
|
* Paginated response
|
|
5
20
|
* @template T - The type of the items in the response.
|
|
@@ -17,23 +32,7 @@ interface PaginatedResponse<T> {
|
|
|
17
32
|
items: T[];
|
|
18
33
|
}
|
|
19
34
|
|
|
20
|
-
type
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Configuration object for initializing the API client.
|
|
24
|
-
*
|
|
25
|
-
* @property {string} publicToken - The public access token for your store's API.
|
|
26
|
-
* This token is used to authenticate requests that do not require a private token, such as fetching product or category data.
|
|
27
|
-
* @property {string} [baseURL] - The base URL for the Ecwid API.
|
|
28
|
-
* Default to 'https://app.ecwid.com/api/v3/'. This can be overridden for testing or specific regional API endpoints.
|
|
29
|
-
* @property {string} [storeId] - The unique identifier for your Ecwid store. This ID is used to specify which store's data to access.
|
|
30
|
-
*/
|
|
31
|
-
interface ApiConfig {
|
|
32
|
-
publicToken: string;
|
|
33
|
-
storeId?: number;
|
|
34
|
-
baseURL?: string;
|
|
35
|
-
useMocks?: boolean;
|
|
36
|
-
}
|
|
35
|
+
type QueryParams = Record<string, string | number | boolean | undefined>;
|
|
37
36
|
|
|
38
37
|
declare enum SortBy {
|
|
39
38
|
RELEVANCE = "RELEVANCE",
|
|
@@ -48,29 +47,57 @@ declare enum SortBy {
|
|
|
48
47
|
UPDATED_TIME_DESC = "UPDATED_TIME_DESC"
|
|
49
48
|
}
|
|
50
49
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Response type for the searchCategories request.
|
|
52
|
+
* Based on: https://docs.ecwid.com/api-reference/rest-api/categories/search-categories#response-json
|
|
53
|
+
*/
|
|
54
|
+
type SearchCategoriesResponse = PaginatedResponse<Category>;
|
|
55
|
+
/**
|
|
56
|
+
* Parameters for the searchCategories request.
|
|
57
|
+
* Based on: https://docs.ecwid.com/api-reference/rest-api/categories/search-categories#query-params
|
|
58
|
+
*/
|
|
59
|
+
interface SearchCategoriesParams extends QueryParams {
|
|
60
|
+
keyword?: string;
|
|
61
|
+
parent?: number;
|
|
62
|
+
parentIds?: string;
|
|
63
|
+
withSubcategories?: boolean;
|
|
64
|
+
hidden_categories?: boolean;
|
|
65
|
+
offset?: number;
|
|
66
|
+
limit?: number;
|
|
67
|
+
lang?: string;
|
|
68
|
+
responseFields?: string;
|
|
64
69
|
}
|
|
65
70
|
|
|
66
|
-
/**
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Search categories in the store based on provided parameters.
|
|
73
|
+
*
|
|
74
|
+
* @param {SearchCategoriesParams} params - The parameters for the searchCategories request.
|
|
75
|
+
* @returns {Promise<SearchCategoriesResponse>} A promise that resolves to the categories search results.
|
|
76
|
+
*/
|
|
77
|
+
declare const searchCategories: (params?: SearchCategoriesParams) => Promise<SearchCategoriesResponse>;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The response from the downloadProductFile request.
|
|
81
|
+
* Based on: https://docs.ecwid.com/api-reference/rest-api/products/product-files/download-product-file#response-json
|
|
82
|
+
*/
|
|
83
|
+
type DownloadProductFileResponse = Blob;
|
|
84
|
+
/**
|
|
85
|
+
* The parameters for the downloadProductFile request.
|
|
86
|
+
* Based on: https://docs.ecwid.com/api-reference/rest-api/products/product-files/download-product-file#query-params
|
|
87
|
+
*/
|
|
88
|
+
interface DownloadProductFileParams extends QueryParams {
|
|
89
|
+
storeId?: number;
|
|
90
|
+
productId: number;
|
|
91
|
+
fileId: number;
|
|
72
92
|
}
|
|
73
93
|
|
|
94
|
+
/**
|
|
95
|
+
* Download a product file
|
|
96
|
+
* @param {DownloadProductFileParams} params - The parameters for the downloadProductFile request.
|
|
97
|
+
* @returns {Promise<DownloadProductFileResponse>} A promise that resolves to the download product file results.
|
|
98
|
+
*/
|
|
99
|
+
declare const downloadProductFile: (params: DownloadProductFileParams) => Promise<DownloadProductFileResponse>;
|
|
100
|
+
|
|
74
101
|
/** Product lowest price settings, typically for EU stores. */
|
|
75
102
|
interface LowestPriceSettings {
|
|
76
103
|
/** Defines if the lowest price is enabled for the product and shown on the storefront. */
|
|
@@ -89,62 +116,156 @@ interface LowestPriceSettings {
|
|
|
89
116
|
defaultDisplayedAutomaticLowestPriceFormatted?: string;
|
|
90
117
|
}
|
|
91
118
|
|
|
92
|
-
/** Represents a
|
|
93
|
-
interface
|
|
94
|
-
/**
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
textTranslated: Record<string, string>;
|
|
98
|
-
/** Value of the option's price markup. */
|
|
99
|
-
priceModifier: number;
|
|
100
|
-
/** Option markup calculation type (PERCENT or ABSOLUTE). */
|
|
101
|
-
priceModifierType: string;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/** Defines a product option, such as size or color, including its type, name, and available choices. */
|
|
105
|
-
interface ProductOption {
|
|
106
|
-
/** Option type that defines its functionality.
|
|
107
|
-
* One of: SELECT, RADIO, CHECKBOX, TEXTFIELD, TEXTAREA, DATE, FILES, SIZE, SWATCHES. */
|
|
108
|
-
type: string;
|
|
109
|
-
/** Product option name (e.g., Color or Size). */
|
|
119
|
+
/** Represents a product attribute and its value. */
|
|
120
|
+
interface ProductAttribute {
|
|
121
|
+
/** Internal attribute ID. */
|
|
122
|
+
id: number;
|
|
123
|
+
/** Attribute name visible on the storefront. */
|
|
110
124
|
name: string;
|
|
111
|
-
/** Available translations for
|
|
125
|
+
/** Available translations for the attribute name. */
|
|
112
126
|
nameTranslated: Record<string, string>;
|
|
113
|
-
/**
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
127
|
+
/** Value of the attribute for this product. */
|
|
128
|
+
value: string;
|
|
129
|
+
/** Available translations for the attribute value. */
|
|
130
|
+
valueTranslated: Record<string, string>;
|
|
131
|
+
/** Attribute type (e.g., CUSTOM, UPC, BRAND).
|
|
132
|
+
* One of: CUSTOM, UPC, BRAND, GENDER, AGE_GROUP, COLOR, SIZE, PRICE_PER_UNIT, UNITS_IN_PRODUCT. */
|
|
133
|
+
type: string;
|
|
134
|
+
/** Defines if an attribute is visible on a product page.
|
|
135
|
+
* One of: NOTSHOW, DESCR, PRICE. */
|
|
136
|
+
show: string;
|
|
121
137
|
}
|
|
122
138
|
|
|
123
|
-
/**
|
|
124
|
-
interface
|
|
125
|
-
/**
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
methodMarkup: number;
|
|
130
|
-
/** Flat rate cost for shipping the product. If set, shipping costs for it will not be calculated. */
|
|
131
|
-
flatRate: number;
|
|
132
|
-
/** IDs of shipping methods that need to be excluded from calculation when this product is in cart. */
|
|
133
|
-
disabledMethods: string[];
|
|
134
|
-
/** IDs of shipping methods which will only be shown when this product is in cart. */
|
|
135
|
-
enabledMethods: string[];
|
|
139
|
+
/** Represents a category a product belongs to, including its ID and enabled status. */
|
|
140
|
+
interface ProductCategory {
|
|
141
|
+
/** Internal category ID. */
|
|
142
|
+
id: number;
|
|
143
|
+
/** Defines if the category is enabled. */
|
|
144
|
+
enabled: boolean;
|
|
136
145
|
}
|
|
137
146
|
|
|
138
|
-
/**
|
|
139
|
-
interface
|
|
140
|
-
/**
|
|
141
|
-
|
|
142
|
-
/**
|
|
147
|
+
/** Represents a selected product option value that identifies a product variation. */
|
|
148
|
+
interface ProductCombinationOption {
|
|
149
|
+
/** Name of the selected option. */
|
|
150
|
+
name: string;
|
|
151
|
+
/** Available translations for the product option name. */
|
|
152
|
+
nameTranslated: Record<string, string>;
|
|
153
|
+
/** Value of the selected option. */
|
|
154
|
+
value: string;
|
|
155
|
+
/** Available translations for the product option value. */
|
|
156
|
+
valueTranslated: Record<string, string>;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** Product's dimensions for calculating shipping costs. */
|
|
160
|
+
interface ProductDimensions {
|
|
161
|
+
/** Length of a product for calculating shipping costs. */
|
|
162
|
+
length: number;
|
|
163
|
+
/** Width of a product for calculating shipping costs. */
|
|
143
164
|
width: number;
|
|
144
|
-
/** Height of
|
|
165
|
+
/** Height of a product for calculating shipping costs. */
|
|
145
166
|
height: number;
|
|
146
167
|
}
|
|
147
168
|
|
|
169
|
+
/** Represents the alt text for a product image, including translations. */
|
|
170
|
+
interface ProductImageAlt {
|
|
171
|
+
/** Image description for the "alt" HTML attribute of the image. */
|
|
172
|
+
main?: string;
|
|
173
|
+
/** Available translations for the "alt" text. */
|
|
174
|
+
translated: Record<string, string>;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** Represents a wholesale price tier for a product or variation. */
|
|
178
|
+
interface WholesalePrice {
|
|
179
|
+
/** Number of product items on this wholesale tier. */
|
|
180
|
+
quantity: number;
|
|
181
|
+
/** Product price on the tier. */
|
|
182
|
+
price: number;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/** Details about a product variation (combination of product options). */
|
|
186
|
+
interface ProductCombination {
|
|
187
|
+
/** Internal ID for the product variation. */
|
|
188
|
+
id: number;
|
|
189
|
+
/** Ordered variation number displayed in Ecwid admin. Starts with 1. */
|
|
190
|
+
combinationNumber: number;
|
|
191
|
+
/** Set of selected product option values that identify this variation. */
|
|
192
|
+
options: ProductCombinationOption[];
|
|
193
|
+
/** Variation SKU. If empty, inherits the base product's SKU. */
|
|
194
|
+
sku?: string;
|
|
195
|
+
/** Link to the variation image resized to fit 400x400px container. */
|
|
196
|
+
thumbnailUrl?: string;
|
|
197
|
+
/** Link to the variation image resized to fit 1200x1200px container. */
|
|
198
|
+
imageUrl?: string;
|
|
199
|
+
/** Link to the variation image resized to fit 160x160px container. */
|
|
200
|
+
smallThumbnailUrl?: string;
|
|
201
|
+
/** Link to the variation image resized to fit 800x800px container. */
|
|
202
|
+
hdThumbnailUrl?: string;
|
|
203
|
+
/** Link to the full-sized variation image. */
|
|
204
|
+
originalImageUrl?: string;
|
|
205
|
+
/** Number of variation items in stock. Not returned if unlimited is true. */
|
|
206
|
+
quantity?: number;
|
|
207
|
+
/** Defines if the variation has unlimited stock. */
|
|
208
|
+
unlimited?: boolean;
|
|
209
|
+
/** Base variation price without any modifiers. */
|
|
210
|
+
price?: number;
|
|
211
|
+
/** Sorted list of wholesale price tiers specific to the variation. */
|
|
212
|
+
wholesalePrices?: WholesalePrice[];
|
|
213
|
+
/** Variation's weight for calculating shipping costs. */
|
|
214
|
+
weight?: number;
|
|
215
|
+
/** Minimum amount of variation in stock to trigger "low stock" notification. */
|
|
216
|
+
warningLimit?: number;
|
|
217
|
+
/** List of variation attributes and their values. */
|
|
218
|
+
attributes?: ProductAttribute[];
|
|
219
|
+
/** Pre-sale price for the variation. */
|
|
220
|
+
compareToPrice?: number;
|
|
221
|
+
/** Sets minimum product purchase quantity. Default is null. */
|
|
222
|
+
minPurchaseQuantity?: number;
|
|
223
|
+
/** Sets maximum product purchase quantity. Default is null. */
|
|
224
|
+
maxPurchaseQuantity?: number;
|
|
225
|
+
/** Defines visibility/pre-order behavior when out-of-stock. One of: SHOW, HIDE, ALLOW_PREORDER. */
|
|
226
|
+
outOfStockVisibilityBehaviour?: string;
|
|
227
|
+
/** Variation price for logged out customers with default location. Includes taxes. */
|
|
228
|
+
defaultDisplayedPrice?: number;
|
|
229
|
+
/** Formatted variant of defaultDisplayedPrice. */
|
|
230
|
+
defaultDisplayedPriceFormatted?: string;
|
|
231
|
+
/** Variation's lowest price for EU store. */
|
|
232
|
+
lowestPrice?: number;
|
|
233
|
+
/** Variation's lowest price for logged out customers with default location. Includes taxes. */
|
|
234
|
+
defaultDisplayedLowestPrice?: number;
|
|
235
|
+
/** Formatted variant of defaultDisplayedLowestPrice. */
|
|
236
|
+
defaultDisplayedLowestPriceFormatted?: string;
|
|
237
|
+
/** Variation's lowest price settings. Defines if lowest price is enabled. */
|
|
238
|
+
lowestPriceSettings?: LowestPriceSettings;
|
|
239
|
+
/** Variation's dimensions. */
|
|
240
|
+
dimensions?: ProductDimensions;
|
|
241
|
+
/** Variation volume for calculations shipping costs, fractional number, 0 by default. */
|
|
242
|
+
volume?: number;
|
|
243
|
+
/** Variation image description for the "alt" HTML attribute and its translations. */
|
|
244
|
+
alt?: ProductImageAlt;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/** Stats showing how many times the product was added to favorites on the storefront. */
|
|
248
|
+
interface ProductFavorites {
|
|
249
|
+
/** Total count the product was added to favorites on the storefront. */
|
|
250
|
+
count: number;
|
|
251
|
+
/** The number of likes visible on the storefront. May differ from count if it exceeds 1000 (e.g., 1K). */
|
|
252
|
+
displayedCount: string;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** Details about a downloadable file attached to the product. */
|
|
256
|
+
interface ProductFile {
|
|
257
|
+
/** Internal ID of the file attached to the product. */
|
|
258
|
+
id: number;
|
|
259
|
+
/** File name visible to clients. */
|
|
260
|
+
name: string;
|
|
261
|
+
/** File description visible to clients. */
|
|
262
|
+
description: string;
|
|
263
|
+
/** File size in bytes (64-bit integer). */
|
|
264
|
+
size: number;
|
|
265
|
+
/** Direct link to the file. Important: to download, append API access token. */
|
|
266
|
+
adminUrl: string;
|
|
267
|
+
}
|
|
268
|
+
|
|
148
269
|
interface ProductColor {
|
|
149
270
|
/** Red channel (from 0 to 255, RGB). */
|
|
150
271
|
red: number;
|
|
@@ -189,12 +310,14 @@ interface ProductGalleryImage {
|
|
|
189
310
|
borderInfo: ProductBorderInfo;
|
|
190
311
|
}
|
|
191
312
|
|
|
192
|
-
/**
|
|
193
|
-
interface
|
|
194
|
-
/**
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
|
|
313
|
+
/** Details about a product image, typically the main image. */
|
|
314
|
+
interface ProductImage {
|
|
315
|
+
/** Link to the full-size product image. */
|
|
316
|
+
url: string;
|
|
317
|
+
/** Width of the full-size product image in px. */
|
|
318
|
+
width: number;
|
|
319
|
+
/** Height of the full-size product image in px. */
|
|
320
|
+
height: number;
|
|
198
321
|
}
|
|
199
322
|
|
|
200
323
|
/** Details about a product image within the media collection. */
|
|
@@ -253,54 +376,35 @@ interface ProductMedia {
|
|
|
253
376
|
videos: ProductMediaVideo[];
|
|
254
377
|
}
|
|
255
378
|
|
|
256
|
-
/** Represents a
|
|
257
|
-
interface
|
|
258
|
-
/**
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
|
|
266
|
-
/** Total count the product was added to favorites on the storefront. */
|
|
267
|
-
count: number;
|
|
268
|
-
/** The number of likes visible on the storefront. May differ from count if it exceeds 1000 (e.g., 1K). */
|
|
269
|
-
displayedCount: string;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
/** Represents a product attribute and its value. */
|
|
273
|
-
interface ProductAttribute {
|
|
274
|
-
/** Internal attribute ID. */
|
|
275
|
-
id: number;
|
|
276
|
-
/** Attribute name visible on the storefront. */
|
|
277
|
-
name: string;
|
|
278
|
-
/** Available translations for the attribute name. */
|
|
279
|
-
nameTranslated: Record<string, string>;
|
|
280
|
-
/** Value of the attribute for this product. */
|
|
281
|
-
value: string;
|
|
282
|
-
/** Available translations for the attribute value. */
|
|
283
|
-
valueTranslated: Record<string, string>;
|
|
284
|
-
/** Attribute type (e.g., CUSTOM, UPC, BRAND).
|
|
285
|
-
* One of: CUSTOM, UPC, BRAND, GENDER, AGE_GROUP, COLOR, SIZE, PRICE_PER_UNIT, UNITS_IN_PRODUCT. */
|
|
286
|
-
type: string;
|
|
287
|
-
/** Defines if an attribute is visible on a product page.
|
|
288
|
-
* One of: NOTSHOW, DESCR, PRICE. */
|
|
289
|
-
show: string;
|
|
379
|
+
/** Represents a choice for a product option, detailing its text and price modification. */
|
|
380
|
+
interface ProductOptionChoice {
|
|
381
|
+
/** Text displayed for the option choice. */
|
|
382
|
+
text: string;
|
|
383
|
+
/** Available translations for the choice's text field. */
|
|
384
|
+
textTranslated: Record<string, string>;
|
|
385
|
+
/** Value of the option's price markup. */
|
|
386
|
+
priceModifier: number;
|
|
387
|
+
/** Option markup calculation type (PERCENT or ABSOLUTE). */
|
|
388
|
+
priceModifierType: string;
|
|
290
389
|
}
|
|
291
390
|
|
|
292
|
-
/**
|
|
293
|
-
interface
|
|
294
|
-
/**
|
|
295
|
-
|
|
296
|
-
|
|
391
|
+
/** Defines a product option, such as size or color, including its type, name, and available choices. */
|
|
392
|
+
interface ProductOption {
|
|
393
|
+
/** Option type that defines its functionality.
|
|
394
|
+
* One of: SELECT, RADIO, CHECKBOX, TEXTFIELD, TEXTAREA, DATE, FILES, SIZE, SWATCHES. */
|
|
395
|
+
type: string;
|
|
396
|
+
/** Product option name (e.g., Color or Size). */
|
|
297
397
|
name: string;
|
|
298
|
-
/**
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
398
|
+
/** Available translations for product option name. */
|
|
399
|
+
nameTranslated: Record<string, string>;
|
|
400
|
+
/** List of available option choices for users.
|
|
401
|
+
* Only works for SELECT, CHECKBOX, RADIO, SIZE, or SWATCHES option types. */
|
|
402
|
+
choices?: ProductOptionChoice[];
|
|
403
|
+
/** Index of the option's default selection. Can be null (no default option), otherwise starts with 0.
|
|
404
|
+
* Only works for SELECT, CHECKBOX, RADIO, SIZE, or SWATCHES option types. */
|
|
405
|
+
defaultChoice?: number;
|
|
406
|
+
/** Defines if this option is required to add product to the cart. */
|
|
407
|
+
required?: boolean;
|
|
304
408
|
}
|
|
305
409
|
|
|
306
410
|
/** Describes the "N random related products from a category" option for related products. */
|
|
@@ -321,88 +425,19 @@ interface ProductRelatedProducts {
|
|
|
321
425
|
relatedCategory: ProductRelatedCategory;
|
|
322
426
|
}
|
|
323
427
|
|
|
324
|
-
/**
|
|
325
|
-
interface
|
|
326
|
-
/**
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
name: string;
|
|
338
|
-
/** Available translations for the product option name. */
|
|
339
|
-
nameTranslated: Record<string, string>;
|
|
340
|
-
/** Value of the selected option. */
|
|
341
|
-
value: string;
|
|
342
|
-
/** Available translations for the product option value. */
|
|
343
|
-
valueTranslated: Record<string, string>;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
/** Details about a product variation (combination of product options). */
|
|
347
|
-
interface ProductCombination {
|
|
348
|
-
/** Internal ID for the product variation. */
|
|
349
|
-
id: number;
|
|
350
|
-
/** Ordered variation number displayed in Ecwid admin. Starts with 1. */
|
|
351
|
-
combinationNumber: number;
|
|
352
|
-
/** Set of selected product option values that identify this variation. */
|
|
353
|
-
options: ProductCombinationOption[];
|
|
354
|
-
/** Variation SKU. If empty, inherits the base product's SKU. */
|
|
355
|
-
sku?: string;
|
|
356
|
-
/** Link to the variation image resized to fit 400x400px container. */
|
|
357
|
-
thumbnailUrl?: string;
|
|
358
|
-
/** Link to the variation image resized to fit 1200x1200px container. */
|
|
359
|
-
imageUrl?: string;
|
|
360
|
-
/** Link to the variation image resized to fit 160x160px container. */
|
|
361
|
-
smallThumbnailUrl?: string;
|
|
362
|
-
/** Link to the variation image resized to fit 800x800px container. */
|
|
363
|
-
hdThumbnailUrl?: string;
|
|
364
|
-
/** Link to the full-sized variation image. */
|
|
365
|
-
originalImageUrl?: string;
|
|
366
|
-
/** Number of variation items in stock. Not returned if unlimited is true. */
|
|
367
|
-
quantity?: number;
|
|
368
|
-
/** Defines if the variation has unlimited stock. */
|
|
369
|
-
unlimited?: boolean;
|
|
370
|
-
/** Base variation price without any modifiers. */
|
|
371
|
-
price?: number;
|
|
372
|
-
/** Sorted list of wholesale price tiers specific to the variation. */
|
|
373
|
-
wholesalePrices?: WholesalePrice[];
|
|
374
|
-
/** Variation's weight for calculating shipping costs. */
|
|
375
|
-
weight?: number;
|
|
376
|
-
/** Minimum amount of variation in stock to trigger "low stock" notification. */
|
|
377
|
-
warningLimit?: number;
|
|
378
|
-
/** List of variation attributes and their values. */
|
|
379
|
-
attributes?: ProductAttribute[];
|
|
380
|
-
/** Pre-sale price for the variation. */
|
|
381
|
-
compareToPrice?: number;
|
|
382
|
-
/** Sets minimum product purchase quantity. Default is null. */
|
|
383
|
-
minPurchaseQuantity?: number;
|
|
384
|
-
/** Sets maximum product purchase quantity. Default is null. */
|
|
385
|
-
maxPurchaseQuantity?: number;
|
|
386
|
-
/** Defines visibility/pre-order behavior when out-of-stock. One of: SHOW, HIDE, ALLOW_PREORDER. */
|
|
387
|
-
outOfStockVisibilityBehaviour?: string;
|
|
388
|
-
/** Variation price for logged out customers with default location. Includes taxes. */
|
|
389
|
-
defaultDisplayedPrice?: number;
|
|
390
|
-
/** Formatted variant of defaultDisplayedPrice. */
|
|
391
|
-
defaultDisplayedPriceFormatted?: string;
|
|
392
|
-
/** Variation's lowest price for EU store. */
|
|
393
|
-
lowestPrice?: number;
|
|
394
|
-
/** Variation's lowest price for logged out customers with default location. Includes taxes. */
|
|
395
|
-
defaultDisplayedLowestPrice?: number;
|
|
396
|
-
/** Formatted variant of defaultDisplayedLowestPrice. */
|
|
397
|
-
defaultDisplayedLowestPriceFormatted?: string;
|
|
398
|
-
/** Variation's lowest price settings. Defines if lowest price is enabled. */
|
|
399
|
-
lowestPriceSettings?: LowestPriceSettings;
|
|
400
|
-
/** Variation's dimensions. */
|
|
401
|
-
dimensions?: ProductDimensions;
|
|
402
|
-
/** Variation volume for calculations shipping costs, fractional number, 0 by default. */
|
|
403
|
-
volume?: number;
|
|
404
|
-
/** Variation image description for the "alt" HTML attribute and its translations. */
|
|
405
|
-
alt?: ProductImageAlt;
|
|
428
|
+
/** Shipping settings specific to the product. */
|
|
429
|
+
interface ProductShipping {
|
|
430
|
+
/** Type of shipping calculation.
|
|
431
|
+
* One of: "GLOBAL_METHODS", "SELECTED_METHODS", "FLAT_RATE", "FREE_SHIPPING". */
|
|
432
|
+
type: string;
|
|
433
|
+
/** Additional product shipping cost added to any shipping methods. */
|
|
434
|
+
methodMarkup: number;
|
|
435
|
+
/** Flat rate cost for shipping the product. If set, shipping costs for it will not be calculated. */
|
|
436
|
+
flatRate: number;
|
|
437
|
+
/** IDs of shipping methods that need to be excluded from calculation when this product is in cart. */
|
|
438
|
+
disabledMethods: string[];
|
|
439
|
+
/** IDs of shipping methods which will only be shown when this product is in cart. */
|
|
440
|
+
enabledMethods: string[];
|
|
406
441
|
}
|
|
407
442
|
|
|
408
443
|
/** Internal details on recurring charges for product subscriptions. */
|
|
@@ -445,6 +480,18 @@ interface ProductSubscriptionSettings {
|
|
|
445
480
|
signUpFeeFormatted?: string;
|
|
446
481
|
}
|
|
447
482
|
|
|
483
|
+
/** Detailed information about product's taxes. */
|
|
484
|
+
interface ProductTax {
|
|
485
|
+
/** Defines if taxes can be applied to the product. */
|
|
486
|
+
taxable: boolean;
|
|
487
|
+
/** Default tax rate (%) for including into product price. It's a sum of all enabled taxes included in product price for the store location. Read only. */
|
|
488
|
+
defaultLocationIncludedTaxRate: number;
|
|
489
|
+
/** List of internal IDs for manual taxes. Empty if no manual taxes are enabled or automatic taxes are enabled. */
|
|
490
|
+
enabledManualTaxes: number[];
|
|
491
|
+
/** Tax class code for the product that determines the taxability of the products for a certain region. */
|
|
492
|
+
taxClassCode: string;
|
|
493
|
+
}
|
|
494
|
+
|
|
448
495
|
/** Represents a product in an Ecwid store. */
|
|
449
496
|
interface Product {
|
|
450
497
|
/** Internal unique product ID. */
|
|
@@ -619,6 +666,32 @@ interface Product {
|
|
|
619
666
|
reviewsModerated?: number;
|
|
620
667
|
}
|
|
621
668
|
|
|
669
|
+
/**
|
|
670
|
+
* Response type for the getProduct request.
|
|
671
|
+
* Based on: https://docs.ecwid.com/api-reference/rest-api/products/get-product#response-json
|
|
672
|
+
*/
|
|
673
|
+
type GetProductResponse = Product;
|
|
674
|
+
/**
|
|
675
|
+
* Parameters for the getProduct request.
|
|
676
|
+
* Based on: https://docs.ecwid.com/api-reference/rest-api/products/get-product#path-params
|
|
677
|
+
*/
|
|
678
|
+
interface GetProductParams extends QueryParams {
|
|
679
|
+
productId: number;
|
|
680
|
+
baseUrl?: string;
|
|
681
|
+
cleanUrls?: boolean;
|
|
682
|
+
slugsWithoutIds?: boolean;
|
|
683
|
+
lang?: string;
|
|
684
|
+
responseFields?: string;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* Fetches a single product by its ID.
|
|
689
|
+
*
|
|
690
|
+
* @param {GetProductParams} params - The parameters for the getProduct request.
|
|
691
|
+
* @returns {Promise<GetProductResponse>} A promise that resolves to the product details.
|
|
692
|
+
*/
|
|
693
|
+
declare const getProduct: (params: GetProductParams) => Promise<GetProductResponse>;
|
|
694
|
+
|
|
622
695
|
/**
|
|
623
696
|
* Response type for the searchProducts request.
|
|
624
697
|
* Based on: https://docs.ecwid.com/api-reference/rest-api/products/search-products#response-json
|
|
@@ -628,7 +701,7 @@ type SearchProductsResponse = PaginatedResponse<Product>;
|
|
|
628
701
|
* Parameters for the searchProducts request.
|
|
629
702
|
* Based on: https://docs.ecwid.com/api-reference/rest-api/products/search-products#query-params
|
|
630
703
|
*/
|
|
631
|
-
interface SearchProductsParams extends
|
|
704
|
+
interface SearchProductsParams extends QueryParams {
|
|
632
705
|
/** Ecwid store ID. */
|
|
633
706
|
storeId?: number;
|
|
634
707
|
/** Internal IDs of Ecwid products separated by a comma.
|
|
@@ -760,98 +833,6 @@ interface SearchProductsParams extends SearchParams {
|
|
|
760
833
|
*/
|
|
761
834
|
declare const searchProducts: (params?: SearchProductsParams) => Promise<SearchProductsResponse>;
|
|
762
835
|
|
|
763
|
-
/**
|
|
764
|
-
* Response type for the getProduct request.
|
|
765
|
-
* Based on: https://docs.ecwid.com/api-reference/rest-api/products/get-product#response-json
|
|
766
|
-
*/
|
|
767
|
-
type GetProductResponse = Product;
|
|
768
|
-
/**
|
|
769
|
-
* Parameters for the getProduct request.
|
|
770
|
-
* Based on: https://docs.ecwid.com/api-reference/rest-api/products/get-product#path-params
|
|
771
|
-
*/
|
|
772
|
-
interface GetProductParams {
|
|
773
|
-
productId: number;
|
|
774
|
-
baseUrl?: string;
|
|
775
|
-
cleanUrls?: boolean;
|
|
776
|
-
slugsWithoutIds?: boolean;
|
|
777
|
-
lang?: string;
|
|
778
|
-
responseFields?: string;
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
/**
|
|
782
|
-
* Fetches a single product by its ID.
|
|
783
|
-
*
|
|
784
|
-
* @param {GetProductParams} params - The parameters for the getProduct request.
|
|
785
|
-
* @returns {Promise<GetProductResponse>} A promise that resolves to the product details.
|
|
786
|
-
*/
|
|
787
|
-
declare const getProduct: (params: GetProductParams) => Promise<GetProductResponse>;
|
|
788
|
-
|
|
789
|
-
/**
|
|
790
|
-
* The response from the downloadProductFile request.
|
|
791
|
-
* Based on: https://docs.ecwid.com/api-reference/rest-api/products/product-files/download-product-file#response-json
|
|
792
|
-
*/
|
|
793
|
-
type DownloadProductFileResponse = Blob;
|
|
794
|
-
/**
|
|
795
|
-
* The parameters for the downloadProductFile request.
|
|
796
|
-
* Based on: https://docs.ecwid.com/api-reference/rest-api/products/product-files/download-product-file#query-params
|
|
797
|
-
*/
|
|
798
|
-
interface DownloadProductFileParams {
|
|
799
|
-
storeId?: number;
|
|
800
|
-
productId: number;
|
|
801
|
-
fileId: number;
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
/**
|
|
805
|
-
* Download a product file
|
|
806
|
-
* @param {DownloadProductFileParams} params - The parameters for the downloadProductFile request.
|
|
807
|
-
* @returns {Promise<DownloadProductFileResponse>} A promise that resolves to the download product file results.
|
|
808
|
-
*/
|
|
809
|
-
declare const downloadProductFile: (params: DownloadProductFileParams) => Promise<DownloadProductFileResponse>;
|
|
810
|
-
|
|
811
|
-
interface Category {
|
|
812
|
-
id: number;
|
|
813
|
-
name: string;
|
|
814
|
-
enabled: boolean;
|
|
815
|
-
description?: string;
|
|
816
|
-
subcategories?: Category[];
|
|
817
|
-
url?: string;
|
|
818
|
-
imageUrl?: string;
|
|
819
|
-
originalImageUrl?: string;
|
|
820
|
-
thumbnail?: string;
|
|
821
|
-
orderBy?: number;
|
|
822
|
-
parentId?: number;
|
|
823
|
-
productCount?: number;
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
/**
|
|
827
|
-
* Response type for the searchCategories request.
|
|
828
|
-
* Based on: https://docs.ecwid.com/api-reference/rest-api/categories/search-categories#response-json
|
|
829
|
-
*/
|
|
830
|
-
type SearchCategoriesResponse = PaginatedResponse<Category>;
|
|
831
|
-
/**
|
|
832
|
-
* Parameters for the searchCategories request.
|
|
833
|
-
* Based on: https://docs.ecwid.com/api-reference/rest-api/categories/search-categories#query-params
|
|
834
|
-
*/
|
|
835
|
-
interface SearchCategoriesParams {
|
|
836
|
-
keyword?: string;
|
|
837
|
-
parent?: number;
|
|
838
|
-
parentIds?: string;
|
|
839
|
-
withSubcategories?: boolean;
|
|
840
|
-
hidden_categories?: boolean;
|
|
841
|
-
offset?: number;
|
|
842
|
-
limit?: number;
|
|
843
|
-
lang?: string;
|
|
844
|
-
responseFields?: string;
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
/**
|
|
848
|
-
* Search categories in the store based on provided parameters.
|
|
849
|
-
*
|
|
850
|
-
* @param {SearchCategoriesParams} params - The parameters for the searchCategories request.
|
|
851
|
-
* @returns {Promise<SearchCategoriesResponse>} A promise that resolves to the categories search results.
|
|
852
|
-
*/
|
|
853
|
-
declare const searchCategories: (params?: SearchCategoriesParams) => Promise<SearchCategoriesResponse>;
|
|
854
|
-
|
|
855
836
|
interface AccountBilling {
|
|
856
837
|
planName: string;
|
|
857
838
|
subscriptionFee: number;
|
|
@@ -1307,7 +1288,7 @@ type GetStoreProfileResponse = StoreProfile;
|
|
|
1307
1288
|
* Parameters for the getStoreProfile request.
|
|
1308
1289
|
* Based on: https://docs.ecwid.com/api-reference/rest-api/store-profile/get-store-profile#query-params
|
|
1309
1290
|
*/
|
|
1310
|
-
interface GetStoreProfileParams {
|
|
1291
|
+
interface GetStoreProfileParams extends QueryParams {
|
|
1311
1292
|
storeId?: number;
|
|
1312
1293
|
/**
|
|
1313
1294
|
* Set true to receive additional store profile data including account/billing data.
|
|
@@ -1335,5 +1316,5 @@ interface GetStoreProfileParams {
|
|
|
1335
1316
|
*/
|
|
1336
1317
|
declare const getStoreProfile: (params?: GetStoreProfileParams) => Promise<GetStoreProfileResponse>;
|
|
1337
1318
|
|
|
1338
|
-
export { downloadProductFile,
|
|
1319
|
+
export { downloadProductFile, getProduct, getStoreProfile, searchCategories, searchProducts };
|
|
1339
1320
|
export type { Account, AccountBilling, Address, AddressFormat, ApplePay, Category, Company, CurrencyFormat, DesignSettings, DestinationZone, DownloadProductFileParams, DownloadProductFileResponse, EstimatedShippingTimeAtCheckoutSettings, FeatureToggle, FilterSection, FlatRate, FormatsAndUnits, GeneralInfo, GetProductParams, GetProductResponse, GetStoreProfileParams, GetStoreProfileResponse, HandlingFee, InstructionsForCustomer, Languages, LegalPage, LegalPagesSettings, LowestPriceSettings, MailNotifications, NotificationSetting, OrderInvoiceSettings, Payment, PaymentOption, PhoneNotifications, Product, ProductAttribute, ProductBorderInfo, ProductCategory, ProductColor, ProductCombination, ProductCombinationOption, ProductDimensions, ProductFavorites, ProductFile, ProductFiltersSettings, ProductGalleryImage, ProductImage, ProductImageAlt, ProductMedia, ProductMediaImage, ProductMediaVideo, ProductOption, ProductOptionChoice, ProductRecurringChargeSettings, ProductRelatedCategory, ProductRelatedProducts, ProductShipping, ProductSubscriptionSettings, ProductTax, RegistrationAnswers, SalePrice, SearchCategoriesParams, SearchCategoriesResponse, SearchProductsParams, SearchProductsResponse, Shipping, ShippingOption, ShippingOrigin, ShippingSettings, ShippingZone, SocialLink, SocialLinksSettings, StarterSite, StoreProfile, StoreSettings, Tax, TaxInvoiceSettings, TaxSettings, TipsSettings, WholesalePrice, Zone };
|