@jay-framework/wix-stores 0.15.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.
@@ -0,0 +1,943 @@
1
+ import { getCurrentCartClient, CartState } from '@jay-framework/wix-cart';
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
+ import * as _jay_framework_fullstack_component from '@jay-framework/fullstack-component';
4
+ import { UrlParams, Signals, PageProps } from '@jay-framework/fullstack-component';
5
+ import * as _jay_framework_component from '@jay-framework/component';
6
+ import * as _jay_framework_runtime from '@jay-framework/runtime';
7
+ import { HTMLElementCollectionProxy, HTMLElementProxy } from '@jay-framework/runtime';
8
+ import { WixClient } from '@wix/sdk';
9
+ import { productsV3, inventoryItemsV3 } from '@wix/stores';
10
+ import { categories } from '@wix/categories';
11
+ import { BuildDescriptors } from '@wix/sdk-types';
12
+ import { Getter } from '@jay-framework/reactive';
13
+ import { OptionChoice } from '@wix/auto_sdk_stores_products-v-3';
14
+ import { PluginSetupContext, PluginSetupResult, PluginReferencesContext, PluginReferencesResult } from '@jay-framework/stack-server-runtime';
15
+
16
+ declare enum OptionRenderType$1 {
17
+ TEXT_CHOICES,
18
+ COLOR_SWATCH_CHOICES
19
+ }
20
+
21
+ declare enum ChoiceType$1 {
22
+ CHOICE_TEXT,
23
+ ONE_COLOR
24
+ }
25
+
26
+ interface ChoiceOfProductOptionsViewState {
27
+ choiceId: string,
28
+ name: string,
29
+ choiceType: ChoiceType$1,
30
+ colorCode: string,
31
+ inStock: boolean,
32
+ variantId: string,
33
+ isSelected: boolean
34
+ }
35
+
36
+ interface ProductOptionsViewState {
37
+ _id: string,
38
+ name: string,
39
+ optionRenderType: OptionRenderType$1,
40
+ choices: Array<ChoiceOfProductOptionsViewState>
41
+ }
42
+
43
+
44
+ interface ProductOptionsRepeatedRefs {
45
+ choices: {
46
+ choiceButton: HTMLElementCollectionProxy<ChoiceOfProductOptionsViewState, HTMLButtonElement>
47
+ }
48
+ }
49
+
50
+ declare enum MediaType$1 {
51
+ IMAGE,
52
+ VIDEO
53
+ }
54
+
55
+ interface MainMediaOfProductCardViewState {
56
+ url: string,
57
+ altText: string,
58
+ mediaType: MediaType$1
59
+ }
60
+
61
+ interface ThumbnailOfProductCardViewState {
62
+ url: string,
63
+ altText: string,
64
+ width: number,
65
+ height: number
66
+ }
67
+
68
+ declare enum AvailabilityStatus {
69
+ IN_STOCK,
70
+ OUT_OF_STOCK,
71
+ PARTIALLY_OUT_OF_STOCK
72
+ }
73
+
74
+ declare enum PreorderStatus {
75
+ ENABLED,
76
+ DISABLED,
77
+ PARTIALLY_ENABLED
78
+ }
79
+
80
+ interface InventoryOfProductCardViewState {
81
+ availabilityStatus: AvailabilityStatus,
82
+ preorderStatus: PreorderStatus
83
+ }
84
+
85
+ interface RibbonOfProductCardViewState {
86
+ _id: string,
87
+ name: string
88
+ }
89
+
90
+ interface BrandOfProductCardViewState {
91
+ _id: string,
92
+ name: string
93
+ }
94
+
95
+ declare enum ProductType$1 {
96
+ PHYSICAL,
97
+ DIGITAL
98
+ }
99
+
100
+ declare enum QuickAddType {
101
+ SIMPLE,
102
+ SINGLE_OPTION,
103
+ NEEDS_CONFIGURATION
104
+ }
105
+
106
+ interface ProductCardViewState {
107
+ _id: string,
108
+ name: string,
109
+ slug: string,
110
+ productUrl: string,
111
+ categoryPrefix: string,
112
+ mainMedia: MainMediaOfProductCardViewState,
113
+ thumbnail: ThumbnailOfProductCardViewState,
114
+ price: string,
115
+ strikethroughPrice: string,
116
+ hasDiscount: boolean,
117
+ inventory: InventoryOfProductCardViewState,
118
+ ribbon: RibbonOfProductCardViewState,
119
+ hasRibbon: boolean,
120
+ brand: BrandOfProductCardViewState,
121
+ productType: ProductType$1,
122
+ isAddingToCart: boolean,
123
+ quickAddType: QuickAddType,
124
+ quickOption: ProductOptionsViewState
125
+ }
126
+
127
+
128
+ interface ProductCardRepeatedRefs {
129
+ productLink: HTMLElementCollectionProxy<ProductCardViewState, HTMLAnchorElement>,
130
+ addToCartButton: HTMLElementCollectionProxy<ProductCardViewState, HTMLButtonElement>,
131
+ viewOptionsButton: HTMLElementCollectionProxy<ProductCardViewState, HTMLButtonElement>,
132
+ quickOption: ProductOptionsRepeatedRefs
133
+ }
134
+
135
+ interface RangeOfPriceRangeOfFilterOfProductSearchViewState {
136
+ rangeId: string,
137
+ label: string,
138
+ minValue: number,
139
+ maxValue: number,
140
+ productCount: number,
141
+ isSelected: boolean
142
+ }
143
+
144
+ interface PriceRangeOfFilterOfProductSearchViewState {
145
+ minPrice: number,
146
+ maxPrice: number,
147
+ minBound: number,
148
+ maxBound: number,
149
+ ranges: Array<RangeOfPriceRangeOfFilterOfProductSearchViewState>
150
+ }
151
+
152
+ interface CategoryOfCategoryFilterOfFilterOfProductSearchViewState {
153
+ categoryId: string,
154
+ categoryName: string,
155
+ categorySlug: string,
156
+ isSelected: boolean
157
+ }
158
+
159
+ interface CategoryFilterOfFilterOfProductSearchViewState {
160
+ categories: Array<CategoryOfCategoryFilterOfFilterOfProductSearchViewState>
161
+ }
162
+
163
+ interface FilterOfProductSearchViewState {
164
+ priceRange: PriceRangeOfFilterOfProductSearchViewState,
165
+ categoryFilter: CategoryFilterOfFilterOfProductSearchViewState,
166
+ inStockOnly: boolean
167
+ }
168
+
169
+ declare enum CurrentSort {
170
+ relevance,
171
+ priceAsc,
172
+ priceDesc,
173
+ newest,
174
+ nameAsc,
175
+ nameDesc
176
+ }
177
+
178
+ interface SortByOfProductSearchViewState {
179
+ currentSort: CurrentSort
180
+ }
181
+
182
+ interface SuggestionOfProductSearchViewState {
183
+ suggestionId: string,
184
+ suggestionText: string
185
+ }
186
+
187
+ interface ProductSearchViewState {
188
+ searchExpression: string,
189
+ searchFields: string,
190
+ fuzzySearch: boolean,
191
+ isSearching: boolean,
192
+ hasSearched: boolean,
193
+ searchResults: Array<ProductCardViewState>,
194
+ resultCount: number,
195
+ hasResults: boolean,
196
+ emptyStateMessage: string,
197
+ filters: FilterOfProductSearchViewState,
198
+ sortBy: SortByOfProductSearchViewState,
199
+ hasMore: boolean,
200
+ loadedCount: number,
201
+ totalCount: number,
202
+ hasSuggestions: boolean,
203
+ suggestions: Array<SuggestionOfProductSearchViewState>
204
+ }
205
+
206
+ type ProductSearchSlowViewState = Pick<ProductSearchViewState, 'searchFields' | 'fuzzySearch' | 'emptyStateMessage'> & {
207
+ filters: {
208
+ categoryFilter: {
209
+ categories: Array<Pick<ProductSearchViewState['filters']['categoryFilter']['categories'][number], 'categoryId' | 'categoryName' | 'categorySlug'>>;
210
+ };
211
+ };
212
+ };
213
+
214
+ type ProductSearchFastViewState = Pick<ProductSearchViewState, 'searchExpression' | 'isSearching' | 'hasSearched' | 'resultCount' | 'hasResults' | 'hasMore' | 'loadedCount' | 'totalCount' | 'hasSuggestions'> & {
215
+ searchResults: Array<ProductSearchViewState['searchResults'][number]>;
216
+ filters: Pick<ProductSearchViewState['filters'], 'inStockOnly'> & {
217
+ priceRange: ProductSearchViewState['filters']['priceRange'];
218
+ categoryFilter: {
219
+ categories: Array<Pick<ProductSearchViewState['filters']['categoryFilter']['categories'][number], 'categoryId' | 'isSelected'>>;
220
+ };
221
+ };
222
+ sortBy: ProductSearchViewState['sortBy'];
223
+ suggestions: Array<ProductSearchViewState['suggestions'][number]>;
224
+ };
225
+
226
+ type ProductSearchInteractiveViewState = Pick<ProductSearchViewState, 'searchExpression' | 'isSearching' | 'hasSearched' | 'resultCount' | 'hasResults' | 'hasMore' | 'loadedCount' | 'totalCount' | 'hasSuggestions'> & {
227
+ searchResults: Array<ProductSearchViewState['searchResults'][number]>;
228
+ filters: Pick<ProductSearchViewState['filters'], 'inStockOnly'> & {
229
+ priceRange: ProductSearchViewState['filters']['priceRange'];
230
+ categoryFilter: {
231
+ categories: Array<Pick<ProductSearchViewState['filters']['categoryFilter']['categories'][number], 'categoryId' | 'isSelected'>>;
232
+ };
233
+ };
234
+ sortBy: ProductSearchViewState['sortBy'];
235
+ suggestions: Array<ProductSearchViewState['suggestions'][number]>;
236
+ };
237
+
238
+
239
+ interface ProductSearchRefs {
240
+ searchExpression: HTMLElementProxy<ProductSearchViewState, HTMLInputElement>,
241
+ searchButton: HTMLElementProxy<ProductSearchViewState, HTMLButtonElement>,
242
+ clearSearchButton: HTMLElementProxy<ProductSearchViewState, HTMLButtonElement>,
243
+ loadMoreButton: HTMLElementProxy<ProductSearchViewState, HTMLButtonElement>,
244
+ searchResults: ProductCardRepeatedRefs,
245
+ filters: {
246
+ inStockOnly: HTMLElementProxy<FilterOfProductSearchViewState, HTMLInputElement>,
247
+ clearFilters: HTMLElementProxy<FilterOfProductSearchViewState, HTMLButtonElement>,
248
+ priceRange: {
249
+ minPrice: HTMLElementProxy<PriceRangeOfFilterOfProductSearchViewState, HTMLInputElement>,
250
+ maxPrice: HTMLElementProxy<PriceRangeOfFilterOfProductSearchViewState, HTMLInputElement>,
251
+ ranges: {
252
+ isSelected: HTMLElementCollectionProxy<RangeOfPriceRangeOfFilterOfProductSearchViewState, HTMLInputElement>
253
+ }
254
+ },
255
+ categoryFilter: {
256
+ categories: {
257
+ isSelected: HTMLElementCollectionProxy<CategoryOfCategoryFilterOfFilterOfProductSearchViewState, HTMLInputElement>
258
+ }
259
+ }
260
+ },
261
+ sortBy: {
262
+ sortDropdown: HTMLElementProxy<SortByOfProductSearchViewState, HTMLSelectElement>
263
+ },
264
+ suggestions: {
265
+ suggestionButton: HTMLElementCollectionProxy<SuggestionOfProductSearchViewState, HTMLButtonElement>
266
+ }
267
+ }
268
+
269
+ /**
270
+ * Wix Store API Client Factories
271
+ *
272
+ * These functions create singleton instances of Wix API clients.
273
+ * Used by both the server service and client context.
274
+ *
275
+ * Note: Cart client is provided by @jay-framework/wix-cart package.
276
+ */
277
+
278
+ /**
279
+ * Get a configured Wix Stores Products V3 client (singleton)
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.
283
+ *
284
+ * @returns Products V3 client instance from @wix/stores
285
+ * @see https://dev.wix.com/docs/sdk/backend-modules/stores/catalog-v3/introduction
286
+ */
287
+ declare function getProductsV3Client(wixClient: WixClient): BuildDescriptors<typeof productsV3, {}>;
288
+ /**
289
+ * Get a configured Wix Stores Categories client (singleton)
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
295
+ */
296
+ declare function getCategoriesClient(wixClient: WixClient): BuildDescriptors<typeof categories, {}>;
297
+ /**
298
+ * Get a configured Wix Stores Inventory V3 client (singleton)
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
304
+ */
305
+ declare function getInventoryClient(wixClient: WixClient): BuildDescriptors<typeof inventoryItemsV3, {}>;
306
+
307
+ /**
308
+ * Maps a Wix root category to a URL prefix slug.
309
+ * Products belonging to any child of this category get URLs like /products/{prefix}/{slug}.
310
+ */
311
+ interface CategoryPrefixConfig {
312
+ /** Root category ID in Wix */
313
+ categoryId: string;
314
+ /** URL prefix slug (e.g., 'polgat', 'kitan') */
315
+ prefix: string;
316
+ /** Display name for the category (e.g., 'פולגת', 'כיתן') */
317
+ name: string;
318
+ }
319
+ interface WixStoresService {
320
+ products: ReturnType<typeof getProductsV3Client>;
321
+ categories: ReturnType<typeof getCategoriesClient>;
322
+ inventory: ReturnType<typeof getInventoryClient>;
323
+ /** @deprecated Use WIX_CART_SERVICE from @jay-framework/wix-cart instead */
324
+ cart: ReturnType<typeof getCurrentCartClient>;
325
+ /** Category-to-URL-prefix mappings. Empty array when not configured. */
326
+ categoryPrefixes: CategoryPrefixConfig[];
327
+ }
328
+ /**
329
+ * Server service marker for Wix Stores.
330
+ * Use with `.withServices(WIX_STORES_SERVICE_MARKER)` in component definitions.
331
+ */
332
+ declare const WIX_STORES_SERVICE_MARKER: _jay_framework_fullstack_component.ServiceMarker<WixStoresService>;
333
+ /**
334
+ * Options for initializing the Wix Stores service.
335
+ */
336
+ interface WixStoresServiceOptions {
337
+ /** Category-to-URL-prefix mappings for category-prefixed product routes */
338
+ categoryPrefixes?: CategoryPrefixConfig[];
339
+ }
340
+ /**
341
+ * Creates, registers, and returns a Wix Stores service instance.
342
+ * Called during server initialization.
343
+ */
344
+ declare function provideWixStoresService(wixClient: WixClient, options?: WixStoresServiceOptions): WixStoresService;
345
+
346
+ /**
347
+ * Configuration passed from server to client for Wix Stores.
348
+ */
349
+ interface WixStoresInitData {
350
+ /** Enable client-side cart operations */
351
+ enableClientCart: boolean;
352
+ /** Enable client-side search */
353
+ enableClientSearch: boolean;
354
+ }
355
+ /**
356
+ * Reactive cart indicator state.
357
+ * Signals update automatically when cart operations occur.
358
+ */
359
+ interface ReactiveCartIndicator {
360
+ /** Number of items in cart (reactive signal) */
361
+ itemCount: Getter<number>;
362
+ /** Whether cart has items (reactive signal) */
363
+ hasItems: Getter<boolean>;
364
+ }
365
+ /**
366
+ * Result of a cart operation that modifies items.
367
+ */
368
+ interface CartOperationResult {
369
+ /** Updated cart state after the operation */
370
+ cartState: CartState;
371
+ }
372
+ interface SelectedOptionsAndModifiers {
373
+ /** options as (option._id, choice.choiceId) pairs */
374
+ options: Record<string, string>;
375
+ /** modifiers as (modifier._id, choice.choiceId) pairs - translated to keys in addToCart */
376
+ modifiers: Record<string, string>;
377
+ /** custom text fields as (modifier._id, user input) pairs - translated to keys in addToCart */
378
+ customTextFields: Record<string, string>;
379
+ }
380
+ /**
381
+ * Client-side Wix Stores context interface.
382
+ * Provides reactive cart indicator (delegated to WIX_CART_CONTEXT) and stores-specific operations.
383
+ */
384
+ interface WixStoresContext {
385
+ /**
386
+ * Reactive cart indicator signals.
387
+ * Use these in render functions for automatic updates.
388
+ */
389
+ cartIndicator: ReactiveCartIndicator;
390
+ refreshCartIndicator(): Promise<void>;
391
+ getEstimatedCart(): Promise<CartState>;
392
+ addToCart(productId: string, quantity?: number, selections?: SelectedOptionsAndModifiers): Promise<CartOperationResult>;
393
+ removeLineItems(lineItemIds: string[]): Promise<CartOperationResult>;
394
+ updateLineItemQuantity(lineItemId: string, quantity: number): Promise<CartOperationResult>;
395
+ clearCart(): Promise<void>;
396
+ applyCoupon(couponCode: string): Promise<CartOperationResult>;
397
+ removeCoupon(): Promise<CartOperationResult>;
398
+ }
399
+ /**
400
+ * Context marker for client-side Wix Stores operations.
401
+ */
402
+ declare const WIX_STORES_CONTEXT: _jay_framework_runtime.ContextMarker<WixStoresContext>;
403
+
404
+ /**
405
+ * URL parameters for product search routes.
406
+ * When used as a category listing, `category` is the prefix slug (e.g., 'polgat').
407
+ */
408
+ interface ProductSearchParams extends UrlParams {
409
+ /** Category prefix slug. When present, scopes search to this category hierarchy. */
410
+ category?: string;
411
+ }
412
+ /**
413
+ * Search sort options
414
+ */
415
+ type SearchSortOption = 'relevance' | 'priceAsc' | 'priceDesc' | 'newest' | 'nameAsc' | 'nameDesc';
416
+ /**
417
+ * Category info carried forward from slow to fast phase
418
+ */
419
+ type CategoryInfos = ProductSearchSlowViewState['filters']['categoryFilter']['categories'];
420
+ /**
421
+ * Data carried forward from slow rendering to fast rendering
422
+ */
423
+ interface SearchSlowCarryForward {
424
+ searchFields: string;
425
+ fuzzySearch: boolean;
426
+ categories: CategoryInfos;
427
+ /** Root category ID when scoped to a category prefix (always applied, hidden from UI) */
428
+ baseCategoryId: string | null;
429
+ }
430
+ /**
431
+ * Data carried forward from fast rendering to interactive phase
432
+ */
433
+ interface SearchFastCarryForward {
434
+ searchFields: string;
435
+ fuzzySearch: boolean;
436
+ categories: CategoryInfos;
437
+ /** Root category ID when scoped to a category prefix (always applied, hidden from UI) */
438
+ baseCategoryId: string | null;
439
+ }
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>>;
457
+
458
+ declare enum MediaType {
459
+ IMAGE,
460
+ VIDEO
461
+ }
462
+
463
+ interface MediaViewState {
464
+ url: string,
465
+ mediaType: MediaType,
466
+ thumbnail_50x50: string
467
+ }
468
+
469
+ interface MediaRefs {}
470
+
471
+ declare enum Selected {
472
+ selected,
473
+ notSelected
474
+ }
475
+
476
+ interface AvailableMediaOfMediaGalleryViewState {
477
+ mediaId: string,
478
+ media: MediaViewState,
479
+ selected: Selected
480
+ }
481
+
482
+ interface MediaGalleryViewState {
483
+ selectedMedia: MediaViewState,
484
+ availableMedia: Array<AvailableMediaOfMediaGalleryViewState>
485
+ }
486
+
487
+
488
+ interface MediaGalleryRefs {
489
+ selectedMedia: MediaRefs,
490
+ availableMedia: {
491
+ selected: HTMLElementCollectionProxy<AvailableMediaOfMediaGalleryViewState, HTMLImageElement | HTMLDivElement>,
492
+ media: MediaRefs
493
+ }
494
+ }
495
+
496
+ declare enum ProductType {
497
+ PHYSICAL,
498
+ DIGITAL
499
+ }
500
+
501
+ declare enum StockStatus {
502
+ OUT_OF_STOCK,
503
+ IN_STOCK
504
+ }
505
+
506
+ interface QuantityOfProductPageViewState {
507
+ quantity: number
508
+ }
509
+
510
+ declare enum OptionRenderType {
511
+ TEXT_CHOICES,
512
+ COLOR_SWATCH_CHOICES
513
+ }
514
+
515
+ interface ChoiceOfOptionOfProductPageViewState {
516
+ choiceId: string,
517
+ choiceType: ChoiceType,
518
+ name: string,
519
+ colorCode: string,
520
+ inStock: boolean,
521
+ isSelected: boolean
522
+ }
523
+
524
+ interface OptionOfProductPageViewState {
525
+ _id: string,
526
+ name: string,
527
+ optionRenderType: OptionRenderType,
528
+ textChoiceSelection: string,
529
+ choices: Array<ChoiceOfOptionOfProductPageViewState>
530
+ }
531
+
532
+ interface InfoSectionOfProductPageViewState {
533
+ _id: string,
534
+ title: string,
535
+ plainDescription: string
536
+ }
537
+
538
+ declare enum ModifierType {
539
+ TEXT_CHOICES,
540
+ COLOR_SWATCH_CHOICES,
541
+ FREE_TEXT
542
+ }
543
+
544
+ declare enum ChoiceType {
545
+ CHOICE_TEXT,
546
+ ONE_COLOR
547
+ }
548
+
549
+ declare enum ChoiceType {
550
+ CHOICE_TEXT,
551
+ ONE_COLOR
552
+ }
553
+
554
+ interface ChoiceOfModifierOfProductPageViewState {
555
+ choiceId: string,
556
+ choiceType: ChoiceType,
557
+ name: string,
558
+ colorCode: string,
559
+ isSelected: boolean
560
+ }
561
+
562
+ interface ModifierOfProductPageViewState {
563
+ _id: string,
564
+ name: string,
565
+ modifierType: ModifierType,
566
+ textModifierSelection: string,
567
+ textInputLength: number,
568
+ textInputRequired: boolean,
569
+ choices: Array<ChoiceOfModifierOfProductPageViewState>
570
+ }
571
+
572
+ interface PropOfTagOfSeoDatumOfProductPageViewState {
573
+ key: string,
574
+ value: string
575
+ }
576
+
577
+ interface MetaOfTagOfSeoDatumOfProductPageViewState {
578
+ key: string,
579
+ value: string
580
+ }
581
+
582
+ interface TagOfSeoDatumOfProductPageViewState {
583
+ position: string,
584
+ type: string,
585
+ props: Array<PropOfTagOfSeoDatumOfProductPageViewState>,
586
+ meta: Array<MetaOfTagOfSeoDatumOfProductPageViewState>,
587
+ children: string
588
+ }
589
+
590
+ interface KeywordOfSettingOfSeoDatumOfProductPageViewState {
591
+ term: string,
592
+ isMain: boolean,
593
+ origin: string
594
+ }
595
+
596
+ interface SettingOfSeoDatumOfProductPageViewState {
597
+ preventAutoRedirect: boolean,
598
+ keywords: Array<KeywordOfSettingOfSeoDatumOfProductPageViewState>
599
+ }
600
+
601
+ interface SeoDatumOfProductPageViewState {
602
+ tags: Array<TagOfSeoDatumOfProductPageViewState>,
603
+ settings: SettingOfSeoDatumOfProductPageViewState
604
+ }
605
+
606
+ interface ProductPageViewState {
607
+ _id: string,
608
+ productName: string,
609
+ mediaGallery: MediaGalleryViewState,
610
+ description: string,
611
+ brand: string,
612
+ ribbon: string,
613
+ productType: ProductType,
614
+ sku: string,
615
+ price: string,
616
+ strikethroughPrice: string,
617
+ pricePerUnit: string,
618
+ stockStatus: StockStatus,
619
+ quantity: QuantityOfProductPageViewState,
620
+ actionsEnabled: boolean,
621
+ options: Array<OptionOfProductPageViewState>,
622
+ infoSections: Array<InfoSectionOfProductPageViewState>,
623
+ modifiers: Array<ModifierOfProductPageViewState>,
624
+ seoData: SeoDatumOfProductPageViewState
625
+ }
626
+
627
+ type ProductPageSlowViewState = Pick<ProductPageViewState, '_id' | 'productName' | 'description' | 'brand' | 'ribbon' | 'productType'> & {
628
+ options: Array<Pick<ProductPageViewState['options'][number], '_id' | 'name' | 'optionRenderType'> & {
629
+ choices: Array<Pick<ProductPageViewState['options'][number]['choices'][number], 'choiceId' | 'choiceType' | 'name' | 'colorCode' | 'inStock'>>;
630
+ }>;
631
+ infoSections: Array<ProductPageViewState['infoSections'][number]>;
632
+ modifiers: Array<Pick<ProductPageViewState['modifiers'][number], '_id' | 'name' | 'modifierType' | 'textInputLength' | 'textInputRequired'> & {
633
+ choices: Array<Pick<ProductPageViewState['modifiers'][number]['choices'][number], 'choiceId' | 'choiceType' | 'name' | 'colorCode'>>;
634
+ }>;
635
+ seoData: ProductPageViewState['seoData'];
636
+ };
637
+
638
+ type ProductPageFastViewState = Pick<ProductPageViewState, 'sku' | 'price' | 'strikethroughPrice' | 'pricePerUnit' | 'stockStatus' | 'actionsEnabled'> & {
639
+ mediaGallery: ProductPageViewState['mediaGallery'];
640
+ quantity: ProductPageViewState['quantity'];
641
+ options: Array<Pick<ProductPageViewState['options'][number], '_id' | 'textChoiceSelection'> & {
642
+ choices: Array<Pick<ProductPageViewState['options'][number]['choices'][number], 'choiceId' | 'isSelected'>>;
643
+ }>;
644
+ modifiers: Array<Pick<ProductPageViewState['modifiers'][number], '_id' | 'textModifierSelection'> & {
645
+ choices: Array<Pick<ProductPageViewState['modifiers'][number]['choices'][number], 'choiceId' | 'isSelected'>>;
646
+ }>;
647
+ };
648
+
649
+ type ProductPageInteractiveViewState = Pick<ProductPageViewState, 'sku' | 'price' | 'strikethroughPrice' | 'pricePerUnit' | 'stockStatus' | 'actionsEnabled'> & {
650
+ mediaGallery: ProductPageViewState['mediaGallery'];
651
+ quantity: ProductPageViewState['quantity'];
652
+ options: Array<Pick<ProductPageViewState['options'][number], '_id' | 'textChoiceSelection'> & {
653
+ choices: Array<Pick<ProductPageViewState['options'][number]['choices'][number], 'choiceId' | 'isSelected'>>;
654
+ }>;
655
+ modifiers: Array<Pick<ProductPageViewState['modifiers'][number], '_id' | 'textModifierSelection'> & {
656
+ choices: Array<Pick<ProductPageViewState['modifiers'][number]['choices'][number], 'choiceId' | 'isSelected'>>;
657
+ }>;
658
+ };
659
+
660
+
661
+ interface ProductPageRefs {
662
+ addToCartButton: HTMLElementProxy<ProductPageViewState, HTMLButtonElement>,
663
+ buyNowButton: HTMLElementProxy<ProductPageViewState, HTMLButtonElement>,
664
+ mediaGallery: MediaGalleryRefs,
665
+ quantity: {
666
+ decrementButton: HTMLElementProxy<QuantityOfProductPageViewState, HTMLButtonElement>,
667
+ incrementButton: HTMLElementProxy<QuantityOfProductPageViewState, HTMLButtonElement>,
668
+ quantity: HTMLElementProxy<QuantityOfProductPageViewState, HTMLInputElement>
669
+ },
670
+ options: {
671
+ textChoice: HTMLElementCollectionProxy<OptionOfProductPageViewState, HTMLSelectElement>,
672
+ choices: {
673
+ choiceButton: HTMLElementCollectionProxy<ChoiceOfOptionOfProductPageViewState, HTMLButtonElement>
674
+ }
675
+ },
676
+ modifiers: {
677
+ textModifier: HTMLElementCollectionProxy<ModifierOfProductPageViewState, HTMLSelectElement>,
678
+ textInput: HTMLElementCollectionProxy<ModifierOfProductPageViewState, HTMLInputElement | HTMLAreaElement>,
679
+ choices: {
680
+ choiceButton: HTMLElementCollectionProxy<ChoiceOfModifierOfProductPageViewState, HTMLButtonElement>
681
+ }
682
+ }
683
+ }
684
+
685
+ /**
686
+ * URL parameters for product page routes.
687
+ * Supports /products/[slug] and /products/polgat/[slug] (category-prefixed).
688
+ */
689
+ interface ProductPageParams extends UrlParams {
690
+ slug: string;
691
+ /** Category prefix from static route (e.g., 'polgat'). Undefined for unprefixed routes. */
692
+ category?: string;
693
+ }
694
+ interface InteractiveVariant {
695
+ _id: string;
696
+ sku: string;
697
+ price: string;
698
+ strikethroughPrice: string;
699
+ choices: OptionChoice[];
700
+ mediaId?: string;
701
+ inventoryStatus: StockStatus;
702
+ }
703
+ /**
704
+ * Data carried forward from slow rendering to fast rendering
705
+ */
706
+ interface ProductSlowCarryForward {
707
+ productId: string;
708
+ mediaGallery: MediaGalleryViewState;
709
+ options: ProductPageFastViewState['options'];
710
+ modifiers: ProductPageFastViewState['modifiers'];
711
+ pricePerUnit: string;
712
+ stockStatus: StockStatus;
713
+ variants: InteractiveVariant[];
714
+ }
715
+ /**
716
+ * Data carried forward from fast rendering to interactive phase
717
+ */
718
+ interface ProductFastCarryForward {
719
+ productId: string;
720
+ variants: InteractiveVariant[];
721
+ }
722
+ /**
723
+ * Product Page Full-Stack Component
724
+ *
725
+ * A complete headless product page component with server-side rendering,
726
+ * real-time inventory, and client-side interactivity.
727
+ *
728
+ * Usage:
729
+ * ```typescript
730
+ * import { productPage } from '@jay-framework/wix-stores';
731
+ *
732
+ * // The component will automatically load products and render pages
733
+ * ```
734
+ */
735
+ declare const productPage: _jay_framework_fullstack_component.JayStackComponentDefinition<ProductPageRefs, ProductPageSlowViewState, ProductPageFastViewState, ProductPageInteractiveViewState, [ProductSlowCarryForward, WixStoresService], [Signals<ProductPageFastViewState>, ProductFastCarryForward, WixStoresContext], PageProps & ProductPageParams, ProductPageParams, _jay_framework_component.JayComponentCore<PageProps & ProductPageParams, ProductPageInteractiveViewState>>;
736
+
737
+ interface CategoryOfCategoryListViewState {
738
+ _id: string,
739
+ name: string,
740
+ slug: string,
741
+ description: string,
742
+ productCount: number,
743
+ imageUrl: string
744
+ }
745
+
746
+ interface CategoryListViewState {
747
+ categories: Array<CategoryOfCategoryListViewState>,
748
+ hasCategories: boolean
749
+ }
750
+
751
+ type CategoryListSlowViewState = Pick<CategoryListViewState, 'hasCategories'> & {
752
+ categories: Array<CategoryListViewState['categories'][number]>;
753
+ };
754
+
755
+ type CategoryListFastViewState = {};
756
+
757
+ type CategoryListInteractiveViewState = {};
758
+
759
+
760
+ interface CategoryListRefs {
761
+ categories: {
762
+ categoryLink: HTMLElementCollectionProxy<CategoryOfCategoryListViewState, HTMLAnchorElement>
763
+ }
764
+ }
765
+
766
+ /**
767
+ * Category List Full-Stack Component
768
+ *
769
+ * A headless component that displays a grid of store categories.
770
+ * Categories are loaded during slow rendering as they rarely change.
771
+ *
772
+ * Usage:
773
+ * ```html
774
+ * <script type="application/jay-headless"
775
+ * plugin="@jay-framework/wix-stores"
776
+ * contract="category-list"
777
+ * key="categoryList"
778
+ * ></script>
779
+ *
780
+ * <div class="categories-grid">
781
+ * <article forEach="categoryList.categories" trackBy="_id">
782
+ * <a href="/categories/{slug}" ref="categoryList.categories.categoryLink">
783
+ * <img src="{imageUrl}" alt="{name}" />
784
+ * <h2>{name}</h2>
785
+ * <span>{productCount} products</span>
786
+ * </a>
787
+ * </article>
788
+ * </div>
789
+ * ```
790
+ */
791
+ declare const categoryList: _jay_framework_fullstack_component.JayStackComponentDefinition<CategoryListRefs, CategoryListSlowViewState, CategoryListFastViewState, CategoryListInteractiveViewState, [Record<string, never>, WixStoresService], [], PageProps, {}, _jay_framework_component.JayComponentCore<PageProps, CategoryListInteractiveViewState>> & {
792
+ withFastRender<NewCarryForward extends object>(fastRender: _jay_framework_fullstack_component.RenderFast<[Record<string, never>, WixStoresService], PageProps, CategoryListFastViewState, NewCarryForward>): _jay_framework_fullstack_component.JayStackComponentDefinition<CategoryListRefs, CategoryListSlowViewState, CategoryListFastViewState, CategoryListInteractiveViewState, [Record<string, never>, WixStoresService], [_jay_framework_fullstack_component.Signals<CategoryListFastViewState>, NewCarryForward], PageProps, {}, _jay_framework_component.JayComponentCore<PageProps, CategoryListInteractiveViewState>> & {
793
+ withClientDefaults(fn: (props: PageProps) => {
794
+ viewState: CategoryListFastViewState;
795
+ carryForward?: any;
796
+ }): _jay_framework_fullstack_component.JayStackComponentDefinition<CategoryListRefs, CategoryListSlowViewState, CategoryListFastViewState, CategoryListInteractiveViewState, [Record<string, never>, WixStoresService], [_jay_framework_fullstack_component.Signals<CategoryListFastViewState>, NewCarryForward], PageProps, {}, _jay_framework_component.JayComponentCore<PageProps, CategoryListInteractiveViewState>> & /*elided*/ any;
797
+ withInteractive(comp: _jay_framework_component.ComponentConstructor<PageProps, CategoryListRefs, CategoryListInteractiveViewState, [_jay_framework_fullstack_component.Signals<CategoryListFastViewState>, NewCarryForward], _jay_framework_component.JayComponentCore<PageProps, CategoryListInteractiveViewState>>): _jay_framework_fullstack_component.JayStackComponentDefinition<CategoryListRefs, CategoryListSlowViewState, CategoryListFastViewState, CategoryListInteractiveViewState, [Record<string, never>, WixStoresService], [_jay_framework_fullstack_component.Signals<CategoryListFastViewState>, NewCarryForward], PageProps, {}, _jay_framework_component.JayComponentCore<PageProps, CategoryListInteractiveViewState>>;
798
+ };
799
+ 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
+ };
801
+
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
+ /**
872
+ * Input for getProductBySlug action
873
+ */
874
+ interface GetProductBySlugInput {
875
+ /** Product URL slug */
876
+ slug: string;
877
+ }
878
+ /**
879
+ * Search products using the Wix Stores Catalog V3 searchProducts API.
880
+ *
881
+ * Uses server-side filtering and sorting for optimal performance:
882
+ * - Text search on name and description
883
+ * - Price range filtering
884
+ * - Stock status filtering
885
+ * - Category filtering
886
+ * - Price/name/date sorting
887
+ *
888
+ * @see https://dev.wix.com/docs/sdk/backend-modules/stores/catalog-v3/products-v3/search-products
889
+ *
890
+ * @example
891
+ * ```typescript
892
+ * const results = await searchProducts({
893
+ * query: 'shoes',
894
+ * filters: { inStockOnly: true, categoryIds: ['cat-123'] },
895
+ * sortBy: 'price_asc',
896
+ * pageSize: 12
897
+ * });
898
+ * ```
899
+ */
900
+ declare const searchProducts: _jay_framework_fullstack_component.JayAction<SearchProductsInput, SearchProductsOutput> & _jay_framework_fullstack_component.JayActionDefinition<SearchProductsInput, SearchProductsOutput, [WixStoresService]>;
901
+ /**
902
+ * Get a single product by its URL slug.
903
+ *
904
+ * @example
905
+ * ```typescript
906
+ * const product = await getProductBySlug({ slug: 'blue-sneakers' });
907
+ * ```
908
+ */
909
+ declare const getProductBySlug: _jay_framework_fullstack_component.JayAction<GetProductBySlugInput, ProductCardViewState> & _jay_framework_fullstack_component.JayActionDefinition<GetProductBySlugInput, ProductCardViewState, [WixStoresService]>;
910
+ /**
911
+ * Get available categories for filtering.
912
+ *
913
+ * @example
914
+ * ```typescript
915
+ * const categories = await getCategories();
916
+ * ```
917
+ */
918
+ declare const getCategories: _jay_framework_fullstack_component.JayAction<Record<string, never>, {
919
+ categoryId: string;
920
+ categoryName: string;
921
+ }[]> & _jay_framework_fullstack_component.JayActionDefinition<Record<string, never>, {
922
+ categoryId: string;
923
+ categoryName: string;
924
+ }[], [WixStoresService]>;
925
+
926
+ declare const init: _jay_framework_fullstack_component.JayInit<WixStoresInitData>;
927
+
928
+ /**
929
+ * Setup handler for wix-stores plugin (Design Log #87, #10).
930
+ *
931
+ * Validates that wix-server-client is configured.
932
+ * Creates config/.wix-stores.yaml with example category prefix config if missing.
933
+ * Generates category tree reference for agent discovery.
934
+ */
935
+
936
+ declare function setupWixStores(ctx: PluginSetupContext): Promise<PluginSetupResult>;
937
+ /**
938
+ * Generate a YAML reference file with the full category tree.
939
+ * Shows all categories with IDs, names, product counts, and parent-child hierarchy.
940
+ */
941
+ declare function generateWixStoresReferences(ctx: PluginReferencesContext): Promise<PluginReferencesResult>;
942
+
943
+ export { type CategoryPrefixConfig, type GetProductBySlugInput, type PriceAggregationData, type PriceRangeBucket, type ProductPageParams, type ProductSearchFilters, type ProductSearchParams, type ProductSortField, type SearchProductsInput, type SearchProductsOutput, type SearchSortOption, WIX_STORES_CONTEXT, WIX_STORES_SERVICE_MARKER, type WixStoresContext, type WixStoresInitData, type WixStoresService, type WixStoresServiceOptions, categoryList, generateWixStoresReferences, getCategories, getProductBySlug, init, productPage, productSearch, provideWixStoresService, searchProducts, setupWixStores };