@wix/headless-stores 0.0.39 → 0.0.41

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 (43) hide show
  1. package/cjs/dist/react/CategoryList.d.ts +2 -2
  2. package/cjs/dist/react/ProductListFilters.d.ts +5 -5
  3. package/cjs/dist/react/ProductListFilters.js +5 -5
  4. package/cjs/dist/react/ProductListPagination.d.ts +3 -3
  5. package/cjs/dist/react/ProductListPagination.js +4 -4
  6. package/cjs/dist/react/ProductListSort.d.ts +5 -5
  7. package/cjs/dist/react/ProductListSort.js +6 -6
  8. package/cjs/dist/react/ProductModifiers.d.ts +11 -11
  9. package/cjs/dist/react/ProductModifiers.js +14 -14
  10. package/cjs/dist/react/ProductVariantSelector.d.ts +7 -11
  11. package/cjs/dist/react/ProductVariantSelector.js +8 -10
  12. package/cjs/dist/react/SelectedVariant.d.ts +6 -6
  13. package/cjs/dist/react/SelectedVariant.js +8 -8
  14. package/cjs/dist/services/categories-list-service.d.ts +8 -8
  15. package/cjs/dist/services/categories-list-service.js +2 -2
  16. package/cjs/dist/services/category-service.d.ts +12 -5
  17. package/cjs/dist/services/index.d.ts +1 -1
  18. package/cjs/dist/services/products-list-pagination-service.d.ts +5 -5
  19. package/cjs/dist/services/products-list-pagination-service.js +2 -2
  20. package/cjs/dist/services/products-list-service.d.ts +4 -2
  21. package/cjs/dist/services/products-list-service.js +4 -2
  22. package/dist/react/CategoryList.d.ts +2 -2
  23. package/dist/react/ProductListFilters.d.ts +5 -5
  24. package/dist/react/ProductListFilters.js +5 -5
  25. package/dist/react/ProductListPagination.d.ts +3 -3
  26. package/dist/react/ProductListPagination.js +4 -4
  27. package/dist/react/ProductListSort.d.ts +5 -5
  28. package/dist/react/ProductListSort.js +6 -6
  29. package/dist/react/ProductModifiers.d.ts +11 -11
  30. package/dist/react/ProductModifiers.js +14 -14
  31. package/dist/react/ProductVariantSelector.d.ts +7 -11
  32. package/dist/react/ProductVariantSelector.js +8 -10
  33. package/dist/react/SelectedVariant.d.ts +6 -6
  34. package/dist/react/SelectedVariant.js +8 -8
  35. package/dist/services/categories-list-service.d.ts +8 -8
  36. package/dist/services/categories-list-service.js +2 -2
  37. package/dist/services/category-service.d.ts +12 -5
  38. package/dist/services/index.d.ts +1 -1
  39. package/dist/services/products-list-pagination-service.d.ts +5 -5
  40. package/dist/services/products-list-pagination-service.js +2 -2
  41. package/dist/services/products-list-service.d.ts +4 -2
  42. package/dist/services/products-list-service.js +4 -2
  43. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  import { type CategoriesListServiceConfig } from "../services/categories-list-service.js";
2
- import { categories } from "@wix/categories";
2
+ import { type Category } from "../services/category-service.js";
3
3
  export interface RootProps {
4
4
  children: React.ReactNode;
5
5
  categoriesListConfig: CategoriesListServiceConfig;
@@ -155,7 +155,7 @@ export interface ItemContentProps {
155
155
  */
156
156
  export interface ItemContentRenderProps {
157
157
  /** Category data */
158
- category: categories.Category;
158
+ category: Category;
159
159
  }
160
160
  /**
161
161
  * Component that renders content for each category in the list.
@@ -25,11 +25,11 @@ export interface RootProps {
25
25
  * }}
26
26
  * >
27
27
  * <ProductListFilters.MinPrice>
28
- * {({ minPrice, setMinPrice }) => (
28
+ * {({ minPrice, setSelectedMinPrice }) => (
29
29
  * <input
30
30
  * type="number"
31
31
  * value={minPrice}
32
- * onChange={(e) => setMinPrice(Number(e.target.value))}
32
+ * onChange={(e) => setSelectedMinPrice(Number(e.target.value))}
33
33
  * placeholder="Min price"
34
34
  * />
35
35
  * )}
@@ -167,21 +167,21 @@ export interface PriceRangeRenderProps {
167
167
  * function PriceRangeFilter() {
168
168
  * return (
169
169
  * <ProductListFilters.PriceRange>
170
- * {({ minPrice, maxPrice, setMinPrice, setMaxPrice }) => (
170
+ * {({ minPrice, maxPrice, setSelectedMinPrice, setSelectedMaxPrice }) => (
171
171
  * <div className="price-range">
172
172
  * <h4>Price Range:</h4>
173
173
  * <div className="price-inputs">
174
174
  * <input
175
175
  * type="number"
176
176
  * value={minPrice}
177
- * onChange={(e) => setMinPrice(Number(e.target.value))}
177
+ * onChange={(e) => setSelectedMinPrice(Number(e.target.value))}
178
178
  * placeholder="Min"
179
179
  * />
180
180
  * <span>to</span>
181
181
  * <input
182
182
  * type="number"
183
183
  * value={maxPrice}
184
- * onChange={(e) => setMaxPrice(Number(e.target.value))}
184
+ * onChange={(e) => setSelectedMaxPrice(Number(e.target.value))}
185
185
  * placeholder="Max"
186
186
  * />
187
187
  * </div>
@@ -21,11 +21,11 @@ import { ProductsListFiltersService, ProductsListFiltersServiceDefinition, } fro
21
21
  * }}
22
22
  * >
23
23
  * <ProductListFilters.MinPrice>
24
- * {({ minPrice, setMinPrice }) => (
24
+ * {({ minPrice, setSelectedMinPrice }) => (
25
25
  * <input
26
26
  * type="number"
27
27
  * value={minPrice}
28
- * onChange={(e) => setMinPrice(Number(e.target.value))}
28
+ * onChange={(e) => setSelectedMinPrice(Number(e.target.value))}
29
29
  * placeholder="Min price"
30
30
  * />
31
31
  * )}
@@ -126,21 +126,21 @@ export function ResetTrigger(props) {
126
126
  * function PriceRangeFilter() {
127
127
  * return (
128
128
  * <ProductListFilters.PriceRange>
129
- * {({ minPrice, maxPrice, setMinPrice, setMaxPrice }) => (
129
+ * {({ minPrice, maxPrice, setSelectedMinPrice, setSelectedMaxPrice }) => (
130
130
  * <div className="price-range">
131
131
  * <h4>Price Range:</h4>
132
132
  * <div className="price-inputs">
133
133
  * <input
134
134
  * type="number"
135
135
  * value={minPrice}
136
- * onChange={(e) => setMinPrice(Number(e.target.value))}
136
+ * onChange={(e) => setSelectedMinPrice(Number(e.target.value))}
137
137
  * placeholder="Min"
138
138
  * />
139
139
  * <span>to</span>
140
140
  * <input
141
141
  * type="number"
142
142
  * value={maxPrice}
143
- * onChange={(e) => setMaxPrice(Number(e.target.value))}
143
+ * onChange={(e) => setSelectedMaxPrice(Number(e.target.value))}
144
144
  * placeholder="Max"
145
145
  * />
146
146
  * </div>
@@ -172,7 +172,7 @@ export interface FirstPageTriggerProps {
172
172
  */
173
173
  export interface FirstPageTriggerRenderProps {
174
174
  /** Function to navigate to the first page */
175
- goToFirstPage: () => void;
175
+ navigateToFirstPage: () => void;
176
176
  /** Whether there is a previous page (indicating not on first page) */
177
177
  hasPrevPage: boolean;
178
178
  }
@@ -187,9 +187,9 @@ export interface FirstPageTriggerRenderProps {
187
187
  * function FirstPageButton() {
188
188
  * return (
189
189
  * <ProductListPagination.FirstPageTrigger>
190
- * {({ goToFirstPage, hasPrevPage }) => (
190
+ * {({ navigateToFirstPage, hasPrevPage }) => (
191
191
  * <button
192
- * onClick={goToFirstPage}
192
+ * onClick={navigateToFirstPage}
193
193
  * disabled={!hasPrevPage}
194
194
  * title="Go to first page"
195
195
  * >
@@ -148,9 +148,9 @@ export function PreviousPageTrigger(props) {
148
148
  * function FirstPageButton() {
149
149
  * return (
150
150
  * <ProductListPagination.FirstPageTrigger>
151
- * {({ goToFirstPage, hasPrevPage }) => (
151
+ * {({ navigateToFirstPage, hasPrevPage }) => (
152
152
  * <button
153
- * onClick={goToFirstPage}
153
+ * onClick={navigateToFirstPage}
154
154
  * disabled={!hasPrevPage}
155
155
  * title="Go to first page"
156
156
  * >
@@ -164,10 +164,10 @@ export function PreviousPageTrigger(props) {
164
164
  */
165
165
  export function FirstPageTrigger(props) {
166
166
  const service = useService(ProductsListPaginationServiceDefinition);
167
- const goToFirstPage = service.goToFirstPage;
167
+ const navigateToFirstPage = service.navigateToFirstPage;
168
168
  const hasPrevPage = service.hasPrevPage.get();
169
169
  return typeof props.children === "function"
170
- ? props.children({ goToFirstPage, hasPrevPage })
170
+ ? props.children({ navigateToFirstPage, hasPrevPage })
171
171
  : props.children;
172
172
  }
173
173
  /**
@@ -16,10 +16,10 @@ export interface RootProps {
16
16
  * return (
17
17
  * <ProductListSort.Root>
18
18
  * <ProductListSort.Options>
19
- * {({ selectedSortOption, setSelectedSortOption, sortOptions }) => (
19
+ * {({ selectedSortOption, updateSortOption, sortOptions }) => (
20
20
  * <select
21
21
  * value={selectedSortOption}
22
- * onChange={(e) => setSelectedSortOption(e.target.value)}
22
+ * onChange={(e) => updateSortOption(e.target.value)}
23
23
  * >
24
24
  * {sortOptions.map(option => (
25
25
  * <option key={option.value} value={option.value}>
@@ -49,7 +49,7 @@ export interface OptionsRenderProps {
49
49
  /** Currently selected sort option value */
50
50
  selectedSortOption: string;
51
51
  /** Function to update the selected sort option */
52
- setSelectedSortOption: (sort: string) => void;
52
+ updateSortOption: (sort: string) => void;
53
53
  /** Available sort options */
54
54
  sortOptions: SortType[];
55
55
  }
@@ -64,13 +64,13 @@ export interface OptionsRenderProps {
64
64
  * function ProductSortDropdown() {
65
65
  * return (
66
66
  * <ProductListSort.Options>
67
- * {({ selectedSortOption, setSelectedSortOption, sortOptions }) => (
67
+ * {({ selectedSortOption, updateSortOption, sortOptions }) => (
68
68
  * <div className="sort-container">
69
69
  * <label htmlFor="sort-select">Sort by:</label>
70
70
  * <select
71
71
  * id="sort-select"
72
72
  * value={selectedSortOption}
73
- * onChange={(e) => setSelectedSortOption(e.target.value)}
73
+ * onChange={(e) => updateSortOption(e.target.value)}
74
74
  * className="sort-dropdown"
75
75
  * >
76
76
  * {sortOptions.map(option => (
@@ -16,10 +16,10 @@ import { ProductsListSortService, ProductsListSortServiceDefinition, } from "../
16
16
  * return (
17
17
  * <ProductListSort.Root>
18
18
  * <ProductListSort.Options>
19
- * {({ selectedSortOption, setSelectedSortOption, sortOptions }) => (
19
+ * {({ selectedSortOption, updateSortOption, sortOptions }) => (
20
20
  * <select
21
21
  * value={selectedSortOption}
22
- * onChange={(e) => setSelectedSortOption(e.target.value)}
22
+ * onChange={(e) => updateSortOption(e.target.value)}
23
23
  * >
24
24
  * {sortOptions.map(option => (
25
25
  * <option key={option.value} value={option.value}>
@@ -48,13 +48,13 @@ export function Root(props) {
48
48
  * function ProductSortDropdown() {
49
49
  * return (
50
50
  * <ProductListSort.Options>
51
- * {({ selectedSortOption, setSelectedSortOption, sortOptions }) => (
51
+ * {({ selectedSortOption, updateSortOption, sortOptions }) => (
52
52
  * <div className="sort-container">
53
53
  * <label htmlFor="sort-select">Sort by:</label>
54
54
  * <select
55
55
  * id="sort-select"
56
56
  * value={selectedSortOption}
57
- * onChange={(e) => setSelectedSortOption(e.target.value)}
57
+ * onChange={(e) => updateSortOption(e.target.value)}
58
58
  * className="sort-dropdown"
59
59
  * >
60
60
  * {sortOptions.map(option => (
@@ -74,11 +74,11 @@ export function Options(props) {
74
74
  const service = useService(ProductsListSortServiceDefinition);
75
75
  const selectedSortOption = service.selectedSortOption.get();
76
76
  const sortOptions = service.sortOptions;
77
- const setSelectedSortOption = service.setSelectedSortOption;
77
+ const updateSortOption = service.setSelectedSortOption;
78
78
  return typeof props.children === "function"
79
79
  ? props.children({
80
80
  selectedSortOption,
81
- setSelectedSortOption,
81
+ updateSortOption,
82
82
  sortOptions,
83
83
  })
84
84
  : props.children;
@@ -33,9 +33,9 @@ export interface RootProps {
33
33
  * <div className="choices">
34
34
  * {choices.map(choice => (
35
35
  * <ProductModifiers.Choice key={choice.id} modifier={modifier} choice={choice}>
36
- * {({ value, isSelected, onSelect }) => (
36
+ * {({ value, isSelected, select }) => (
37
37
  * <button
38
- * onClick={onSelect}
38
+ * onClick={select}
39
39
  * className={isSelected ? 'selected' : ''}
40
40
  * >
41
41
  * {value}
@@ -244,7 +244,7 @@ export interface ChoiceRenderProps {
244
244
  /** Whether this choice is currently selected */
245
245
  isSelected: boolean;
246
246
  /** Function to select this choice */
247
- onSelect: () => void;
247
+ select: () => void;
248
248
  /** Modifier name */
249
249
  modifierName: string;
250
250
  /** Choice value */
@@ -263,9 +263,9 @@ export interface ChoiceRenderProps {
263
263
  * function ModifierChoiceButton({ modifier, choice }) {
264
264
  * return (
265
265
  * <ProductModifiers.Choice modifier={modifier} choice={choice}>
266
- * {({ value, description, isSelected, onSelect, colorCode }) => (
266
+ * {({ value, description, isSelected, select, colorCode }) => (
267
267
  * <button
268
- * onClick={onSelect}
268
+ * onClick={select}
269
269
  * className={`choice-button ${isSelected ? 'selected' : ''}`}
270
270
  * style={colorCode ? { backgroundColor: colorCode } : {}}
271
271
  * >
@@ -299,7 +299,7 @@ export interface FreeTextRenderProps {
299
299
  /** Current text value */
300
300
  value: string;
301
301
  /** Function to update text value */
302
- onChange: (value: string) => void;
302
+ setText: (value: string) => void;
303
303
  /** Whether this modifier is mandatory */
304
304
  mandatory: boolean;
305
305
  /** Maximum characters allowed */
@@ -324,14 +324,14 @@ export interface FreeTextRenderProps {
324
324
  * function FreeTextModifier({ modifier }) {
325
325
  * return (
326
326
  * <ProductModifiers.FreeText modifier={modifier}>
327
- * {({ value, onChange, mandatory, maxChars, placeholder, charCount, isOverLimit, modifierName }) => (
327
+ * {({ value, setText, mandatory, maxChars, placeholder, charCount, isOverLimit, modifierName }) => (
328
328
  * <div className="free-text-modifier">
329
329
  * <label>
330
330
  * {modifierName} {mandatory && <span className="required">*</span>}
331
331
  * </label>
332
332
  * <textarea
333
333
  * value={value}
334
- * onChange={(e) => onChange(e.target.value)}
334
+ * setText={(e) => setText(e.target.value)}
335
335
  * placeholder={placeholder}
336
336
  * maxLength={maxChars}
337
337
  * className={isOverLimit ? 'over-limit' : ''}
@@ -365,7 +365,7 @@ export interface ToggleFreeTextRenderProps {
365
365
  /** Whether the text input is shown */
366
366
  isTextInputShown: boolean;
367
367
  /** Function to toggle text input visibility */
368
- onToggle: () => void;
368
+ toggle: () => void;
369
369
  /** Whether this modifier is mandatory */
370
370
  mandatory: boolean;
371
371
  /** Modifier name */
@@ -383,14 +383,14 @@ export interface ToggleFreeTextRenderProps {
383
383
  * function ToggleFreeTextModifier({ modifier }) {
384
384
  * return (
385
385
  * <ProductModifiers.ToggleFreeText modifier={modifier}>
386
- * {({ isTextInputShown, onToggle, mandatory, modifierName }) => (
386
+ * {({ isTextInputShown, toggle, mandatory, modifierName }) => (
387
387
  * <div className="toggle-free-text">
388
388
  * {!mandatory && (
389
389
  * <label>
390
390
  * <input
391
391
  * type="checkbox"
392
392
  * checked={isTextInputShown}
393
- * onChange={onToggle}
393
+ * onChange={toggle}
394
394
  * />
395
395
  * Add {modifierName}
396
396
  * </label>
@@ -35,9 +35,9 @@ import { createServicesMap } from "@wix/services-manager";
35
35
  * <div className="choices">
36
36
  * {choices.map(choice => (
37
37
  * <ProductModifiers.Choice key={choice.id} modifier={modifier} choice={choice}>
38
- * {({ value, isSelected, onSelect }) => (
38
+ * {({ value, isSelected, select }) => (
39
39
  * <button
40
- * onClick={onSelect}
40
+ * onClick={select}
41
41
  * className={isSelected ? 'selected' : ''}
42
42
  * >
43
43
  * {value}
@@ -240,9 +240,9 @@ export function Modifier(props) {
240
240
  * function ModifierChoiceButton({ modifier, choice }) {
241
241
  * return (
242
242
  * <ProductModifiers.Choice modifier={modifier} choice={choice}>
243
- * {({ value, description, isSelected, onSelect, colorCode }) => (
243
+ * {({ value, description, isSelected, select, colorCode }) => (
244
244
  * <button
245
- * onClick={onSelect}
245
+ * onClick={select}
246
246
  * className={`choice-button ${isSelected ? 'selected' : ''}`}
247
247
  * style={colorCode ? { backgroundColor: colorCode } : {}}
248
248
  * >
@@ -273,14 +273,14 @@ export function Choice(props) {
273
273
  const colorCode = choice.colorCode;
274
274
  const selectedValue = modifiersService?.getModifierValue(modifierName);
275
275
  const isSelected = selectedValue?.choiceValue === choiceValue;
276
- const onSelect = () => {
276
+ const select = () => {
277
277
  modifiersService?.setModifierChoice(modifierName, choiceValue);
278
278
  };
279
279
  return props.children({
280
280
  value,
281
281
  description,
282
282
  isSelected,
283
- onSelect,
283
+ select,
284
284
  modifierName,
285
285
  choiceValue,
286
286
  colorCode,
@@ -297,14 +297,14 @@ export function Choice(props) {
297
297
  * function FreeTextModifier({ modifier }) {
298
298
  * return (
299
299
  * <ProductModifiers.FreeText modifier={modifier}>
300
- * {({ value, onChange, mandatory, maxChars, placeholder, charCount, isOverLimit, modifierName }) => (
300
+ * {({ value, setText, mandatory, maxChars, placeholder, charCount, isOverLimit, modifierName }) => (
301
301
  * <div className="free-text-modifier">
302
302
  * <label>
303
303
  * {modifierName} {mandatory && <span className="required">*</span>}
304
304
  * </label>
305
305
  * <textarea
306
306
  * value={value}
307
- * onChange={(e) => onChange(e.target.value)}
307
+ * setText={(e) => setText(e.target.value)}
308
308
  * placeholder={placeholder}
309
309
  * maxLength={maxChars}
310
310
  * className={isOverLimit ? 'over-limit' : ''}
@@ -333,14 +333,14 @@ export function FreeText(props) {
333
333
  const value = selectedValue?.freeTextValue || "";
334
334
  const charCount = value.length;
335
335
  const isOverLimit = maxChars ? charCount > maxChars : false;
336
- const onChange = (newValue) => {
336
+ const setText = (newValue) => {
337
337
  if (maxChars && newValue.length > maxChars)
338
338
  return;
339
339
  modifiersService?.setModifierFreeText(modifierName, newValue);
340
340
  };
341
341
  return props.children({
342
342
  value,
343
- onChange,
343
+ setText,
344
344
  mandatory,
345
345
  maxChars,
346
346
  placeholder,
@@ -361,14 +361,14 @@ export function FreeText(props) {
361
361
  * function ToggleFreeTextModifier({ modifier }) {
362
362
  * return (
363
363
  * <ProductModifiers.ToggleFreeText modifier={modifier}>
364
- * {({ isTextInputShown, onToggle, mandatory, modifierName }) => (
364
+ * {({ isTextInputShown, toggle, mandatory, modifierName }) => (
365
365
  * <div className="toggle-free-text">
366
366
  * {!mandatory && (
367
367
  * <label>
368
368
  * <input
369
369
  * type="checkbox"
370
370
  * checked={isTextInputShown}
371
- * onChange={onToggle}
371
+ * onChange={toggle}
372
372
  * />
373
373
  * Add {modifierName}
374
374
  * </label>
@@ -397,7 +397,7 @@ export function ToggleFreeText(props) {
397
397
  const modifierName = modifier.name || "";
398
398
  const mandatory = modifier.mandatory || false;
399
399
  const [isTextInputShown, setIsTextInputShown] = useState(mandatory);
400
- const onToggle = () => {
400
+ const toggle = () => {
401
401
  const newState = !isTextInputShown;
402
402
  setIsTextInputShown(newState);
403
403
  if (!newState) {
@@ -406,7 +406,7 @@ export function ToggleFreeText(props) {
406
406
  };
407
407
  return props.children({
408
408
  isTextInputShown,
409
- onToggle,
409
+ toggle,
410
410
  mandatory,
411
411
  modifierName,
412
412
  });
@@ -2,7 +2,7 @@ import { SelectedVariantServiceConfig } from "../services/selected-variant-servi
2
2
  import { type ConnectedOption, type ConnectedOptionChoice, InventoryAvailabilityStatus } from "@wix/auto_sdk_stores_products-v-3";
3
3
  export interface RootProps {
4
4
  children: React.ReactNode;
5
- selectedVariantServiceConfig: SelectedVariantServiceConfig;
5
+ selectedVariantServiceConfig?: SelectedVariantServiceConfig;
6
6
  }
7
7
  /**
8
8
  * Root component that provides the ProductVariantSelector service context to its children.
@@ -109,8 +109,6 @@ export interface OptionProps {
109
109
  export interface OptionRenderProps {
110
110
  /** Option name */
111
111
  name: string;
112
- /** Option type */
113
- type: any;
114
112
  /** Array of choices for this option */
115
113
  choices: ConnectedOptionChoice[];
116
114
  /** Currently selected value for this option */
@@ -167,8 +165,6 @@ export interface ChoiceProps {
167
165
  export interface ChoiceRenderProps {
168
166
  /** Choice value to display */
169
167
  value: string;
170
- /** Choice description (for color options) */
171
- description: string | undefined;
172
168
  /** Whether this choice is currently selected */
173
169
  isSelected: boolean;
174
170
  /** Whether this choice is visible */
@@ -178,7 +174,7 @@ export interface ChoiceRenderProps {
178
174
  /** Whether this choice is available for pre-order */
179
175
  isPreOrderEnabled: boolean;
180
176
  /** Function to select this choice */
181
- onSelect: () => void;
177
+ select: () => void;
182
178
  /** Option name */
183
179
  optionName: string;
184
180
  /** Choice value */
@@ -195,9 +191,9 @@ export interface ChoiceRenderProps {
195
191
  * function ChoiceButton({ option, choice }) {
196
192
  * return (
197
193
  * <ProductVariantSelector.Choice option={option} choice={choice}>
198
- * {({ value, isSelected, isVisible, isInStock, onSelect }) => (
194
+ * {({ value, isSelected, isVisible, isInStock, select }) => (
199
195
  * <button
200
- * onClick={onSelect}
196
+ * onClick={select}
201
197
  * disabled={!isVisible || !isInStock}
202
198
  * className={`choice-btn ${isSelected ? 'selected' : ''} ${!isInStock ? 'out-of-stock' : ''}`}
203
199
  * >
@@ -285,7 +281,7 @@ export interface ResetProps {
285
281
  */
286
282
  export interface ResetRenderProps {
287
283
  /** Function to reset all selections */
288
- onReset: () => void;
284
+ reset: () => void;
289
285
  /** Whether the reset button should be rendered */
290
286
  hasSelections: boolean;
291
287
  }
@@ -300,9 +296,9 @@ export interface ResetRenderProps {
300
296
  * function ResetButton() {
301
297
  * return (
302
298
  * <ProductVariantSelector.Reset>
303
- * {({ onReset, hasSelections }) => (
299
+ * {({ reset, hasSelections }) => (
304
300
  * hasSelections && (
305
- * <button onClick={onReset} className="reset-button">
301
+ * <button onClick={reset} className="reset-button">
306
302
  * Clear All Selections
307
303
  * </button>
308
304
  * )
@@ -126,7 +126,6 @@ export function Option(props) {
126
126
  const selectedValue = selectedChoices[name] || null;
127
127
  return props.children({
128
128
  name,
129
- type: option.optionRenderType,
130
129
  choices,
131
130
  selectedValue,
132
131
  hasChoices: choices.length > 0,
@@ -143,9 +142,9 @@ export function Option(props) {
143
142
  * function ChoiceButton({ option, choice }) {
144
143
  * return (
145
144
  * <ProductVariantSelector.Choice option={option} choice={choice}>
146
- * {({ value, isSelected, isVisible, isInStock, onSelect }) => (
145
+ * {({ value, isSelected, isVisible, isInStock, select }) => (
147
146
  * <button
148
- * onClick={onSelect}
147
+ * onClick={select}
149
148
  * disabled={!isVisible || !isInStock}
150
149
  * className={`choice-btn ${isSelected ? 'selected' : ''} ${!isInStock ? 'out-of-stock' : ''}`}
151
150
  * >
@@ -172,7 +171,7 @@ export function Choice(props) {
172
171
  // Check if this choice is available for pre-order
173
172
  const isPreOrderEnabled = variantService.isChoicePreOrderEnabled(optionName, choiceValue);
174
173
  const value = choiceValue;
175
- const onSelect = () => {
174
+ const select = () => {
176
175
  const newChoices = {
177
176
  ...selectedChoices,
178
177
  [optionName]: choiceValue,
@@ -181,12 +180,11 @@ export function Choice(props) {
181
180
  };
182
181
  return props.children({
183
182
  value,
184
- description: undefined, // v3 choices don't have separate description field
185
183
  isSelected,
186
184
  isVisible,
187
185
  isInStock,
188
186
  isPreOrderEnabled,
189
- onSelect,
187
+ select,
190
188
  optionName,
191
189
  choiceValue,
192
190
  });
@@ -265,9 +263,9 @@ export function Stock(props) {
265
263
  * function ResetButton() {
266
264
  * return (
267
265
  * <ProductVariantSelector.Reset>
268
- * {({ onReset, hasSelections }) => (
266
+ * {({ reset, hasSelections }) => (
269
267
  * hasSelections && (
270
- * <button onClick={onReset} className="reset-button">
268
+ * <button onClick={reset} className="reset-button">
271
269
  * Clear All Selections
272
270
  * </button>
273
271
  * )
@@ -281,11 +279,11 @@ export function Reset(props) {
281
279
  const variantService = useService(SelectedVariantServiceDefinition);
282
280
  const selectedChoices = variantService.selectedChoices.get();
283
281
  const hasSelections = Object.keys(selectedChoices).length > 0;
284
- const onReset = () => {
282
+ const reset = () => {
285
283
  variantService.resetSelections();
286
284
  };
287
285
  return props.children({
288
- onReset,
286
+ reset,
289
287
  hasSelections,
290
288
  });
291
289
  }
@@ -1,7 +1,7 @@
1
1
  import { SelectedVariantServiceConfig } from "../services/selected-variant-service.js";
2
2
  export interface RootProps {
3
3
  children: React.ReactNode;
4
- selectedVariantServiceConfig: SelectedVariantServiceConfig;
4
+ selectedVariantServiceConfig?: SelectedVariantServiceConfig;
5
5
  }
6
6
  /**
7
7
  * Root component that provides the SelectedVariant service context to its children.
@@ -174,9 +174,9 @@ export interface ActionsProps {
174
174
  */
175
175
  export interface ActionsRenderProps {
176
176
  /** Function to add product to cart */
177
- onAddToCart: () => Promise<void>;
177
+ addToCart: () => Promise<void>;
178
178
  /** Function to buy now (clear cart, add product, proceed to checkout) */
179
- onBuyNow: () => Promise<void>;
179
+ buyNow: () => Promise<void>;
180
180
  /** Whether add to cart is available */
181
181
  canAddToCart: boolean;
182
182
  /** Whether add to cart is currently loading */
@@ -201,18 +201,18 @@ export interface ActionsRenderProps {
201
201
  * function AddToCartButton() {
202
202
  * return (
203
203
  * <SelectedVariant.Actions>
204
- * {({ onAddToCart, onBuyNow, canAddToCart, isLoading, inStock, error }) => (
204
+ * {({ addToCart, buyNow, canAddToCart, isLoading, inStock, error }) => (
205
205
  * <div>
206
206
  * {error && <div className="error">{error}</div>}
207
207
  * {!inStock && <div>Out of stock</div>}
208
208
  * <button
209
- * onClick={onAddToCart}
209
+ * onClick={addToCart}
210
210
  * disabled={!canAddToCart || isLoading}
211
211
  * >
212
212
  * {isLoading ? 'Adding...' : 'Add to Cart'}
213
213
  * </button>
214
214
  * <button
215
- * onClick={onBuyNow}
215
+ * onClick={buyNow}
216
216
  * disabled={!canAddToCart || isLoading}
217
217
  * >
218
218
  * Buy Now
@@ -154,18 +154,18 @@ export function SKU(props) {
154
154
  * function AddToCartButton() {
155
155
  * return (
156
156
  * <SelectedVariant.Actions>
157
- * {({ onAddToCart, onBuyNow, canAddToCart, isLoading, inStock, error }) => (
157
+ * {({ addToCart, buyNow, canAddToCart, isLoading, inStock, error }) => (
158
158
  * <div>
159
159
  * {error && <div className="error">{error}</div>}
160
160
  * {!inStock && <div>Out of stock</div>}
161
161
  * <button
162
- * onClick={onAddToCart}
162
+ * onClick={addToCart}
163
163
  * disabled={!canAddToCart || isLoading}
164
164
  * >
165
165
  * {isLoading ? 'Adding...' : 'Add to Cart'}
166
166
  * </button>
167
167
  * <button
168
- * onClick={onBuyNow}
168
+ * onClick={buyNow}
169
169
  * disabled={!canAddToCart || isLoading}
170
170
  * >
171
171
  * Buy Now
@@ -202,7 +202,7 @@ export function Actions(props) {
202
202
  const canAddToCart = (inStock || isPreOrderEnabled) &&
203
203
  !isLoading &&
204
204
  areAllRequiredModifiersFilled;
205
- const onAddToCart = async () => {
205
+ const addToCart = async () => {
206
206
  // Get modifiers data if available
207
207
  let modifiersData;
208
208
  if (modifiersService) {
@@ -213,12 +213,12 @@ export function Actions(props) {
213
213
  }
214
214
  await variantService.addToCart(quantity, modifiersData);
215
215
  };
216
- const onBuyNow = async () => {
216
+ const buyNow = async () => {
217
217
  try {
218
218
  // Clear the cart first
219
219
  await cartService.clearCart();
220
220
  // Add the product to cart
221
- await onAddToCart();
221
+ await addToCart();
222
222
  // Proceed to checkout
223
223
  await cartService.proceedToCheckout();
224
224
  }
@@ -228,8 +228,8 @@ export function Actions(props) {
228
228
  }
229
229
  };
230
230
  return props.children({
231
- onAddToCart,
232
- onBuyNow,
231
+ addToCart,
232
+ buyNow,
233
233
  canAddToCart,
234
234
  isLoading,
235
235
  inStock,