@wix/headless-stores 0.0.29 → 0.0.31

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.
Files changed (69) hide show
  1. package/cjs/dist/react/Category.d.ts +30 -0
  2. package/cjs/dist/react/Category.js +30 -0
  3. package/cjs/dist/react/Collection.d.ts +145 -0
  4. package/cjs/dist/react/Collection.js +145 -0
  5. package/cjs/dist/react/FilteredCollection.d.ts +134 -0
  6. package/cjs/dist/react/FilteredCollection.js +134 -0
  7. package/cjs/dist/react/Product.d.ts +43 -18
  8. package/cjs/dist/react/Product.js +43 -18
  9. package/cjs/dist/react/ProductActions.d.ts +30 -0
  10. package/cjs/dist/react/ProductActions.js +30 -0
  11. package/cjs/dist/react/ProductModifiers.d.ts +172 -0
  12. package/cjs/dist/react/ProductModifiers.js +172 -0
  13. package/cjs/dist/react/ProductVariantSelector.d.ts +118 -0
  14. package/cjs/dist/react/ProductVariantSelector.js +118 -0
  15. package/cjs/dist/react/ProductsList.d.ts +107 -16
  16. package/cjs/dist/react/ProductsList.js +101 -16
  17. package/cjs/dist/react/RelatedProducts.d.ts +55 -0
  18. package/cjs/dist/react/RelatedProducts.js +55 -0
  19. package/cjs/dist/react/SelectedVariant.d.ts +59 -0
  20. package/cjs/dist/react/SelectedVariant.js +59 -0
  21. package/cjs/dist/react/SocialSharing.d.ts +82 -0
  22. package/cjs/dist/react/SocialSharing.js +82 -0
  23. package/cjs/dist/react/Sort.d.ts +22 -0
  24. package/cjs/dist/react/Sort.js +22 -0
  25. package/cjs/dist/services/category-service.d.ts +87 -0
  26. package/cjs/dist/services/category-service.js +87 -0
  27. package/cjs/dist/services/collection-service.d.ts +89 -0
  28. package/cjs/dist/services/collection-service.js +89 -0
  29. package/cjs/dist/services/product-service.d.ts +76 -0
  30. package/cjs/dist/services/product-service.js +76 -0
  31. package/cjs/dist/services/products-list-service.d.ts +93 -0
  32. package/cjs/dist/services/products-list-service.js +93 -0
  33. package/cjs/dist/services/related-products-service.d.ts +75 -0
  34. package/cjs/dist/services/related-products-service.js +75 -0
  35. package/dist/react/Category.d.ts +30 -0
  36. package/dist/react/Category.js +30 -0
  37. package/dist/react/Collection.d.ts +145 -0
  38. package/dist/react/Collection.js +145 -0
  39. package/dist/react/FilteredCollection.d.ts +134 -0
  40. package/dist/react/FilteredCollection.js +134 -0
  41. package/dist/react/Product.d.ts +43 -18
  42. package/dist/react/Product.js +43 -18
  43. package/dist/react/ProductActions.d.ts +30 -0
  44. package/dist/react/ProductActions.js +30 -0
  45. package/dist/react/ProductModifiers.d.ts +172 -0
  46. package/dist/react/ProductModifiers.js +172 -0
  47. package/dist/react/ProductVariantSelector.d.ts +118 -0
  48. package/dist/react/ProductVariantSelector.js +118 -0
  49. package/dist/react/ProductsList.d.ts +107 -16
  50. package/dist/react/ProductsList.js +101 -16
  51. package/dist/react/RelatedProducts.d.ts +55 -0
  52. package/dist/react/RelatedProducts.js +55 -0
  53. package/dist/react/SelectedVariant.d.ts +59 -0
  54. package/dist/react/SelectedVariant.js +59 -0
  55. package/dist/react/SocialSharing.d.ts +82 -0
  56. package/dist/react/SocialSharing.js +82 -0
  57. package/dist/react/Sort.d.ts +22 -0
  58. package/dist/react/Sort.js +22 -0
  59. package/dist/services/category-service.d.ts +87 -0
  60. package/dist/services/category-service.js +87 -0
  61. package/dist/services/collection-service.d.ts +89 -0
  62. package/dist/services/collection-service.js +89 -0
  63. package/dist/services/product-service.d.ts +76 -0
  64. package/dist/services/product-service.js +76 -0
  65. package/dist/services/products-list-service.d.ts +93 -0
  66. package/dist/services/products-list-service.js +93 -0
  67. package/dist/services/related-products-service.d.ts +75 -0
  68. package/dist/services/related-products-service.js +75 -0
  69. package/package.json +1 -1
@@ -8,10 +8,33 @@ import { ProductService, ProductServiceDefinition, } from "@wix/headless-stores/
8
8
  * This component sets up the necessary services for managing products list state.
9
9
  *
10
10
  * @component
11
- * @param props - Component props
12
- * @param props.children - Child components that will have access to the ProductsList service
13
- * @param props.productsListConfig - Configuration for the ProductsList service
14
- * @returns JSX element wrapping children with ProductsList service context
11
+ * @example
12
+ * ```tsx
13
+ * import { ProductsList } from '@wix/stores/components';
14
+ *
15
+ * function ProductsListPage() {
16
+ * return (
17
+ * <ProductsList.Root
18
+ * productsListConfig={{
19
+ * collectionId: 'my-collection-id',
20
+ * filters: { price: { min: 10, max: 100 } }
21
+ * }}
22
+ * >
23
+ * <ProductsList.Grid>
24
+ * {({ products, isLoading, error }) => (
25
+ * <div>
26
+ * {isLoading && <div>Loading products...</div>}
27
+ * {error && <div>Error: {error}</div>}
28
+ * {products.map(product => (
29
+ * <div key={product.id}>{product.name}</div>
30
+ * ))}
31
+ * </div>
32
+ * )}
33
+ * </ProductsList.Grid>
34
+ * </ProductsList.Root>
35
+ * );
36
+ * }
37
+ * ```
15
38
  */
16
39
  export function Root(props) {
17
40
  return (_jsx(WixServices, { servicesMap: createServicesMap().addService(ProductsListServiceDefinition, ProductListService, props.productsListConfig), children: props.children }));
@@ -21,9 +44,24 @@ export function Root(props) {
21
44
  * Only displays its children when there are no products, no loading state, and no errors.
22
45
  *
23
46
  * @component
24
- * @param props - Component props
25
- * @param props.children - Content to display when products list is empty (can be a render function or ReactNode)
26
- * @returns JSX element or null based on products list state
47
+ * @example
48
+ * ```tsx
49
+ * import { ProductsList } from '@wix/stores/components';
50
+ *
51
+ * function EmptyProductsMessage() {
52
+ * return (
53
+ * <ProductsList.EmptyState>
54
+ * {() => (
55
+ * <div className="empty-state">
56
+ * <h3>No products found</h3>
57
+ * <p>Try adjusting your search or filter criteria</p>
58
+ * <button>Clear Filters</button>
59
+ * </div>
60
+ * )}
61
+ * </ProductsList.EmptyState>
62
+ * );
63
+ * }
64
+ * ```
27
65
  */
28
66
  export function EmptyState(props) {
29
67
  const { isLoading, error, products } = useService(ProductsListServiceDefinition);
@@ -42,9 +80,23 @@ export function EmptyState(props) {
42
80
  * Only displays its children when the products list is currently loading.
43
81
  *
44
82
  * @component
45
- * @param props - Component props
46
- * @param props.children - Content to display during loading (can be a render function or ReactNode)
47
- * @returns JSX element or null based on loading state
83
+ * @example
84
+ * ```tsx
85
+ * import { ProductsList } from '@wix/stores/components';
86
+ *
87
+ * function ProductsLoading() {
88
+ * return (
89
+ * <ProductsList.Loading>
90
+ * {() => (
91
+ * <div className="loading-spinner">
92
+ * <div>Loading products...</div>
93
+ * <div className="spinner"></div>
94
+ * </div>
95
+ * )}
96
+ * </ProductsList.Loading>
97
+ * );
98
+ * }
99
+ * ```
48
100
  */
49
101
  export function Loading(props) {
50
102
  const { isLoading } = useService(ProductsListServiceDefinition);
@@ -62,9 +114,26 @@ export function Loading(props) {
62
114
  * Only displays its children when an error has occurred.
63
115
  *
64
116
  * @component
65
- * @param props - Component props
66
- * @param props.children - Content to display during error state (can be a render function or ReactNode)
67
- * @returns JSX element or null based on error state
117
+ * @example
118
+ * ```tsx
119
+ * import { ProductsList } from '@wix/stores/components';
120
+ *
121
+ * function ProductsError() {
122
+ * return (
123
+ * <ProductsList.Error>
124
+ * {({ error }) => (
125
+ * <div className="error-state">
126
+ * <h3>Error loading products</h3>
127
+ * <p>{error}</p>
128
+ * <button onClick={() => window.location.reload()}>
129
+ * Try Again
130
+ * </button>
131
+ * </div>
132
+ * )}
133
+ * </ProductsList.Error>
134
+ * );
135
+ * }
136
+ * ```
68
137
  */
69
138
  export function Error(props) {
70
139
  const { error } = useService(ProductsListServiceDefinition);
@@ -82,9 +151,25 @@ export function Error(props) {
82
151
  * Only renders when products are successfully loaded (not loading, no error, and has products).
83
152
  *
84
153
  * @component
85
- * @param props - Component props
86
- * @param props.children - Content to display for each product (can be a render function receiving product data or ReactNode)
87
- * @returns Array of JSX elements for each product or null if no products to display
154
+ * @example
155
+ * ```tsx
156
+ * import { ProductsList } from '@wix/stores/components';
157
+ *
158
+ * function ProductsGrid() {
159
+ * return (
160
+ * <ProductsList.ItemContent>
161
+ * {({ product }) => (
162
+ * <div className="product-card">
163
+ * <img src={product.media?.main?.image} alt={product.name} />
164
+ * <h3>{product.name}</h3>
165
+ * <p>{product.actualPriceRange?.minValue?.formattedAmount}</p>
166
+ * <button>View Details</button>
167
+ * </div>
168
+ * )}
169
+ * </ProductsList.ItemContent>
170
+ * );
171
+ * }
172
+ * ```
88
173
  */
89
174
  export function ItemContent(props) {
90
175
  const { products, isLoading, error } = useService(ProductsListServiceDefinition);
@@ -26,6 +26,35 @@ export interface ListRenderProps {
26
26
  * Headless component for displaying related products list
27
27
  *
28
28
  * @component
29
+ * @example
30
+ * ```tsx
31
+ * import { RelatedProducts } from '@wix/stores/components';
32
+ *
33
+ * function RecommendedProducts() {
34
+ * return (
35
+ * <RelatedProducts.List>
36
+ * {({ products, isLoading, error, hasProducts, refresh }) => (
37
+ * <div>
38
+ * <h3>You might also like</h3>
39
+ * {isLoading && <div>Loading related products...</div>}
40
+ * {error && <div>Error: {error}</div>}
41
+ * {hasProducts && (
42
+ * <div className="products-grid">
43
+ * {products.map(product => (
44
+ * <div key={product.id}>
45
+ * <h4>{product.name}</h4>
46
+ * <p>{product.price?.price} {product.price?.currency}</p>
47
+ * </div>
48
+ * ))}
49
+ * </div>
50
+ * )}
51
+ * <button onClick={refresh}>Refresh Recommendations</button>
52
+ * </div>
53
+ * )}
54
+ * </RelatedProducts.List>
55
+ * );
56
+ * }
57
+ * ```
29
58
  */
30
59
  export declare const List: (props: ListProps) => React.ReactNode;
31
60
  /**
@@ -58,5 +87,31 @@ export interface ItemRenderProps {
58
87
  * Headless component for individual related product item
59
88
  *
60
89
  * @component
90
+ * @example
91
+ * ```tsx
92
+ * import { RelatedProducts } from '@wix/stores/components';
93
+ *
94
+ * function RelatedProductCard({ product }) {
95
+ * return (
96
+ * <RelatedProducts.Item product={product}>
97
+ * {({ title, image, price, available, description, onQuickAdd }) => (
98
+ * <div className={`related-product ${!available ? 'unavailable' : ''}`}>
99
+ * {image && <img src={image} alt={title} />}
100
+ * <h4>{title}</h4>
101
+ * {description && <p>{description}</p>}
102
+ * <div className="price">{price}</div>
103
+ * {!available && <div className="badge">Out of Stock</div>}
104
+ * <div className="actions">
105
+ * <button onClick={onQuickAdd} disabled={!available}>
106
+ * Quick Add
107
+ * </button>
108
+ * <a href={`/product/${product.slug}`}>View Details</a>
109
+ * </div>
110
+ * </div>
111
+ * )}
112
+ * </RelatedProducts.Item>
113
+ * );
114
+ * }
115
+ * ```
61
116
  */
62
117
  export declare const Item: (props: ItemProps) => React.ReactNode;
@@ -7,6 +7,35 @@ import { InventoryAvailabilityStatus, } from "@wix/auto_sdk_stores_products-v-3"
7
7
  * Headless component for displaying related products list
8
8
  *
9
9
  * @component
10
+ * @example
11
+ * ```tsx
12
+ * import { RelatedProducts } from '@wix/stores/components';
13
+ *
14
+ * function RecommendedProducts() {
15
+ * return (
16
+ * <RelatedProducts.List>
17
+ * {({ products, isLoading, error, hasProducts, refresh }) => (
18
+ * <div>
19
+ * <h3>You might also like</h3>
20
+ * {isLoading && <div>Loading related products...</div>}
21
+ * {error && <div>Error: {error}</div>}
22
+ * {hasProducts && (
23
+ * <div className="products-grid">
24
+ * {products.map(product => (
25
+ * <div key={product.id}>
26
+ * <h4>{product.name}</h4>
27
+ * <p>{product.price?.price} {product.price?.currency}</p>
28
+ * </div>
29
+ * ))}
30
+ * </div>
31
+ * )}
32
+ * <button onClick={refresh}>Refresh Recommendations</button>
33
+ * </div>
34
+ * )}
35
+ * </RelatedProducts.List>
36
+ * );
37
+ * }
38
+ * ```
10
39
  */
11
40
  export const List = (props) => {
12
41
  const service = useService(RelatedProductsServiceDefinition);
@@ -44,6 +73,32 @@ export const List = (props) => {
44
73
  * Headless component for individual related product item
45
74
  *
46
75
  * @component
76
+ * @example
77
+ * ```tsx
78
+ * import { RelatedProducts } from '@wix/stores/components';
79
+ *
80
+ * function RelatedProductCard({ product }) {
81
+ * return (
82
+ * <RelatedProducts.Item product={product}>
83
+ * {({ title, image, price, available, description, onQuickAdd }) => (
84
+ * <div className={`related-product ${!available ? 'unavailable' : ''}`}>
85
+ * {image && <img src={image} alt={title} />}
86
+ * <h4>{title}</h4>
87
+ * {description && <p>{description}</p>}
88
+ * <div className="price">{price}</div>
89
+ * {!available && <div className="badge">Out of Stock</div>}
90
+ * <div className="actions">
91
+ * <button onClick={onQuickAdd} disabled={!available}>
92
+ * Quick Add
93
+ * </button>
94
+ * <a href={`/product/${product.slug}`}>View Details</a>
95
+ * </div>
96
+ * </div>
97
+ * )}
98
+ * </RelatedProducts.Item>
99
+ * );
100
+ * }
101
+ * ```
47
102
  */
48
103
  export const Item = (props) => {
49
104
  const { product } = props;
@@ -18,6 +18,23 @@ export interface ProductDetailsRenderProps {
18
18
  * Headless component for selected variant details display
19
19
  *
20
20
  * @component
21
+ * @example
22
+ * ```tsx
23
+ * import { SelectedVariant } from '@wix/stores/components';
24
+ *
25
+ * function VariantDetails() {
26
+ * return (
27
+ * <SelectedVariant.Details>
28
+ * {({ sku, weight }) => (
29
+ * <div>
30
+ * {sku && <div>SKU: {sku}</div>}
31
+ * {weight && <div>Weight: {weight}</div>}
32
+ * </div>
33
+ * )}
34
+ * </SelectedVariant.Details>
35
+ * );
36
+ * }
37
+ * ```
21
38
  */
22
39
  export declare const Details: (props: ProductDetailsProps) => import("react").ReactNode;
23
40
  /**
@@ -42,6 +59,28 @@ export interface PriceRenderProps {
42
59
  * Headless component for product price display
43
60
  *
44
61
  * @component
62
+ * @example
63
+ * ```tsx
64
+ * import { SelectedVariant } from '@wix/stores/components';
65
+ *
66
+ * function ProductPrice() {
67
+ * return (
68
+ * <SelectedVariant.Price>
69
+ * {({ price, compareAtPrice, currency }) => (
70
+ * <div className="price-display">
71
+ * <span className="current-price">{price}</span>
72
+ * {compareAtPrice && (
73
+ * <span className="compare-price">
74
+ * <s>{compareAtPrice}</s>
75
+ * </span>
76
+ * )}
77
+ * <span className="currency">{currency}</span>
78
+ * </div>
79
+ * )}
80
+ * </SelectedVariant.Price>
81
+ * );
82
+ * }
83
+ * ```
45
84
  */
46
85
  export declare const Price: (props: PriceProps) => import("react").ReactNode;
47
86
  /**
@@ -62,5 +101,25 @@ export interface SKURenderProps {
62
101
  * Headless component for product SKU display
63
102
  *
64
103
  * @component
104
+ * @example
105
+ * ```tsx
106
+ * import { SelectedVariant } from '@wix/stores/components';
107
+ *
108
+ * function ProductSKU() {
109
+ * return (
110
+ * <SelectedVariant.SKU>
111
+ * {({ sku }) => (
112
+ * <div>
113
+ * {sku && (
114
+ * <div className="product-sku">
115
+ * <strong>SKU:</strong> {sku}
116
+ * </div>
117
+ * )}
118
+ * </div>
119
+ * )}
120
+ * </SelectedVariant.SKU>
121
+ * );
122
+ * }
123
+ * ```
65
124
  */
66
125
  export declare const SKU: (props: SKUProps) => import("react").ReactNode;
@@ -4,6 +4,23 @@ import { SelectedVariantServiceDefinition } from "../services/selected-variant-s
4
4
  * Headless component for selected variant details display
5
5
  *
6
6
  * @component
7
+ * @example
8
+ * ```tsx
9
+ * import { SelectedVariant } from '@wix/stores/components';
10
+ *
11
+ * function VariantDetails() {
12
+ * return (
13
+ * <SelectedVariant.Details>
14
+ * {({ sku, weight }) => (
15
+ * <div>
16
+ * {sku && <div>SKU: {sku}</div>}
17
+ * {weight && <div>Weight: {weight}</div>}
18
+ * </div>
19
+ * )}
20
+ * </SelectedVariant.Details>
21
+ * );
22
+ * }
23
+ * ```
7
24
  */
8
25
  export const Details = (props) => {
9
26
  const selectedVariantService = useService(SelectedVariantServiceDefinition);
@@ -19,6 +36,28 @@ export const Details = (props) => {
19
36
  * Headless component for product price display
20
37
  *
21
38
  * @component
39
+ * @example
40
+ * ```tsx
41
+ * import { SelectedVariant } from '@wix/stores/components';
42
+ *
43
+ * function ProductPrice() {
44
+ * return (
45
+ * <SelectedVariant.Price>
46
+ * {({ price, compareAtPrice, currency }) => (
47
+ * <div className="price-display">
48
+ * <span className="current-price">{price}</span>
49
+ * {compareAtPrice && (
50
+ * <span className="compare-price">
51
+ * <s>{compareAtPrice}</s>
52
+ * </span>
53
+ * )}
54
+ * <span className="currency">{currency}</span>
55
+ * </div>
56
+ * )}
57
+ * </SelectedVariant.Price>
58
+ * );
59
+ * }
60
+ * ```
22
61
  */
23
62
  export const Price = (props) => {
24
63
  const variantService = useService(SelectedVariantServiceDefinition);
@@ -35,6 +74,26 @@ export const Price = (props) => {
35
74
  * Headless component for product SKU display
36
75
  *
37
76
  * @component
77
+ * @example
78
+ * ```tsx
79
+ * import { SelectedVariant } from '@wix/stores/components';
80
+ *
81
+ * function ProductSKU() {
82
+ * return (
83
+ * <SelectedVariant.SKU>
84
+ * {({ sku }) => (
85
+ * <div>
86
+ * {sku && (
87
+ * <div className="product-sku">
88
+ * <strong>SKU:</strong> {sku}
89
+ * </div>
90
+ * )}
91
+ * </div>
92
+ * )}
93
+ * </SelectedVariant.SKU>
94
+ * );
95
+ * }
96
+ * ```
38
97
  */
39
98
  export const SKU = (props) => {
40
99
  const selectedVariantService = useService(SelectedVariantServiceDefinition);
@@ -40,6 +40,43 @@ export interface RootRenderProps {
40
40
  * Headless component for social sharing root
41
41
  *
42
42
  * @component
43
+ * @example
44
+ * ```tsx
45
+ * import { SocialSharing } from '@wix/stores/components';
46
+ *
47
+ * function ShareProduct() {
48
+ * const productUrl = 'https://example.com/product/123';
49
+ * const productTitle = 'Amazing Product';
50
+ *
51
+ * return (
52
+ * <SocialSharing.Root>
53
+ * {({ platforms, shareCount, shareFacebook, shareTwitter, copyLink, shareNative }) => (
54
+ * <div>
55
+ * <p>Share this product ({shareCount} shares)</p>
56
+ * <div className="share-buttons">
57
+ * <button onClick={() => shareFacebook(productUrl, productTitle)}>
58
+ * Share on Facebook
59
+ * </button>
60
+ * <button onClick={() => shareTwitter(productUrl, `Check out ${productTitle}!`)}>
61
+ * Share on Twitter
62
+ * </button>
63
+ * <button onClick={() => copyLink(productUrl)}>
64
+ * Copy Link
65
+ * </button>
66
+ * <button onClick={() => shareNative({
67
+ * title: productTitle,
68
+ * text: 'Check this out!',
69
+ * url: productUrl
70
+ * })}>
71
+ * Share
72
+ * </button>
73
+ * </div>
74
+ * </div>
75
+ * )}
76
+ * </SocialSharing.Root>
77
+ * );
78
+ * }
79
+ * ```
43
80
  */
44
81
  export declare const Root: (props: RootProps) => React.ReactNode;
45
82
  /**
@@ -66,6 +103,26 @@ export interface PlatformRenderProps {
66
103
  * Headless component for individual social platform
67
104
  *
68
105
  * @component
106
+ * @example
107
+ * ```tsx
108
+ * import { SocialSharing } from '@wix/stores/components';
109
+ *
110
+ * function SocialButton({ platform, onClick }) {
111
+ * return (
112
+ * <SocialSharing.Platform platform={platform} onClick={onClick}>
113
+ * {({ platform, onSelect }) => (
114
+ * <button
115
+ * onClick={onSelect}
116
+ * className={`social-btn social-btn-${platform.name.toLowerCase()}`}
117
+ * >
118
+ * <span className="icon">{platform.icon}</span>
119
+ * Share on {platform.name}
120
+ * </button>
121
+ * )}
122
+ * </SocialSharing.Platform>
123
+ * );
124
+ * }
125
+ * ```
69
126
  */
70
127
  export declare const Platform: (props: PlatformProps) => React.ReactNode;
71
128
  /**
@@ -108,5 +165,30 @@ export interface PlatformsRenderProps {
108
165
  * Headless component for social sharing platforms with logic
109
166
  *
110
167
  * @component
168
+ * @example
169
+ * ```tsx
170
+ * import { SocialSharing } from '@wix/stores/components';
171
+ *
172
+ * function SocialShareButtons() {
173
+ * return (
174
+ * <SocialSharing.Platforms
175
+ * url="https://example.com/product/123"
176
+ * title="Amazing Product"
177
+ * description="Check out this amazing product!"
178
+ * hashtags={['product', 'amazing']}
179
+ * >
180
+ * {({ platforms, shareFacebook, shareTwitter, shareLinkedIn, copyLink, shareNative }) => (
181
+ * <div className="social-platforms">
182
+ * <button onClick={shareFacebook}>Share on Facebook</button>
183
+ * <button onClick={shareTwitter}>Share on Twitter</button>
184
+ * <button onClick={shareLinkedIn}>Share on LinkedIn</button>
185
+ * <button onClick={() => copyLink()}>Copy Link</button>
186
+ * <button onClick={() => shareNative()}>Share</button>
187
+ * </div>
188
+ * )}
189
+ * </SocialSharing.Platforms>
190
+ * );
191
+ * }
192
+ * ```
111
193
  */
112
194
  export declare const Platforms: (props: PlatformsProps) => React.ReactNode;
@@ -6,6 +6,43 @@ import { SignalsServiceDefinition } from "@wix/services-definitions/core-service
6
6
  * Headless component for social sharing root
7
7
  *
8
8
  * @component
9
+ * @example
10
+ * ```tsx
11
+ * import { SocialSharing } from '@wix/stores/components';
12
+ *
13
+ * function ShareProduct() {
14
+ * const productUrl = 'https://example.com/product/123';
15
+ * const productTitle = 'Amazing Product';
16
+ *
17
+ * return (
18
+ * <SocialSharing.Root>
19
+ * {({ platforms, shareCount, shareFacebook, shareTwitter, copyLink, shareNative }) => (
20
+ * <div>
21
+ * <p>Share this product ({shareCount} shares)</p>
22
+ * <div className="share-buttons">
23
+ * <button onClick={() => shareFacebook(productUrl, productTitle)}>
24
+ * Share on Facebook
25
+ * </button>
26
+ * <button onClick={() => shareTwitter(productUrl, `Check out ${productTitle}!`)}>
27
+ * Share on Twitter
28
+ * </button>
29
+ * <button onClick={() => copyLink(productUrl)}>
30
+ * Copy Link
31
+ * </button>
32
+ * <button onClick={() => shareNative({
33
+ * title: productTitle,
34
+ * text: 'Check this out!',
35
+ * url: productUrl
36
+ * })}>
37
+ * Share
38
+ * </button>
39
+ * </div>
40
+ * </div>
41
+ * )}
42
+ * </SocialSharing.Root>
43
+ * );
44
+ * }
45
+ * ```
9
46
  */
10
47
  export const Root = (props) => {
11
48
  const service = useService(SocialSharingServiceDefinition);
@@ -44,6 +81,26 @@ export const Root = (props) => {
44
81
  * Headless component for individual social platform
45
82
  *
46
83
  * @component
84
+ * @example
85
+ * ```tsx
86
+ * import { SocialSharing } from '@wix/stores/components';
87
+ *
88
+ * function SocialButton({ platform, onClick }) {
89
+ * return (
90
+ * <SocialSharing.Platform platform={platform} onClick={onClick}>
91
+ * {({ platform, onSelect }) => (
92
+ * <button
93
+ * onClick={onSelect}
94
+ * className={`social-btn social-btn-${platform.name.toLowerCase()}`}
95
+ * >
96
+ * <span className="icon">{platform.icon}</span>
97
+ * Share on {platform.name}
98
+ * </button>
99
+ * )}
100
+ * </SocialSharing.Platform>
101
+ * );
102
+ * }
103
+ * ```
47
104
  */
48
105
  export const Platform = (props) => {
49
106
  const { platform, onClick } = props;
@@ -56,6 +113,31 @@ export const Platform = (props) => {
56
113
  * Headless component for social sharing platforms with logic
57
114
  *
58
115
  * @component
116
+ * @example
117
+ * ```tsx
118
+ * import { SocialSharing } from '@wix/stores/components';
119
+ *
120
+ * function SocialShareButtons() {
121
+ * return (
122
+ * <SocialSharing.Platforms
123
+ * url="https://example.com/product/123"
124
+ * title="Amazing Product"
125
+ * description="Check out this amazing product!"
126
+ * hashtags={['product', 'amazing']}
127
+ * >
128
+ * {({ platforms, shareFacebook, shareTwitter, shareLinkedIn, copyLink, shareNative }) => (
129
+ * <div className="social-platforms">
130
+ * <button onClick={shareFacebook}>Share on Facebook</button>
131
+ * <button onClick={shareTwitter}>Share on Twitter</button>
132
+ * <button onClick={shareLinkedIn}>Share on LinkedIn</button>
133
+ * <button onClick={() => copyLink()}>Copy Link</button>
134
+ * <button onClick={() => shareNative()}>Share</button>
135
+ * </div>
136
+ * )}
137
+ * </SocialSharing.Platforms>
138
+ * );
139
+ * }
140
+ * ```
59
141
  */
60
142
  export const Platforms = (props) => {
61
143
  const { url, title, description = "", hashtags = [] } = props;
@@ -11,5 +11,27 @@ export interface ControllerProps {
11
11
  * Headless component for sorting products
12
12
  *
13
13
  * @component
14
+ * @example
15
+ * ```tsx
16
+ * import { Sort } from '@wix/stores/components';
17
+ *
18
+ * function ProductSortDropdown() {
19
+ * return (
20
+ * <Sort.Controller>
21
+ * {({ currentSort, setSortBy }) => (
22
+ * <select
23
+ * value={currentSort}
24
+ * onChange={(e) => setSortBy(e.target.value as Sort.SortBy)}
25
+ * >
26
+ * <option value="name_asc">Name (A-Z)</option>
27
+ * <option value="name_desc">Name (Z-A)</option>
28
+ * <option value="price_asc">Price (Low to High)</option>
29
+ * <option value="price_desc">Price (High to Low)</option>
30
+ * </select>
31
+ * )}
32
+ * </Sort.Controller>
33
+ * );
34
+ * }
35
+ * ```
14
36
  */
15
37
  export declare function Controller({ children }: ControllerProps): import("react/jsx-runtime").JSX.Element;