@wix/headless-stores 0.0.106 → 0.0.107

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.
@@ -167,6 +167,8 @@ export interface ChoiceProps {
167
167
  export interface ChoiceRenderProps {
168
168
  /** Choice value to display */
169
169
  value: string;
170
+ /** Choice key (unique identifier) */
171
+ valueKey: string;
170
172
  /** Whether this choice is currently selected */
171
173
  isSelected: boolean;
172
174
  /** Whether this choice is visible */
@@ -168,23 +168,26 @@ export function Choice(props) {
168
168
  // @ts-expect-error - This field is currently INTERNAL but will be public in the future
169
169
  const optionKey = option.key || optionName;
170
170
  const choiceValue = choice.name || '';
171
- const isSelected = selectedChoices[optionKey] === choiceValue;
171
+ // @ts-expect-error - This field is currently INTERNAL but will be public in the future
172
+ const choiceKey = choice.key || choiceValue;
173
+ const isSelected = selectedChoices[optionKey] === choiceKey;
172
174
  // Check if this choice is available based on current selections
173
- const isVisible = variantService.isChoiceAvailable(optionKey, choiceValue);
175
+ const isVisible = variantService.isChoiceAvailable(optionKey, choiceKey);
174
176
  // Check if this choice results in an in-stock variant
175
- const isInStock = variantService.isChoiceInStock(optionKey, choiceValue);
177
+ const isInStock = variantService.isChoiceInStock(optionKey, choiceKey);
176
178
  // Check if this choice is available for pre-order
177
- const isPreOrderEnabled = variantService.isChoicePreOrderEnabled(optionKey, choiceValue);
178
- const value = choiceValue;
179
+ const isPreOrderEnabled = variantService.isChoicePreOrderEnabled(optionKey, choiceKey);
180
+ const valueKey = choiceKey;
179
181
  const select = () => {
180
182
  const newChoices = {
181
183
  ...selectedChoices,
182
- [optionKey]: choiceValue,
184
+ [optionKey]: choiceKey,
183
185
  };
184
186
  variantService.setSelectedChoices(newChoices);
185
187
  };
186
188
  return props.children({
187
- value,
189
+ value: choiceValue,
190
+ valueKey,
188
191
  isSelected,
189
192
  isVisible,
190
193
  isInStock,
@@ -167,6 +167,8 @@ export interface ChoiceProps {
167
167
  export interface ChoiceRenderProps {
168
168
  /** Choice value to display */
169
169
  value: string;
170
+ /** Choice key (unique identifier) */
171
+ valueKey: string;
170
172
  /** Whether this choice is currently selected */
171
173
  isSelected: boolean;
172
174
  /** Whether this choice is visible */
@@ -168,23 +168,26 @@ export function Choice(props) {
168
168
  // @ts-expect-error - This field is currently INTERNAL but will be public in the future
169
169
  const optionKey = option.key || optionName;
170
170
  const choiceValue = choice.name || '';
171
- const isSelected = selectedChoices[optionKey] === choiceValue;
171
+ // @ts-expect-error - This field is currently INTERNAL but will be public in the future
172
+ const choiceKey = choice.key || choiceValue;
173
+ const isSelected = selectedChoices[optionKey] === choiceKey;
172
174
  // Check if this choice is available based on current selections
173
- const isVisible = variantService.isChoiceAvailable(optionKey, choiceValue);
175
+ const isVisible = variantService.isChoiceAvailable(optionKey, choiceKey);
174
176
  // Check if this choice results in an in-stock variant
175
- const isInStock = variantService.isChoiceInStock(optionKey, choiceValue);
177
+ const isInStock = variantService.isChoiceInStock(optionKey, choiceKey);
176
178
  // Check if this choice is available for pre-order
177
- const isPreOrderEnabled = variantService.isChoicePreOrderEnabled(optionKey, choiceValue);
178
- const value = choiceValue;
179
+ const isPreOrderEnabled = variantService.isChoicePreOrderEnabled(optionKey, choiceKey);
180
+ const valueKey = choiceKey;
179
181
  const select = () => {
180
182
  const newChoices = {
181
183
  ...selectedChoices,
182
- [optionKey]: choiceValue,
184
+ [optionKey]: choiceKey,
183
185
  };
184
186
  variantService.setSelectedChoices(newChoices);
185
187
  };
186
188
  return props.children({
187
- value,
189
+ value: choiceValue,
190
+ valueKey,
188
191
  isSelected,
189
192
  isVisible,
190
193
  isInStock,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/headless-stores",
3
- "version": "0.0.106",
3
+ "version": "0.0.107",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -84,5 +84,5 @@
84
84
  "groupId": "com.wixpress.headless-components"
85
85
  }
86
86
  },
87
- "falconPackageHash": "98aa3c62ed1cd635109ed3fc6def9b78f40ad252ce17e70b7950de36"
87
+ "falconPackageHash": "4a62e19798c3f18e7717f4cd36622647f56a785719bee0cba904bc33"
88
88
  }