@jay-framework/wix-stores 0.15.1 → 0.15.5
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 +157 -96
- package/dist/actions/get-variant-stock.jay-action +7 -0
- package/dist/actions/search-products.jay-action +12 -0
- package/dist/contracts/category-page.jay-contract.d.ts +10 -1
- package/dist/contracts/product-card.jay-contract +8 -2
- package/dist/contracts/product-card.jay-contract.d.ts +17 -4
- package/dist/contracts/product-options.jay-contract +0 -5
- package/dist/contracts/product-options.jay-contract.d.ts +1 -2
- package/dist/contracts/product-search.jay-contract +134 -1
- package/dist/contracts/product-search.jay-contract.d.ts +92 -4
- package/dist/index.client.js +276 -24
- package/dist/index.d.ts +230 -149
- package/dist/index.js +613 -156
- package/package.json +18 -16
- package/plugin.yaml +2 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CartState } from '@jay-framework/wix-cart';
|
|
2
2
|
export { AddToCartOptions, CartIndicatorState, CartLineItem, CartState, CartSummary, WIX_CART_CONTEXT, WIX_CART_SERVICE, WixCartContext, WixCartService, cartIndicator, cartPage, provideWixCartContext, provideWixCartService } from '@jay-framework/wix-cart';
|
|
3
3
|
import * as _jay_framework_fullstack_component from '@jay-framework/fullstack-component';
|
|
4
4
|
import { UrlParams, Signals, PageProps } from '@jay-framework/fullstack-component';
|
|
@@ -6,14 +6,15 @@ import * as _jay_framework_component from '@jay-framework/component';
|
|
|
6
6
|
import * as _jay_framework_runtime from '@jay-framework/runtime';
|
|
7
7
|
import { HTMLElementCollectionProxy, HTMLElementProxy } from '@jay-framework/runtime';
|
|
8
8
|
import { WixClient } from '@wix/sdk';
|
|
9
|
-
import { productsV3, inventoryItemsV3 } from '@wix/stores';
|
|
10
|
-
import { categories } from '@wix/categories';
|
|
11
9
|
import { BuildDescriptors } from '@wix/sdk-types';
|
|
10
|
+
import { productsV3, inventoryItemsV3, customizationsV3 } from '@wix/stores';
|
|
11
|
+
import { categories } from '@wix/categories';
|
|
12
|
+
import { Customization } from '@wix/auto_sdk_stores_customizations-v-3';
|
|
12
13
|
import { Getter } from '@jay-framework/reactive';
|
|
13
14
|
import { OptionChoice } from '@wix/auto_sdk_stores_products-v-3';
|
|
14
15
|
import { PluginSetupContext, PluginSetupResult, PluginReferencesContext, PluginReferencesResult } from '@jay-framework/stack-server-runtime';
|
|
15
16
|
|
|
16
|
-
declare enum OptionRenderType$
|
|
17
|
+
declare enum OptionRenderType$2 {
|
|
17
18
|
TEXT_CHOICES,
|
|
18
19
|
COLOR_SWATCH_CHOICES
|
|
19
20
|
}
|
|
@@ -29,14 +30,13 @@ interface ChoiceOfProductOptionsViewState {
|
|
|
29
30
|
choiceType: ChoiceType$1,
|
|
30
31
|
colorCode: string,
|
|
31
32
|
inStock: boolean,
|
|
32
|
-
variantId: string,
|
|
33
33
|
isSelected: boolean
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
interface ProductOptionsViewState {
|
|
37
37
|
_id: string,
|
|
38
38
|
name: string,
|
|
39
|
-
optionRenderType: OptionRenderType$
|
|
39
|
+
optionRenderType: OptionRenderType$2,
|
|
40
40
|
choices: Array<ChoiceOfProductOptionsViewState>
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -100,6 +100,7 @@ declare enum ProductType$1 {
|
|
|
100
100
|
declare enum QuickAddType {
|
|
101
101
|
SIMPLE,
|
|
102
102
|
SINGLE_OPTION,
|
|
103
|
+
COLOR_AND_TEXT_OPTIONS,
|
|
103
104
|
NEEDS_CONFIGURATION
|
|
104
105
|
}
|
|
105
106
|
|
|
@@ -121,7 +122,8 @@ interface ProductCardViewState {
|
|
|
121
122
|
productType: ProductType$1,
|
|
122
123
|
isAddingToCart: boolean,
|
|
123
124
|
quickAddType: QuickAddType,
|
|
124
|
-
quickOption: ProductOptionsViewState
|
|
125
|
+
quickOption: ProductOptionsViewState,
|
|
126
|
+
secondQuickOption: ProductOptionsViewState
|
|
125
127
|
}
|
|
126
128
|
|
|
127
129
|
|
|
@@ -129,7 +131,8 @@ interface ProductCardRepeatedRefs {
|
|
|
129
131
|
productLink: HTMLElementCollectionProxy<ProductCardViewState, HTMLAnchorElement>,
|
|
130
132
|
addToCartButton: HTMLElementCollectionProxy<ProductCardViewState, HTMLButtonElement>,
|
|
131
133
|
viewOptionsButton: HTMLElementCollectionProxy<ProductCardViewState, HTMLButtonElement>,
|
|
132
|
-
quickOption: ProductOptionsRepeatedRefs
|
|
134
|
+
quickOption: ProductOptionsRepeatedRefs,
|
|
135
|
+
secondQuickOption: ProductOptionsRepeatedRefs
|
|
133
136
|
}
|
|
134
137
|
|
|
135
138
|
interface RangeOfPriceRangeOfFilterOfProductSearchViewState {
|
|
@@ -153,17 +156,40 @@ interface CategoryOfCategoryFilterOfFilterOfProductSearchViewState {
|
|
|
153
156
|
categoryId: string,
|
|
154
157
|
categoryName: string,
|
|
155
158
|
categorySlug: string,
|
|
156
|
-
isSelected: boolean
|
|
159
|
+
isSelected: boolean,
|
|
160
|
+
categoryUrl: string
|
|
157
161
|
}
|
|
158
162
|
|
|
159
163
|
interface CategoryFilterOfFilterOfProductSearchViewState {
|
|
160
164
|
categories: Array<CategoryOfCategoryFilterOfFilterOfProductSearchViewState>
|
|
161
165
|
}
|
|
162
166
|
|
|
167
|
+
declare enum OptionRenderType$1 {
|
|
168
|
+
TEXT_CHOICES,
|
|
169
|
+
SWATCH_CHOICES
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
interface ChoiceOfOptionFilterOfFilterOfProductSearchViewState {
|
|
173
|
+
choiceId: string,
|
|
174
|
+
choiceName: string,
|
|
175
|
+
colorCode: string,
|
|
176
|
+
productCount: number,
|
|
177
|
+
isSelected: boolean,
|
|
178
|
+
isDisabled: boolean
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
interface OptionFilterOfFilterOfProductSearchViewState {
|
|
182
|
+
optionId: string,
|
|
183
|
+
optionName: string,
|
|
184
|
+
optionRenderType: OptionRenderType$1,
|
|
185
|
+
choices: Array<ChoiceOfOptionFilterOfFilterOfProductSearchViewState>
|
|
186
|
+
}
|
|
187
|
+
|
|
163
188
|
interface FilterOfProductSearchViewState {
|
|
164
189
|
priceRange: PriceRangeOfFilterOfProductSearchViewState,
|
|
165
190
|
categoryFilter: CategoryFilterOfFilterOfProductSearchViewState,
|
|
166
|
-
inStockOnly: boolean
|
|
191
|
+
inStockOnly: boolean,
|
|
192
|
+
optionFilters: Array<OptionFilterOfFilterOfProductSearchViewState>
|
|
167
193
|
}
|
|
168
194
|
|
|
169
195
|
declare enum CurrentSort {
|
|
@@ -184,6 +210,57 @@ interface SuggestionOfProductSearchViewState {
|
|
|
184
210
|
suggestionText: string
|
|
185
211
|
}
|
|
186
212
|
|
|
213
|
+
interface BreadcrumbOfCategoryHeaderOfProductSearchViewState {
|
|
214
|
+
categoryId: string,
|
|
215
|
+
name: string,
|
|
216
|
+
slug: string,
|
|
217
|
+
url: string
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
interface PropOfTagOfSeoDatumOfCategoryHeaderOfProductSearchViewState {
|
|
221
|
+
key: string,
|
|
222
|
+
value: string
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
interface MetaOfTagOfSeoDatumOfCategoryHeaderOfProductSearchViewState {
|
|
226
|
+
key: string,
|
|
227
|
+
value: string
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
interface TagOfSeoDatumOfCategoryHeaderOfProductSearchViewState {
|
|
231
|
+
position: string,
|
|
232
|
+
type: string,
|
|
233
|
+
props: Array<PropOfTagOfSeoDatumOfCategoryHeaderOfProductSearchViewState>,
|
|
234
|
+
meta: Array<MetaOfTagOfSeoDatumOfCategoryHeaderOfProductSearchViewState>,
|
|
235
|
+
children: string
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
interface KeywordOfSettingOfSeoDatumOfCategoryHeaderOfProductSearchViewState {
|
|
239
|
+
term: string,
|
|
240
|
+
isMain: boolean,
|
|
241
|
+
origin: string
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
interface SettingOfSeoDatumOfCategoryHeaderOfProductSearchViewState {
|
|
245
|
+
preventAutoRedirect: boolean,
|
|
246
|
+
keywords: Array<KeywordOfSettingOfSeoDatumOfCategoryHeaderOfProductSearchViewState>
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
interface SeoDatumOfCategoryHeaderOfProductSearchViewState {
|
|
250
|
+
tags: Array<TagOfSeoDatumOfCategoryHeaderOfProductSearchViewState>,
|
|
251
|
+
settings: SettingOfSeoDatumOfCategoryHeaderOfProductSearchViewState
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
interface CategoryHeaderOfProductSearchViewState {
|
|
255
|
+
name: string,
|
|
256
|
+
description: string,
|
|
257
|
+
imageUrl: string,
|
|
258
|
+
hasImage: boolean,
|
|
259
|
+
productCount: number,
|
|
260
|
+
breadcrumbs: Array<BreadcrumbOfCategoryHeaderOfProductSearchViewState>,
|
|
261
|
+
seoData: SeoDatumOfCategoryHeaderOfProductSearchViewState
|
|
262
|
+
}
|
|
263
|
+
|
|
187
264
|
interface ProductSearchViewState {
|
|
188
265
|
searchExpression: string,
|
|
189
266
|
searchFields: string,
|
|
@@ -200,15 +277,17 @@ interface ProductSearchViewState {
|
|
|
200
277
|
loadedCount: number,
|
|
201
278
|
totalCount: number,
|
|
202
279
|
hasSuggestions: boolean,
|
|
203
|
-
suggestions: Array<SuggestionOfProductSearchViewState
|
|
280
|
+
suggestions: Array<SuggestionOfProductSearchViewState>,
|
|
281
|
+
categoryHeader: CategoryHeaderOfProductSearchViewState
|
|
204
282
|
}
|
|
205
283
|
|
|
206
284
|
type ProductSearchSlowViewState = Pick<ProductSearchViewState, 'searchFields' | 'fuzzySearch' | 'emptyStateMessage'> & {
|
|
207
285
|
filters: {
|
|
208
286
|
categoryFilter: {
|
|
209
|
-
categories: Array<Pick<ProductSearchViewState['filters']['categoryFilter']['categories'][number], 'categoryId' | 'categoryName' | 'categorySlug'>>;
|
|
287
|
+
categories: Array<Pick<ProductSearchViewState['filters']['categoryFilter']['categories'][number], 'categoryId' | 'categoryName' | 'categorySlug' | 'categoryUrl'>>;
|
|
210
288
|
};
|
|
211
289
|
};
|
|
290
|
+
categoryHeader: ProductSearchViewState['categoryHeader'];
|
|
212
291
|
};
|
|
213
292
|
|
|
214
293
|
type ProductSearchFastViewState = Pick<ProductSearchViewState, 'searchExpression' | 'isSearching' | 'hasSearched' | 'resultCount' | 'hasResults' | 'hasMore' | 'loadedCount' | 'totalCount' | 'hasSuggestions'> & {
|
|
@@ -218,6 +297,7 @@ type ProductSearchFastViewState = Pick<ProductSearchViewState, 'searchExpression
|
|
|
218
297
|
categoryFilter: {
|
|
219
298
|
categories: Array<Pick<ProductSearchViewState['filters']['categoryFilter']['categories'][number], 'categoryId' | 'isSelected'>>;
|
|
220
299
|
};
|
|
300
|
+
optionFilters: Array<ProductSearchViewState['filters']['optionFilters'][number]>;
|
|
221
301
|
};
|
|
222
302
|
sortBy: ProductSearchViewState['sortBy'];
|
|
223
303
|
suggestions: Array<ProductSearchViewState['suggestions'][number]>;
|
|
@@ -230,6 +310,7 @@ type ProductSearchInteractiveViewState = Pick<ProductSearchViewState, 'searchExp
|
|
|
230
310
|
categoryFilter: {
|
|
231
311
|
categories: Array<Pick<ProductSearchViewState['filters']['categoryFilter']['categories'][number], 'categoryId' | 'isSelected'>>;
|
|
232
312
|
};
|
|
313
|
+
optionFilters: Array<ProductSearchViewState['filters']['optionFilters'][number]>;
|
|
233
314
|
};
|
|
234
315
|
sortBy: ProductSearchViewState['sortBy'];
|
|
235
316
|
suggestions: Array<ProductSearchViewState['suggestions'][number]>;
|
|
@@ -256,6 +337,11 @@ interface ProductSearchRefs {
|
|
|
256
337
|
categories: {
|
|
257
338
|
isSelected: HTMLElementCollectionProxy<CategoryOfCategoryFilterOfFilterOfProductSearchViewState, HTMLInputElement>
|
|
258
339
|
}
|
|
340
|
+
},
|
|
341
|
+
optionFilters: {
|
|
342
|
+
choices: {
|
|
343
|
+
isSelected: HTMLElementCollectionProxy<ChoiceOfOptionFilterOfFilterOfProductSearchViewState, HTMLInputElement>
|
|
344
|
+
}
|
|
259
345
|
}
|
|
260
346
|
},
|
|
261
347
|
sortBy: {
|
|
@@ -267,79 +353,95 @@ interface ProductSearchRefs {
|
|
|
267
353
|
}
|
|
268
354
|
|
|
269
355
|
/**
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
* These functions create singleton instances of Wix API clients.
|
|
273
|
-
* Used by both the server service and client context.
|
|
356
|
+
* Configuration loader for wix-stores plugin.
|
|
274
357
|
*
|
|
275
|
-
*
|
|
358
|
+
* Reads optional config from config/.wix-stores.yaml.
|
|
359
|
+
* When the file doesn't exist, returns defaults.
|
|
276
360
|
*/
|
|
361
|
+
/**
|
|
362
|
+
* URL templates for building canonical product and category links.
|
|
363
|
+
* Placeholders: {slug}, {category}, {prefix}
|
|
364
|
+
*/
|
|
365
|
+
interface UrlTemplates {
|
|
366
|
+
/** URL template for product pages. Default: "/products/{slug}" */
|
|
367
|
+
product: string;
|
|
368
|
+
/** URL template for category pages. Not set = no category deep-linking */
|
|
369
|
+
category: string | null;
|
|
370
|
+
}
|
|
277
371
|
|
|
278
372
|
/**
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
* The Products V3 API is part of the new Catalog V3 system that provides
|
|
282
|
-
* advanced product management capabilities for sophisticated e-commerce applications.
|
|
373
|
+
* Shared Product Mapping Utilities
|
|
283
374
|
*
|
|
284
|
-
*
|
|
285
|
-
* @see https://dev.wix.com/docs/sdk/backend-modules/stores/catalog-v3/introduction
|
|
375
|
+
* Maps Wix Stores Catalog V3 product responses to view state contracts.
|
|
286
376
|
*/
|
|
287
|
-
|
|
377
|
+
|
|
288
378
|
/**
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
* The Categories API allows you to manage product Categories in your Wix store.
|
|
292
|
-
*
|
|
293
|
-
* @returns Categories client instance from @wix/stores
|
|
294
|
-
* @see https://dev.wix.com/docs/sdk/backend-modules/categories/categories/introduction
|
|
379
|
+
* Cached category hierarchy data, used for resolving category slugs and parent chains.
|
|
380
|
+
* Built lazily from the Wix Categories API and cached on the service.
|
|
295
381
|
*/
|
|
296
|
-
|
|
382
|
+
interface CategoryTree {
|
|
383
|
+
/** Map of categoryId → slug */
|
|
384
|
+
slugMap: Map<string, string>;
|
|
385
|
+
/** Map of categoryId → parent categoryId */
|
|
386
|
+
parentMap: Map<string, string>;
|
|
387
|
+
/** Set of root category IDs (categories with no parent) */
|
|
388
|
+
rootIds: Set<string>;
|
|
389
|
+
/** Map of categoryId → image URL (only for categories that have an image) */
|
|
390
|
+
imageMap: Map<string, string>;
|
|
391
|
+
}
|
|
297
392
|
/**
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
* The Inventory API allows you to manage product inventory in your Wix store.
|
|
301
|
-
*
|
|
302
|
-
* @returns Inventory client instance from @wix/stores
|
|
303
|
-
* @see https://dev.wix.com/docs/sdk/backend-modules/stores/inventory/introduction
|
|
393
|
+
* Find the root category ID for a given category by walking up the parent chain.
|
|
304
394
|
*/
|
|
305
|
-
declare function
|
|
306
|
-
|
|
395
|
+
declare function findRootCategoryId(categoryId: string, tree: CategoryTree): string;
|
|
307
396
|
/**
|
|
308
|
-
*
|
|
309
|
-
* Products belonging to any child of this category get URLs like /products/{prefix}/{slug}.
|
|
397
|
+
* Get the slug of the root category for a given category.
|
|
310
398
|
*/
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
}
|
|
399
|
+
declare function findRootCategorySlug(categoryId: string, tree: CategoryTree): string;
|
|
400
|
+
/**
|
|
401
|
+
* Find the image URL for a category, walking up the parent chain if the category has no image.
|
|
402
|
+
* Returns the first image found in the ancestry, or empty string.
|
|
403
|
+
*/
|
|
404
|
+
declare function findCategoryImage(categoryId: string, tree: CategoryTree): string;
|
|
405
|
+
/**
|
|
406
|
+
* Build a product URL from the template, resolving {slug}, {category}, {prefix}.
|
|
407
|
+
* Defaults to placeholders if values are not provided
|
|
408
|
+
*/
|
|
409
|
+
declare function buildProductUrl(urls: UrlTemplates, tree: CategoryTree, slug: string, mainCategoryId: string): string | null;
|
|
410
|
+
/**
|
|
411
|
+
* Build a category URL from the template, resolving {category} and {prefix}.
|
|
412
|
+
* Returns null if template is null or a required placeholder can't be resolved.
|
|
413
|
+
*/
|
|
414
|
+
declare function buildCategoryUrl(urls: UrlTemplates, tree: CategoryTree, categorySlug: string, categoryId: string): string | null;
|
|
415
|
+
/** Variant stock map: colorChoiceId -> textChoiceId -> inStock */
|
|
416
|
+
type VariantStockMap = Record<string, Record<string, boolean>>;
|
|
417
|
+
|
|
319
418
|
interface WixStoresService {
|
|
320
|
-
products:
|
|
321
|
-
categories:
|
|
322
|
-
inventory:
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
419
|
+
products: BuildDescriptors<typeof productsV3, {}>;
|
|
420
|
+
categories: BuildDescriptors<typeof categories, {}>;
|
|
421
|
+
inventory: BuildDescriptors<typeof inventoryItemsV3, {}>;
|
|
422
|
+
customizations: BuildDescriptors<typeof customizationsV3, {}>;
|
|
423
|
+
/** URL templates for building canonical links */
|
|
424
|
+
urls: UrlTemplates;
|
|
425
|
+
/** Slug of the fallback category for pages without category context */
|
|
426
|
+
defaultCategory: string | null;
|
|
427
|
+
/** Get the cached category tree. Lazily built on first call. */
|
|
428
|
+
getCategoryTree(): Promise<CategoryTree>;
|
|
429
|
+
/** Get cached product customizations (options with choices). Lazily loaded. */
|
|
430
|
+
getCustomizations(): Promise<Customization[]>;
|
|
327
431
|
}
|
|
328
432
|
/**
|
|
329
433
|
* Server service marker for Wix Stores.
|
|
330
|
-
* Use with `.withServices(WIX_STORES_SERVICE_MARKER)` in component definitions.
|
|
331
434
|
*/
|
|
332
435
|
declare const WIX_STORES_SERVICE_MARKER: _jay_framework_fullstack_component.ServiceMarker<WixStoresService>;
|
|
333
436
|
/**
|
|
334
437
|
* Options for initializing the Wix Stores service.
|
|
335
438
|
*/
|
|
336
439
|
interface WixStoresServiceOptions {
|
|
337
|
-
|
|
338
|
-
|
|
440
|
+
urls?: UrlTemplates;
|
|
441
|
+
defaultCategory?: string | null;
|
|
339
442
|
}
|
|
340
443
|
/**
|
|
341
444
|
* Creates, registers, and returns a Wix Stores service instance.
|
|
342
|
-
* Called during server initialization.
|
|
343
445
|
*/
|
|
344
446
|
declare function provideWixStoresService(wixClient: WixClient, options?: WixStoresServiceOptions): WixStoresService;
|
|
345
447
|
|
|
@@ -401,13 +503,62 @@ interface WixStoresContext {
|
|
|
401
503
|
*/
|
|
402
504
|
declare const WIX_STORES_CONTEXT: _jay_framework_runtime.ContextMarker<WixStoresContext>;
|
|
403
505
|
|
|
506
|
+
interface SearchProductsInput {
|
|
507
|
+
query: string;
|
|
508
|
+
filters?: {
|
|
509
|
+
inStockOnly?: boolean;
|
|
510
|
+
minPrice?: number;
|
|
511
|
+
maxPrice?: number;
|
|
512
|
+
categoryIds?: Array<string>;
|
|
513
|
+
optionFilters?: Array<{
|
|
514
|
+
optionName: string;
|
|
515
|
+
choiceNames: Array<string>;
|
|
516
|
+
}>;
|
|
517
|
+
};
|
|
518
|
+
sortBy?: 'relevance' | 'price_asc' | 'price_desc' | 'name_asc' | 'name_desc' | 'newest';
|
|
519
|
+
cursor?: string;
|
|
520
|
+
pageSize?: number;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
interface SearchProductsOutput {
|
|
524
|
+
products: Array<ProductCardViewState>;
|
|
525
|
+
totalCount: number;
|
|
526
|
+
nextCursor?: string;
|
|
527
|
+
hasMore: boolean;
|
|
528
|
+
priceAggregation?: {
|
|
529
|
+
minBound: number;
|
|
530
|
+
maxBound: number;
|
|
531
|
+
ranges: Array<{
|
|
532
|
+
rangeId: string;
|
|
533
|
+
label: string;
|
|
534
|
+
minValue?: number;
|
|
535
|
+
maxValue?: number;
|
|
536
|
+
productCount: number;
|
|
537
|
+
isSelected: boolean;
|
|
538
|
+
}>;
|
|
539
|
+
};
|
|
540
|
+
optionFilters?: Array<{
|
|
541
|
+
optionId: string;
|
|
542
|
+
optionName: string;
|
|
543
|
+
optionRenderType: 'TEXT_CHOICES' | 'SWATCH_CHOICES';
|
|
544
|
+
choices: Array<{
|
|
545
|
+
choiceId: string;
|
|
546
|
+
choiceName: string;
|
|
547
|
+
colorCode: string;
|
|
548
|
+
productCount: number;
|
|
549
|
+
}>;
|
|
550
|
+
}>;
|
|
551
|
+
}
|
|
552
|
+
|
|
404
553
|
/**
|
|
405
554
|
* URL parameters for product search routes.
|
|
406
|
-
*
|
|
555
|
+
* Supports: category (prefix slug), subcategory (sub-category slug).
|
|
407
556
|
*/
|
|
408
557
|
interface ProductSearchParams extends UrlParams {
|
|
409
|
-
/**
|
|
558
|
+
/** Top-level category slug (e.g., 'polgat'). Scopes search to this category. */
|
|
410
559
|
category?: string;
|
|
560
|
+
/** Sub-category slug (e.g., 'shirts'). Further scopes within the category. */
|
|
561
|
+
subcategory?: string;
|
|
411
562
|
}
|
|
412
563
|
/**
|
|
413
564
|
* Search sort options
|
|
@@ -426,6 +577,10 @@ interface SearchSlowCarryForward {
|
|
|
426
577
|
categories: CategoryInfos;
|
|
427
578
|
/** Root category ID when scoped to a category prefix (always applied, hidden from UI) */
|
|
428
579
|
baseCategoryId: string | null;
|
|
580
|
+
/** Pre-loaded product results from slow phase (used when no query params) */
|
|
581
|
+
preloadedResult: SearchProductsOutput | null;
|
|
582
|
+
/** Base option filters from unfiltered search (static list, counts updated per search) */
|
|
583
|
+
baseOptionFilters: SearchProductsOutput['optionFilters'];
|
|
429
584
|
}
|
|
430
585
|
/**
|
|
431
586
|
* Data carried forward from fast rendering to interactive phase
|
|
@@ -436,24 +591,10 @@ interface SearchFastCarryForward {
|
|
|
436
591
|
categories: CategoryInfos;
|
|
437
592
|
/** Root category ID when scoped to a category prefix (always applied, hidden from UI) */
|
|
438
593
|
baseCategoryId: string | null;
|
|
594
|
+
/** Base option filters from unfiltered search (static list structure) */
|
|
595
|
+
baseOptionFilters: SearchProductsOutput['optionFilters'];
|
|
439
596
|
}
|
|
440
|
-
|
|
441
|
-
* Product Search Full-Stack Component
|
|
442
|
-
*
|
|
443
|
-
* A complete headless product search component with server-side rendering,
|
|
444
|
-
* filtering, sorting, and "load more" functionality.
|
|
445
|
-
*
|
|
446
|
-
* Rendering phases:
|
|
447
|
-
* - Slow: Categories for filtering (relatively static)
|
|
448
|
-
* - Fast: Products, search results, load more state (dynamic per request)
|
|
449
|
-
* - Interactive: Search input, filter selections, sorting, load more (client-side)
|
|
450
|
-
*
|
|
451
|
-
* Usage:
|
|
452
|
-
* ```typescript
|
|
453
|
-
* import { productSearch } from '@jay-framework/wix-stores';
|
|
454
|
-
* ```
|
|
455
|
-
*/
|
|
456
|
-
declare const productSearch: _jay_framework_fullstack_component.JayStackComponentDefinition<ProductSearchRefs, ProductSearchSlowViewState, ProductSearchFastViewState, ProductSearchInteractiveViewState, [SearchSlowCarryForward, WixStoresService], [Signals<ProductSearchFastViewState>, SearchFastCarryForward, WixStoresContext], PageProps & ProductSearchParams, {}, _jay_framework_component.JayComponentCore<PageProps & ProductSearchParams, ProductSearchInteractiveViewState>>;
|
|
597
|
+
declare const productSearch: _jay_framework_fullstack_component.JayStackComponentDefinition<ProductSearchRefs, ProductSearchSlowViewState, ProductSearchFastViewState, ProductSearchInteractiveViewState, [SearchSlowCarryForward, WixStoresService], [Signals<ProductSearchFastViewState>, SearchFastCarryForward, WixStoresContext], PageProps & ProductSearchParams, ProductSearchParams, _jay_framework_component.JayComponentCore<PageProps & ProductSearchParams, ProductSearchInteractiveViewState>>;
|
|
457
598
|
|
|
458
599
|
declare enum MediaType {
|
|
459
600
|
IMAGE,
|
|
@@ -799,75 +940,6 @@ declare const categoryList: _jay_framework_fullstack_component.JayStackComponent
|
|
|
799
940
|
withInteractive(comp: _jay_framework_component.ComponentConstructor<PageProps, CategoryListRefs, CategoryListInteractiveViewState, [], _jay_framework_component.JayComponentCore<PageProps, CategoryListInteractiveViewState>>): _jay_framework_fullstack_component.JayStackComponentDefinition<CategoryListRefs, CategoryListSlowViewState, CategoryListFastViewState, CategoryListInteractiveViewState, [Record<string, never>, WixStoresService], [], PageProps, {}, _jay_framework_component.JayComponentCore<PageProps, CategoryListInteractiveViewState>>;
|
|
800
941
|
};
|
|
801
942
|
|
|
802
|
-
/**
|
|
803
|
-
* Sort options for product search
|
|
804
|
-
*/
|
|
805
|
-
type ProductSortField = 'relevance' | 'price_asc' | 'price_desc' | 'name_asc' | 'name_desc' | 'newest';
|
|
806
|
-
/**
|
|
807
|
-
* Product search filters
|
|
808
|
-
*/
|
|
809
|
-
interface ProductSearchFilters {
|
|
810
|
-
/** Only show products in stock */
|
|
811
|
-
inStockOnly?: boolean;
|
|
812
|
-
/** Minimum price filter */
|
|
813
|
-
minPrice?: number;
|
|
814
|
-
/** Maximum price filter */
|
|
815
|
-
maxPrice?: number;
|
|
816
|
-
/** Filter by category IDs */
|
|
817
|
-
categoryIds?: string[];
|
|
818
|
-
}
|
|
819
|
-
/**
|
|
820
|
-
* Price range bucket for aggregation
|
|
821
|
-
*/
|
|
822
|
-
interface PriceRangeBucket {
|
|
823
|
-
rangeId: string;
|
|
824
|
-
label: string;
|
|
825
|
-
minValue: number | null;
|
|
826
|
-
maxValue: number | null;
|
|
827
|
-
productCount: number;
|
|
828
|
-
isSelected: boolean;
|
|
829
|
-
}
|
|
830
|
-
/**
|
|
831
|
-
* Price aggregation data from search
|
|
832
|
-
*/
|
|
833
|
-
interface PriceAggregationData {
|
|
834
|
-
/** Minimum price across all products */
|
|
835
|
-
minBound: number;
|
|
836
|
-
/** Maximum price across all products */
|
|
837
|
-
maxBound: number;
|
|
838
|
-
/** Price range buckets with product counts */
|
|
839
|
-
ranges: PriceRangeBucket[];
|
|
840
|
-
}
|
|
841
|
-
/**
|
|
842
|
-
* Input for searchProducts action
|
|
843
|
-
*/
|
|
844
|
-
interface SearchProductsInput {
|
|
845
|
-
/** Search query text */
|
|
846
|
-
query: string;
|
|
847
|
-
/** Filters to apply */
|
|
848
|
-
filters?: ProductSearchFilters;
|
|
849
|
-
/** Sort order */
|
|
850
|
-
sortBy?: ProductSortField;
|
|
851
|
-
/** Cursor for pagination (from previous response's nextCursor) */
|
|
852
|
-
cursor?: string;
|
|
853
|
-
/** Items per page (default: 12) */
|
|
854
|
-
pageSize?: number;
|
|
855
|
-
}
|
|
856
|
-
/**
|
|
857
|
-
* Output for searchProducts action
|
|
858
|
-
*/
|
|
859
|
-
interface SearchProductsOutput {
|
|
860
|
-
/** List of matching products */
|
|
861
|
-
products: ProductCardViewState[];
|
|
862
|
-
/** Total number of matching products */
|
|
863
|
-
totalCount: number;
|
|
864
|
-
/** Cursor for next page (null if no more results) */
|
|
865
|
-
nextCursor: string | null;
|
|
866
|
-
/** Whether there are more results */
|
|
867
|
-
hasMore: boolean;
|
|
868
|
-
/** Price aggregation data (bounds and ranges) */
|
|
869
|
-
priceAggregation?: PriceAggregationData;
|
|
870
|
-
}
|
|
871
943
|
/**
|
|
872
944
|
* Input for getProductBySlug action
|
|
873
945
|
*/
|
|
@@ -907,6 +979,15 @@ declare const searchProducts: _jay_framework_fullstack_component.JayAction<Searc
|
|
|
907
979
|
* ```
|
|
908
980
|
*/
|
|
909
981
|
declare const getProductBySlug: _jay_framework_fullstack_component.JayAction<GetProductBySlugInput, ProductCardViewState> & _jay_framework_fullstack_component.JayActionDefinition<GetProductBySlugInput, ProductCardViewState, [WixStoresService]>;
|
|
982
|
+
/**
|
|
983
|
+
* Get variant stock availability for a COLOR_AND_TEXT_OPTIONS product.
|
|
984
|
+
* Fetches full product data and builds a stock map: colorChoiceId -> textChoiceId -> inStock.
|
|
985
|
+
*/
|
|
986
|
+
declare const getVariantStock: _jay_framework_fullstack_component.JayAction<{
|
|
987
|
+
productId: string;
|
|
988
|
+
}, VariantStockMap> & _jay_framework_fullstack_component.JayActionDefinition<{
|
|
989
|
+
productId: string;
|
|
990
|
+
}, VariantStockMap, [WixStoresService]>;
|
|
910
991
|
/**
|
|
911
992
|
* Get available categories for filtering.
|
|
912
993
|
*
|
|
@@ -940,4 +1021,4 @@ declare function setupWixStores(ctx: PluginSetupContext): Promise<PluginSetupRes
|
|
|
940
1021
|
*/
|
|
941
1022
|
declare function generateWixStoresReferences(ctx: PluginReferencesContext): Promise<PluginReferencesResult>;
|
|
942
1023
|
|
|
943
|
-
export { type
|
|
1024
|
+
export { type CategoryTree, type GetProductBySlugInput, type ProductPageParams, type ProductSearchParams, type SearchSortOption, WIX_STORES_CONTEXT, WIX_STORES_SERVICE_MARKER, type WixStoresContext, type WixStoresInitData, type WixStoresService, type WixStoresServiceOptions, buildCategoryUrl, buildProductUrl, categoryList, findCategoryImage, findRootCategoryId, findRootCategorySlug, generateWixStoresReferences, getCategories, getProductBySlug, getVariantStock, init, productPage, productSearch, provideWixStoresService, searchProducts, setupWixStores };
|