@wix/headless-stores 0.0.105 → 0.0.106

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 (33) hide show
  1. package/cjs/dist/react/Option.d.ts +1 -0
  2. package/cjs/dist/react/Product.d.ts +3 -3
  3. package/cjs/dist/react/Product.js +6 -6
  4. package/cjs/dist/react/ProductList.d.ts +2 -3
  5. package/cjs/dist/react/core/Product.d.ts +8 -8
  6. package/cjs/dist/react/core/ProductModifiers.d.ts +11 -9
  7. package/cjs/dist/react/core/ProductModifiers.js +6 -3
  8. package/cjs/dist/react/core/ProductVariantSelector.d.ts +13 -9
  9. package/cjs/dist/react/core/ProductVariantSelector.js +14 -8
  10. package/cjs/dist/services/buy-now-service.js +2 -2
  11. package/cjs/dist/services/product-modifiers-service.d.ts +1 -1
  12. package/cjs/dist/services/product-modifiers-service.js +1 -1
  13. package/cjs/dist/services/product-service.d.ts +1 -1
  14. package/cjs/dist/services/product-service.js +1 -1
  15. package/cjs/dist/services/selected-variant-service.d.ts +6 -6
  16. package/cjs/dist/services/selected-variant-service.js +15 -16
  17. package/dist/react/Option.d.ts +1 -0
  18. package/dist/react/Product.d.ts +3 -3
  19. package/dist/react/Product.js +6 -6
  20. package/dist/react/ProductList.d.ts +2 -3
  21. package/dist/react/core/Product.d.ts +8 -8
  22. package/dist/react/core/ProductModifiers.d.ts +11 -9
  23. package/dist/react/core/ProductModifiers.js +6 -3
  24. package/dist/react/core/ProductVariantSelector.d.ts +13 -9
  25. package/dist/react/core/ProductVariantSelector.js +14 -8
  26. package/dist/services/buy-now-service.js +2 -2
  27. package/dist/services/product-modifiers-service.d.ts +1 -1
  28. package/dist/services/product-modifiers-service.js +1 -1
  29. package/dist/services/product-service.d.ts +1 -1
  30. package/dist/services/product-service.js +1 -1
  31. package/dist/services/selected-variant-service.d.ts +6 -6
  32. package/dist/services/selected-variant-service.js +15 -16
  33. package/package.json +6 -9
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { AsChildChildren } from '@wix/headless-utils/react';
3
3
  export interface Option {
4
4
  name: string;
5
+ key?: string;
5
6
  choices?: any[];
6
7
  hasChoices?: boolean;
7
8
  type?: string;
@@ -1,4 +1,4 @@
1
- import type { V3Product } from '@wix/auto_sdk_stores_products-v-3';
1
+ import { productsV3 } from '@wix/stores';
2
2
  import { AsChildChildren } from '@wix/headless-utils/react';
3
3
  import React from 'react';
4
4
  import { AsContent } from './types.js';
@@ -37,7 +37,7 @@ export type StockStatus = BasicStockStatus | 'can-pre-order';
37
37
  */
38
38
  export interface ProductRootProps {
39
39
  children: React.ReactNode;
40
- product: V3Product;
40
+ product: productsV3.V3Product;
41
41
  selectedVariant?: any;
42
42
  }
43
43
  /**
@@ -268,7 +268,7 @@ export interface RawProps {
268
268
  asChild?: boolean;
269
269
  /** Custom render function when using asChild */
270
270
  children?: AsChildChildren<{
271
- product: V3Product;
271
+ product: productsV3.V3Product;
272
272
  }>;
273
273
  /** CSS classes to apply to the default element */
274
274
  className?: string;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { InventoryAvailabilityStatus } from '@wix/auto_sdk_stores_products-v-3';
2
+ import { productsV3 } from '@wix/stores';
3
3
  import { Quantity as QuantityComponent } from '@wix/headless-components/react';
4
4
  import { Commerce } from '@wix/headless-ecom/react';
5
5
  import { MediaGallery } from '@wix/headless-media/react';
@@ -406,15 +406,15 @@ export const Stock = React.forwardRef((props, ref) => {
406
406
  let status;
407
407
  let label;
408
408
  switch (availabilityStatus) {
409
- case InventoryAvailabilityStatus.IN_STOCK:
409
+ case productsV3.InventoryAvailabilityStatus.IN_STOCK:
410
410
  status = 'in-stock';
411
411
  label = finalLabels.inStock;
412
412
  break;
413
- case InventoryAvailabilityStatus.PARTIALLY_OUT_OF_STOCK:
413
+ case productsV3.InventoryAvailabilityStatus.PARTIALLY_OUT_OF_STOCK:
414
414
  status = 'limited-stock';
415
415
  label = finalLabels.limitedStock;
416
416
  break;
417
- case InventoryAvailabilityStatus.OUT_OF_STOCK:
417
+ case productsV3.InventoryAvailabilityStatus.OUT_OF_STOCK:
418
418
  default:
419
419
  status = 'out-of-stock';
420
420
  label = finalLabels.outOfStock;
@@ -1046,12 +1046,12 @@ function getStockStatusMessage(inStock, isPreOrderEnabled, availabilityStatus, l
1046
1046
  // Handle stock status based on availability
1047
1047
  if (inStock) {
1048
1048
  switch (availabilityStatus) {
1049
- case InventoryAvailabilityStatus.IN_STOCK:
1049
+ case productsV3.InventoryAvailabilityStatus.IN_STOCK:
1050
1050
  return {
1051
1051
  status: 'in-stock',
1052
1052
  label: labels.inStock,
1053
1053
  };
1054
- case InventoryAvailabilityStatus.PARTIALLY_OUT_OF_STOCK:
1054
+ case productsV3.InventoryAvailabilityStatus.PARTIALLY_OUT_OF_STOCK:
1055
1055
  return {
1056
1056
  status: 'limited-stock',
1057
1057
  label: labels.limitedStock,
@@ -1,4 +1,3 @@
1
- import type { V3Product } from '@wix/auto_sdk_stores_products-v-3';
2
1
  import { Sort as SortPrimitive, GenericListTotalsRenderProps, GenericListLoadMoreRenderProps, ListVariant, GenericListRepeaterRenderProps } from '@wix/headless-components/react';
3
2
  import React from 'react';
4
3
  import type { ProductsListServiceConfig } from '../services/products-list-service.js';
@@ -9,7 +8,7 @@ import { AsChildChildren } from '@wix/headless-utils/react';
9
8
  */
10
9
  export interface ProductListRootProps {
11
10
  children: React.ReactNode;
12
- products?: V3Product[];
11
+ products?: productsV3.V3Product[];
13
12
  productsListConfig?: ProductsListServiceConfig;
14
13
  className?: string;
15
14
  variant?: ListVariant;
@@ -95,7 +94,7 @@ export declare const Products: React.ForwardRefExoticComponent<ProductsProps & R
95
94
  /**
96
95
  * Render props for ProductRepeater asChild pattern
97
96
  */
98
- export type ProductRepeaterRenderProps = GenericListRepeaterRenderProps<V3Product>;
97
+ export type ProductRepeaterRenderProps = GenericListRepeaterRenderProps<productsV3.V3Product>;
99
98
  /**
100
99
  * Props for ProductList ProductRepeater component
101
100
  */
@@ -1,5 +1,5 @@
1
1
  import { ProductServiceConfig } from '../../services/product-service.js';
2
- import type { V3Product, ProductMedia } from '@wix/auto_sdk_stores_products-v-3';
2
+ import { productsV3 } from '@wix/stores';
3
3
  export interface RootProps {
4
4
  children: React.ReactNode;
5
5
  productServiceConfig: ProductServiceConfig;
@@ -81,18 +81,18 @@ export interface ProductDescriptionProps {
81
81
  */
82
82
  export interface ProductDescriptionRenderProps {
83
83
  /** Product description using the RICOS (Rich Content Object) format. See https://dev.wix.com/docs/ricos/api-reference/ricos-document */
84
- description: NonNullable<V3Product['description']>;
84
+ description: NonNullable<productsV3.V3Product['description']>;
85
85
  /** Product description with plain html */
86
- plainDescription: NonNullable<V3Product['plainDescription']>;
86
+ plainDescription: NonNullable<productsV3.V3Product['plainDescription']>;
87
87
  }
88
88
  /**
89
89
  * Render props for ProductDescription component
90
90
  */
91
91
  export interface ProductDescriptionRenderProps {
92
92
  /** Product description using the RICOS (Rich Content Object) format. See https://dev.wix.com/docs/ricos/api-reference/ricos-document */
93
- description: NonNullable<V3Product['description']>;
93
+ description: NonNullable<productsV3.V3Product['description']>;
94
94
  /** Product description with plain html */
95
- plainDescription: NonNullable<V3Product['plainDescription']>;
95
+ plainDescription: NonNullable<productsV3.V3Product['plainDescription']>;
96
96
  }
97
97
  /**
98
98
  * Headless component for product description display
@@ -129,15 +129,15 @@ export interface ProductMediaProps {
129
129
  children: (props: ProductMediaRenderProps) => React.ReactNode;
130
130
  }
131
131
  export interface ProductMediaRenderProps {
132
- mediaItems: ProductMedia[];
133
- mainMedia?: ProductMedia;
132
+ mediaItems: productsV3.ProductMedia[];
133
+ mainMedia?: productsV3.ProductMedia;
134
134
  }
135
135
  export declare function Media(props: ProductMediaProps): import("react").ReactNode;
136
136
  export interface ProductProps {
137
137
  children: (props: ProductRenderProps) => React.ReactNode;
138
138
  }
139
139
  export interface ProductRenderProps {
140
- product: V3Product;
140
+ product: productsV3.V3Product;
141
141
  }
142
142
  export declare function Content(props: ProductProps): import("react").ReactNode;
143
143
  export interface LoadingProps {
@@ -1,4 +1,4 @@
1
- import { type ConnectedModifier, type ConnectedModifierChoice } from '@wix/auto_sdk_stores_products-v-3';
1
+ import { productsV3 } from '@wix/stores';
2
2
  export interface RootProps {
3
3
  children: React.ReactNode;
4
4
  }
@@ -89,7 +89,7 @@ export interface ModifiersProps {
89
89
  */
90
90
  export interface ModifiersRenderProps {
91
91
  /** Array of product modifiers */
92
- modifiers: ConnectedModifier[];
92
+ modifiers: productsV3.ConnectedModifier[];
93
93
  /** Whether product has modifiers */
94
94
  hasModifiers: boolean;
95
95
  /** Currently selected modifier values */
@@ -148,7 +148,7 @@ export declare function Modifiers(props: ModifiersProps): import("react").ReactN
148
148
  */
149
149
  export interface ModifierProps {
150
150
  /** Product modifier data */
151
- modifier: ConnectedModifier;
151
+ modifier: productsV3.ConnectedModifier;
152
152
  /** Render prop function that receives modifier data */
153
153
  children: (props: ModifierRenderProps) => React.ReactNode;
154
154
  }
@@ -156,14 +156,16 @@ export interface ModifierProps {
156
156
  * Render props for Modifier component
157
157
  */
158
158
  export interface ModifierRenderProps {
159
- /** Modifier name */
159
+ /** Modifier name (may be translated) */
160
160
  name: string;
161
+ /** Modifier key (unique identifier) */
162
+ key: string;
161
163
  /** Modifier type */
162
164
  type: any;
163
165
  /** Whether this modifier is mandatory */
164
166
  mandatory: boolean;
165
167
  /** Array of choices for this modifier (for choice-based modifiers) */
166
- choices: ConnectedModifierChoice[];
168
+ choices: productsV3.ConnectedModifierChoice[];
167
169
  /** Currently selected value for this modifier */
168
170
  selectedValue: any;
169
171
  /** Whether this modifier has choices */
@@ -227,9 +229,9 @@ export declare function Modifier(props: ModifierProps): import("react").ReactNod
227
229
  */
228
230
  export interface ChoiceProps {
229
231
  /** Product modifier data */
230
- modifier: ConnectedModifier;
232
+ modifier: productsV3.ConnectedModifier;
231
233
  /** Choice data */
232
- choice: ConnectedModifierChoice;
234
+ choice: productsV3.ConnectedModifierChoice;
233
235
  /** Render prop function that receives choice data */
234
236
  children: (props: ChoiceRenderProps) => React.ReactNode;
235
237
  }
@@ -288,7 +290,7 @@ export declare function Choice(props: ChoiceProps): import("react").ReactNode;
288
290
  */
289
291
  export interface FreeTextProps {
290
292
  /** Product modifier data */
291
- modifier: ConnectedModifier;
293
+ modifier: productsV3.ConnectedModifier;
292
294
  /** Render prop function that receives free text data */
293
295
  children: (props: FreeTextRenderProps) => React.ReactNode;
294
296
  }
@@ -354,7 +356,7 @@ export declare function FreeText(props: FreeTextProps): import("react").ReactNod
354
356
  */
355
357
  export interface ToggleFreeTextProps {
356
358
  /** Product modifier data */
357
- modifier: ConnectedModifier;
359
+ modifier: productsV3.ConnectedModifier;
358
360
  /** Render prop function that receives toggle data */
359
361
  children: (props: ToggleFreeTextRenderProps) => React.ReactNode;
360
362
  }
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
3
  import { useService, WixServices } from '@wix/services-manager-react';
4
4
  import { ProductModifiersServiceDefinition, ProductModifiersService, } from '../../services/product-modifiers-service.js';
5
- import { ModifierRenderType, } from '@wix/auto_sdk_stores_products-v-3';
5
+ import { productsV3 } from '@wix/stores';
6
6
  import { createServicesMap } from '@wix/services-manager';
7
7
  /**
8
8
  * Root component that provides the ProductModifiers service context to its children.
@@ -208,17 +208,20 @@ export function Modifier(props) {
208
208
  const modifiersService = useModifiersService();
209
209
  const { modifier } = props;
210
210
  const name = modifier.name || '';
211
+ // @ts-expect-error - This field is currently INTERNAL but will be public in the future
212
+ const key = modifier.key || name;
211
213
  const type = modifier.modifierRenderType;
212
214
  const mandatory = modifier.mandatory || false;
213
215
  const choices = modifier.choicesSettings?.choices || [];
214
216
  const hasChoices = choices.length > 0;
215
- const isFreeText = type === ModifierRenderType.FREE_TEXT;
217
+ const isFreeText = type === productsV3.ModifierRenderType.FREE_TEXT;
216
218
  const freeTextSettings = modifier.freeTextSettings;
217
219
  const maxChars = freeTextSettings?.maxLength;
218
220
  const placeholder = freeTextSettings?.placeholder;
219
221
  const selectedValue = modifiersService?.selectedModifiers.get()[name] || null;
220
222
  return props.children({
221
223
  name,
224
+ key,
222
225
  type,
223
226
  mandatory,
224
227
  choices,
@@ -265,7 +268,7 @@ export function Choice(props) {
265
268
  const modifierName = modifier.name || '';
266
269
  const renderType = modifier.modifierRenderType;
267
270
  // For TEXT_CHOICES, use choice.key; for SWATCH_CHOICES, use choice.name
268
- const choiceValue = renderType === ModifierRenderType.TEXT_CHOICES
271
+ const choiceValue = renderType === productsV3.ModifierRenderType.TEXT_CHOICES
269
272
  ? choice.key || choice.name || ''
270
273
  : choice.name || '';
271
274
  const value = choice.name || ''; // Display name is always choice.name
@@ -1,5 +1,5 @@
1
1
  import { SelectedVariantServiceConfig } from '../../services/selected-variant-service.js';
2
- import { type ConnectedOption, type ConnectedOptionChoice, InventoryAvailabilityStatus } from '@wix/auto_sdk_stores_products-v-3';
2
+ import { productsV3 } from '@wix/stores';
3
3
  export interface RootProps {
4
4
  children: React.ReactNode;
5
5
  selectedVariantServiceConfig?: SelectedVariantServiceConfig;
@@ -55,7 +55,7 @@ export interface OptionsProps {
55
55
  */
56
56
  export interface OptionsRenderProps {
57
57
  /** Array of product options */
58
- options: ConnectedOption[];
58
+ options: productsV3.ConnectedOption[];
59
59
  /** Whether product has options */
60
60
  hasOptions: boolean;
61
61
  /** Currently selected choices */
@@ -99,7 +99,7 @@ export declare function Options(props: OptionsProps): import("react").ReactNode;
99
99
  */
100
100
  export interface OptionProps {
101
101
  /** Product option data */
102
- option: ConnectedOption;
102
+ option: productsV3.ConnectedOption;
103
103
  /** Render prop function that receives option data */
104
104
  children: (props: OptionRenderProps) => React.ReactNode;
105
105
  }
@@ -107,10 +107,12 @@ export interface OptionProps {
107
107
  * Render props for Option component
108
108
  */
109
109
  export interface OptionRenderProps {
110
- /** Option name */
110
+ /** Option name (may be translated) */
111
111
  name: string;
112
+ /** Option key (unique identifier) */
113
+ key: string;
112
114
  /** Array of choices for this option */
113
- choices: ConnectedOptionChoice[];
115
+ choices: productsV3.ConnectedOptionChoice[];
114
116
  /** Currently selected value for this option */
115
117
  selectedValue: string | null;
116
118
  /** Whether this option has choices */
@@ -153,9 +155,9 @@ export declare function Option(props: OptionProps): import("react").ReactNode;
153
155
  */
154
156
  export interface ChoiceProps {
155
157
  /** Product option data */
156
- option: ConnectedOption;
158
+ option: productsV3.ConnectedOption;
157
159
  /** Choice data */
158
- choice: ConnectedOptionChoice;
160
+ choice: productsV3.ConnectedOptionChoice;
159
161
  /** Render prop function that receives choice data */
160
162
  children: (props: ChoiceRenderProps) => React.ReactNode;
161
163
  }
@@ -175,8 +177,10 @@ export interface ChoiceRenderProps {
175
177
  isPreOrderEnabled: boolean;
176
178
  /** Function to select this choice */
177
179
  select: () => void;
178
- /** Option name */
180
+ /** Option name (may be translated) */
179
181
  optionName: string;
182
+ /** Option key (unique identifier) */
183
+ optionKey: string;
180
184
  /** Choice value */
181
185
  choiceValue: string;
182
186
  }
@@ -223,7 +227,7 @@ export interface StockRenderProps {
223
227
  /** Whether pre-order is enabled */
224
228
  isPreOrderEnabled: boolean;
225
229
  /** Raw inventory availability status */
226
- availabilityStatus: InventoryAvailabilityStatus | string;
230
+ availabilityStatus: productsV3.InventoryAvailabilityStatus | string;
227
231
  /** Whether stock tracking is enabled */
228
232
  trackInventory: boolean;
229
233
  /** Current variant id */
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useService, WixServices } from '@wix/services-manager-react';
3
3
  import { SelectedVariantServiceDefinition, SelectedVariantService, } from '../../services/selected-variant-service.js';
4
4
  import { createServicesMap } from '@wix/services-manager';
5
- import { InventoryAvailabilityStatus, } from '@wix/auto_sdk_stores_products-v-3';
5
+ import { productsV3 } from '@wix/stores';
6
6
  /**
7
7
  * Root component that provides the ProductVariantSelector service context to its children.
8
8
  * This component sets up the necessary services for rendering and managing product variant selection.
@@ -122,10 +122,13 @@ export function Option(props) {
122
122
  const selectedChoices = variantService.selectedChoices.get();
123
123
  const { option } = props;
124
124
  const name = option.name || '';
125
+ // @ts-expect-error - This field is currently INTERNAL but will be public in the future
126
+ const key = option.key || name;
125
127
  const choices = option.choicesSettings?.choices || [];
126
128
  const selectedValue = selectedChoices[name] || null;
127
129
  return props.children({
128
130
  name,
131
+ key,
129
132
  choices,
130
133
  selectedValue,
131
134
  hasChoices: choices.length > 0,
@@ -162,19 +165,21 @@ export function Choice(props) {
162
165
  const selectedChoices = variantService.selectedChoices.get();
163
166
  const { option, choice } = props;
164
167
  const optionName = option.name || '';
168
+ // @ts-expect-error - This field is currently INTERNAL but will be public in the future
169
+ const optionKey = option.key || optionName;
165
170
  const choiceValue = choice.name || '';
166
- const isSelected = selectedChoices[optionName] === choiceValue;
171
+ const isSelected = selectedChoices[optionKey] === choiceValue;
167
172
  // Check if this choice is available based on current selections
168
- const isVisible = variantService.isChoiceAvailable(optionName, choiceValue);
173
+ const isVisible = variantService.isChoiceAvailable(optionKey, choiceValue);
169
174
  // Check if this choice results in an in-stock variant
170
- const isInStock = variantService.isChoiceInStock(optionName, choiceValue);
175
+ const isInStock = variantService.isChoiceInStock(optionKey, choiceValue);
171
176
  // Check if this choice is available for pre-order
172
- const isPreOrderEnabled = variantService.isChoicePreOrderEnabled(optionName, choiceValue);
177
+ const isPreOrderEnabled = variantService.isChoicePreOrderEnabled(optionKey, choiceValue);
173
178
  const value = choiceValue;
174
179
  const select = () => {
175
180
  const newChoices = {
176
181
  ...selectedChoices,
177
- [optionName]: choiceValue,
182
+ [optionKey]: choiceValue,
178
183
  };
179
184
  variantService.setSelectedChoices(newChoices);
180
185
  };
@@ -186,6 +191,7 @@ export function Choice(props) {
186
191
  isPreOrderEnabled,
187
192
  select,
188
193
  optionName,
194
+ optionKey,
189
195
  choiceValue,
190
196
  });
191
197
  }
@@ -230,8 +236,8 @@ export function Stock(props) {
230
236
  const selectedQuantity = variantService.selectedQuantity.get();
231
237
  // Return raw availability status - UI components will handle display conversion
232
238
  const availabilityStatus = inStock
233
- ? InventoryAvailabilityStatus.IN_STOCK
234
- : InventoryAvailabilityStatus.OUT_OF_STOCK;
239
+ ? productsV3.InventoryAvailabilityStatus.IN_STOCK
240
+ : productsV3.InventoryAvailabilityStatus.OUT_OF_STOCK;
235
241
  const incrementQuantity = () => {
236
242
  variantService.incrementQuantity();
237
243
  };
@@ -1,7 +1,7 @@
1
1
  import { defineService, implementService } from '@wix/services-definitions';
2
2
  import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
3
3
  import { getCheckoutUrlForProduct } from '../utils/index.js';
4
- import { getProductBySlug } from '@wix/auto_sdk_stores_products-v-3';
4
+ import { productsV3 } from '@wix/stores';
5
5
  /**
6
6
  * Service definition for the Buy Now service.
7
7
  * This defines the reactive API contract for managing buy now functionality.
@@ -136,7 +136,7 @@ export const BuyNowServiceImplementation = implementService.withConfig()(BuyNowS
136
136
  * ```
137
137
  */
138
138
  export const loadBuyNowServiceInitialData = async (productSlug, variantId) => {
139
- const res = await getProductBySlug(productSlug, {
139
+ const res = await productsV3.getProductBySlug(productSlug, {
140
140
  fields: ['CURRENCY'],
141
141
  });
142
142
  const product = res.product;
@@ -1,6 +1,6 @@
1
1
  import { type ServiceFactoryConfig } from '@wix/services-definitions';
2
2
  import { type Signal, type ReadOnlySignal } from '@wix/services-definitions/core-services/signals';
3
- import * as productsV3 from '@wix/auto_sdk_stores_products-v-3';
3
+ import { productsV3 } from '@wix/stores';
4
4
  export interface ModifierValue {
5
5
  modifierName: string;
6
6
  choiceValue?: string;
@@ -1,6 +1,6 @@
1
1
  import { defineService, implementService, } from '@wix/services-definitions';
2
2
  import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
3
- import * as productsV3 from '@wix/auto_sdk_stores_products-v-3';
3
+ import { productsV3 } from '@wix/stores';
4
4
  import { ProductServiceDefinition } from './product-service.js';
5
5
  export const ProductModifiersServiceDefinition = defineService('productModifiers');
6
6
  export const ProductModifiersService = implementService.withConfig()(ProductModifiersServiceDefinition, ({ getService }) => {
@@ -1,4 +1,4 @@
1
- import * as productsV3 from '@wix/auto_sdk_stores_products-v-3';
1
+ import { productsV3 } from '@wix/stores';
2
2
  import { type Signal } from '@wix/services-definitions/core-services/signals';
3
3
  /**
4
4
  * API interface for the Product service, providing reactive product data management.
@@ -1,4 +1,4 @@
1
- import * as productsV3 from '@wix/auto_sdk_stores_products-v-3';
1
+ import { productsV3 } from '@wix/stores';
2
2
  import { defineService, implementService } from '@wix/services-definitions';
3
3
  import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
4
4
  import { analytics } from '@wix/site';
@@ -1,5 +1,5 @@
1
1
  import { type Signal, type ReadOnlySignal } from '@wix/services-definitions/core-services/signals';
2
- import * as productsV3 from '@wix/auto_sdk_stores_products-v-3';
2
+ import { productsV3 } from '@wix/stores';
3
3
  export interface SelectedVariantServiceAPI {
4
4
  selectedQuantity: Signal<number>;
5
5
  selectedChoices: Signal<Record<string, string>>;
@@ -39,15 +39,15 @@ export interface SelectedVariantServiceAPI {
39
39
  decrementQuantity: () => void;
40
40
  selectVariantById: (id: string) => void;
41
41
  resetSelections: () => void;
42
- getAvailableChoicesForOption: (optionName: string) => string[];
43
- getChoiceInfo: (optionName: string, choiceValue: string) => {
42
+ getAvailableChoicesForOption: (optionKey: string) => string[];
43
+ getChoiceInfo: (optionKey: string, choiceValue: string) => {
44
44
  isAvailable: boolean;
45
45
  isInStock: boolean;
46
46
  isPreOrderEnabled: boolean;
47
47
  };
48
- isChoiceAvailable: (optionName: string, choiceValue: string) => boolean;
49
- isChoiceInStock: (optionName: string, choiceValue: string) => boolean;
50
- isChoicePreOrderEnabled: (optionName: string, choiceValue: string) => boolean;
48
+ isChoiceAvailable: (optionKey: string, choiceValue: string) => boolean;
49
+ isChoiceInStock: (optionKey: string, choiceValue: string) => boolean;
50
+ isChoicePreOrderEnabled: (optionKey: string, choiceValue: string) => boolean;
51
51
  hasAnySelections: () => boolean;
52
52
  IsAllVariantsAreOutOfStock: () => boolean;
53
53
  }
@@ -1,7 +1,6 @@
1
1
  import { defineService, implementService } from '@wix/services-definitions';
2
2
  import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
3
- import * as productsV3 from '@wix/auto_sdk_stores_products-v-3';
4
- import * as inventoryItemsV3 from '@wix/auto_sdk_stores_inventory-items-v-3';
3
+ import { inventoryItemsV3, productsV3 } from '@wix/stores';
5
4
  import { CurrentCartServiceDefinition } from '@wix/headless-ecom/services';
6
5
  import { MediaGalleryServiceDefinition } from '@wix/headless-media/services';
7
6
  import { ProductServiceDefinition } from './product-service.js';
@@ -202,8 +201,8 @@ export const SelectedVariantService = implementService.withConfig()(SelectedVari
202
201
  if (Object.keys(choices).length !==
203
202
  Object.keys(variantChoices).length)
204
203
  return false;
205
- return Object.entries(choices).every(([optionName, optionValue]) => {
206
- return variantChoices[optionName] === optionValue;
204
+ return Object.entries(choices).every(([optionKey, optionValue]) => {
205
+ return variantChoices[optionKey] === optionValue;
207
206
  });
208
207
  }) || null);
209
208
  }));
@@ -410,7 +409,7 @@ export const SelectedVariantService = implementService.withConfig()(SelectedVari
410
409
  selectedQuantity.set(newQuantity);
411
410
  };
412
411
  // New methods for smart variant selection
413
- const getAvailableChoicesForOption = (optionName) => {
412
+ const getAvailableChoicesForOption = (optionKey) => {
414
413
  const currentChoices = selectedChoices.get();
415
414
  const variantsList = variants.get();
416
415
  // Get all possible choices for this option that result in valid variants
@@ -419,21 +418,21 @@ export const SelectedVariantService = implementService.withConfig()(SelectedVari
419
418
  const variantChoices = processVariantChoices(variant);
420
419
  // Check if this variant matches all currently selected choices (except for the option we're checking)
421
420
  const matchesOtherChoices = Object.entries(currentChoices)
422
- .filter(([key]) => key !== optionName)
421
+ .filter(([key]) => key !== optionKey)
423
422
  .every(([key, value]) => variantChoices[key] === value);
424
- if (matchesOtherChoices && variantChoices[optionName]) {
425
- availableChoices.add(variantChoices[optionName]);
423
+ if (matchesOtherChoices && variantChoices[optionKey]) {
424
+ availableChoices.add(variantChoices[optionKey]);
426
425
  }
427
426
  });
428
427
  return Array.from(availableChoices);
429
428
  };
430
429
  // Core method that provides both availability and stock info efficiently
431
- const getChoiceInfo = (optionName, choiceValue) => {
430
+ const getChoiceInfo = (optionKey, choiceValue) => {
432
431
  // Create hypothetical choices with this choice selected
433
432
  const currentChoices = selectedChoices.get();
434
433
  const hypotheticalChoices = {
435
434
  ...currentChoices,
436
- [optionName]: choiceValue,
435
+ [optionKey]: choiceValue,
437
436
  };
438
437
  // Get all variants and find one that matches these choices
439
438
  const variantsList = variants.get();
@@ -459,14 +458,14 @@ export const SelectedVariantService = implementService.withConfig()(SelectedVari
459
458
  return { isAvailable, isInStock, isPreOrderEnabled };
460
459
  };
461
460
  // Simplified methods using the core getChoiceInfo
462
- const isChoiceAvailable = (optionName, choiceValue) => {
463
- return getChoiceInfo(optionName, choiceValue).isAvailable;
461
+ const isChoiceAvailable = (optionKey, choiceValue) => {
462
+ return getChoiceInfo(optionKey, choiceValue).isAvailable;
464
463
  };
465
- const isChoiceInStock = (optionName, choiceValue) => {
466
- return getChoiceInfo(optionName, choiceValue).isInStock;
464
+ const isChoiceInStock = (optionKey, choiceValue) => {
465
+ return getChoiceInfo(optionKey, choiceValue).isInStock;
467
466
  };
468
- const isChoicePreOrderEnabled = (optionName, choiceValue) => {
469
- return getChoiceInfo(optionName, choiceValue).isPreOrderEnabled;
467
+ const isChoicePreOrderEnabled = (optionKey, choiceValue) => {
468
+ return getChoiceInfo(optionKey, choiceValue).isPreOrderEnabled;
470
469
  };
471
470
  const hasAnySelections = () => {
472
471
  const currentChoices = selectedChoices.get();
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { AsChildChildren } from '@wix/headless-utils/react';
3
3
  export interface Option {
4
4
  name: string;
5
+ key?: string;
5
6
  choices?: any[];
6
7
  hasChoices?: boolean;
7
8
  type?: string;
@@ -1,4 +1,4 @@
1
- import type { V3Product } from '@wix/auto_sdk_stores_products-v-3';
1
+ import { productsV3 } from '@wix/stores';
2
2
  import { AsChildChildren } from '@wix/headless-utils/react';
3
3
  import React from 'react';
4
4
  import { AsContent } from './types.js';
@@ -37,7 +37,7 @@ export type StockStatus = BasicStockStatus | 'can-pre-order';
37
37
  */
38
38
  export interface ProductRootProps {
39
39
  children: React.ReactNode;
40
- product: V3Product;
40
+ product: productsV3.V3Product;
41
41
  selectedVariant?: any;
42
42
  }
43
43
  /**
@@ -268,7 +268,7 @@ export interface RawProps {
268
268
  asChild?: boolean;
269
269
  /** Custom render function when using asChild */
270
270
  children?: AsChildChildren<{
271
- product: V3Product;
271
+ product: productsV3.V3Product;
272
272
  }>;
273
273
  /** CSS classes to apply to the default element */
274
274
  className?: string;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { InventoryAvailabilityStatus } from '@wix/auto_sdk_stores_products-v-3';
2
+ import { productsV3 } from '@wix/stores';
3
3
  import { Quantity as QuantityComponent } from '@wix/headless-components/react';
4
4
  import { Commerce } from '@wix/headless-ecom/react';
5
5
  import { MediaGallery } from '@wix/headless-media/react';
@@ -406,15 +406,15 @@ export const Stock = React.forwardRef((props, ref) => {
406
406
  let status;
407
407
  let label;
408
408
  switch (availabilityStatus) {
409
- case InventoryAvailabilityStatus.IN_STOCK:
409
+ case productsV3.InventoryAvailabilityStatus.IN_STOCK:
410
410
  status = 'in-stock';
411
411
  label = finalLabels.inStock;
412
412
  break;
413
- case InventoryAvailabilityStatus.PARTIALLY_OUT_OF_STOCK:
413
+ case productsV3.InventoryAvailabilityStatus.PARTIALLY_OUT_OF_STOCK:
414
414
  status = 'limited-stock';
415
415
  label = finalLabels.limitedStock;
416
416
  break;
417
- case InventoryAvailabilityStatus.OUT_OF_STOCK:
417
+ case productsV3.InventoryAvailabilityStatus.OUT_OF_STOCK:
418
418
  default:
419
419
  status = 'out-of-stock';
420
420
  label = finalLabels.outOfStock;
@@ -1046,12 +1046,12 @@ function getStockStatusMessage(inStock, isPreOrderEnabled, availabilityStatus, l
1046
1046
  // Handle stock status based on availability
1047
1047
  if (inStock) {
1048
1048
  switch (availabilityStatus) {
1049
- case InventoryAvailabilityStatus.IN_STOCK:
1049
+ case productsV3.InventoryAvailabilityStatus.IN_STOCK:
1050
1050
  return {
1051
1051
  status: 'in-stock',
1052
1052
  label: labels.inStock,
1053
1053
  };
1054
- case InventoryAvailabilityStatus.PARTIALLY_OUT_OF_STOCK:
1054
+ case productsV3.InventoryAvailabilityStatus.PARTIALLY_OUT_OF_STOCK:
1055
1055
  return {
1056
1056
  status: 'limited-stock',
1057
1057
  label: labels.limitedStock,
@@ -1,4 +1,3 @@
1
- import type { V3Product } from '@wix/auto_sdk_stores_products-v-3';
2
1
  import { Sort as SortPrimitive, GenericListTotalsRenderProps, GenericListLoadMoreRenderProps, ListVariant, GenericListRepeaterRenderProps } from '@wix/headless-components/react';
3
2
  import React from 'react';
4
3
  import type { ProductsListServiceConfig } from '../services/products-list-service.js';
@@ -9,7 +8,7 @@ import { AsChildChildren } from '@wix/headless-utils/react';
9
8
  */
10
9
  export interface ProductListRootProps {
11
10
  children: React.ReactNode;
12
- products?: V3Product[];
11
+ products?: productsV3.V3Product[];
13
12
  productsListConfig?: ProductsListServiceConfig;
14
13
  className?: string;
15
14
  variant?: ListVariant;
@@ -95,7 +94,7 @@ export declare const Products: React.ForwardRefExoticComponent<ProductsProps & R
95
94
  /**
96
95
  * Render props for ProductRepeater asChild pattern
97
96
  */
98
- export type ProductRepeaterRenderProps = GenericListRepeaterRenderProps<V3Product>;
97
+ export type ProductRepeaterRenderProps = GenericListRepeaterRenderProps<productsV3.V3Product>;
99
98
  /**
100
99
  * Props for ProductList ProductRepeater component
101
100
  */
@@ -1,5 +1,5 @@
1
1
  import { ProductServiceConfig } from '../../services/product-service.js';
2
- import type { V3Product, ProductMedia } from '@wix/auto_sdk_stores_products-v-3';
2
+ import { productsV3 } from '@wix/stores';
3
3
  export interface RootProps {
4
4
  children: React.ReactNode;
5
5
  productServiceConfig: ProductServiceConfig;
@@ -81,18 +81,18 @@ export interface ProductDescriptionProps {
81
81
  */
82
82
  export interface ProductDescriptionRenderProps {
83
83
  /** Product description using the RICOS (Rich Content Object) format. See https://dev.wix.com/docs/ricos/api-reference/ricos-document */
84
- description: NonNullable<V3Product['description']>;
84
+ description: NonNullable<productsV3.V3Product['description']>;
85
85
  /** Product description with plain html */
86
- plainDescription: NonNullable<V3Product['plainDescription']>;
86
+ plainDescription: NonNullable<productsV3.V3Product['plainDescription']>;
87
87
  }
88
88
  /**
89
89
  * Render props for ProductDescription component
90
90
  */
91
91
  export interface ProductDescriptionRenderProps {
92
92
  /** Product description using the RICOS (Rich Content Object) format. See https://dev.wix.com/docs/ricos/api-reference/ricos-document */
93
- description: NonNullable<V3Product['description']>;
93
+ description: NonNullable<productsV3.V3Product['description']>;
94
94
  /** Product description with plain html */
95
- plainDescription: NonNullable<V3Product['plainDescription']>;
95
+ plainDescription: NonNullable<productsV3.V3Product['plainDescription']>;
96
96
  }
97
97
  /**
98
98
  * Headless component for product description display
@@ -129,15 +129,15 @@ export interface ProductMediaProps {
129
129
  children: (props: ProductMediaRenderProps) => React.ReactNode;
130
130
  }
131
131
  export interface ProductMediaRenderProps {
132
- mediaItems: ProductMedia[];
133
- mainMedia?: ProductMedia;
132
+ mediaItems: productsV3.ProductMedia[];
133
+ mainMedia?: productsV3.ProductMedia;
134
134
  }
135
135
  export declare function Media(props: ProductMediaProps): import("react").ReactNode;
136
136
  export interface ProductProps {
137
137
  children: (props: ProductRenderProps) => React.ReactNode;
138
138
  }
139
139
  export interface ProductRenderProps {
140
- product: V3Product;
140
+ product: productsV3.V3Product;
141
141
  }
142
142
  export declare function Content(props: ProductProps): import("react").ReactNode;
143
143
  export interface LoadingProps {
@@ -1,4 +1,4 @@
1
- import { type ConnectedModifier, type ConnectedModifierChoice } from '@wix/auto_sdk_stores_products-v-3';
1
+ import { productsV3 } from '@wix/stores';
2
2
  export interface RootProps {
3
3
  children: React.ReactNode;
4
4
  }
@@ -89,7 +89,7 @@ export interface ModifiersProps {
89
89
  */
90
90
  export interface ModifiersRenderProps {
91
91
  /** Array of product modifiers */
92
- modifiers: ConnectedModifier[];
92
+ modifiers: productsV3.ConnectedModifier[];
93
93
  /** Whether product has modifiers */
94
94
  hasModifiers: boolean;
95
95
  /** Currently selected modifier values */
@@ -148,7 +148,7 @@ export declare function Modifiers(props: ModifiersProps): import("react").ReactN
148
148
  */
149
149
  export interface ModifierProps {
150
150
  /** Product modifier data */
151
- modifier: ConnectedModifier;
151
+ modifier: productsV3.ConnectedModifier;
152
152
  /** Render prop function that receives modifier data */
153
153
  children: (props: ModifierRenderProps) => React.ReactNode;
154
154
  }
@@ -156,14 +156,16 @@ export interface ModifierProps {
156
156
  * Render props for Modifier component
157
157
  */
158
158
  export interface ModifierRenderProps {
159
- /** Modifier name */
159
+ /** Modifier name (may be translated) */
160
160
  name: string;
161
+ /** Modifier key (unique identifier) */
162
+ key: string;
161
163
  /** Modifier type */
162
164
  type: any;
163
165
  /** Whether this modifier is mandatory */
164
166
  mandatory: boolean;
165
167
  /** Array of choices for this modifier (for choice-based modifiers) */
166
- choices: ConnectedModifierChoice[];
168
+ choices: productsV3.ConnectedModifierChoice[];
167
169
  /** Currently selected value for this modifier */
168
170
  selectedValue: any;
169
171
  /** Whether this modifier has choices */
@@ -227,9 +229,9 @@ export declare function Modifier(props: ModifierProps): import("react").ReactNod
227
229
  */
228
230
  export interface ChoiceProps {
229
231
  /** Product modifier data */
230
- modifier: ConnectedModifier;
232
+ modifier: productsV3.ConnectedModifier;
231
233
  /** Choice data */
232
- choice: ConnectedModifierChoice;
234
+ choice: productsV3.ConnectedModifierChoice;
233
235
  /** Render prop function that receives choice data */
234
236
  children: (props: ChoiceRenderProps) => React.ReactNode;
235
237
  }
@@ -288,7 +290,7 @@ export declare function Choice(props: ChoiceProps): import("react").ReactNode;
288
290
  */
289
291
  export interface FreeTextProps {
290
292
  /** Product modifier data */
291
- modifier: ConnectedModifier;
293
+ modifier: productsV3.ConnectedModifier;
292
294
  /** Render prop function that receives free text data */
293
295
  children: (props: FreeTextRenderProps) => React.ReactNode;
294
296
  }
@@ -354,7 +356,7 @@ export declare function FreeText(props: FreeTextProps): import("react").ReactNod
354
356
  */
355
357
  export interface ToggleFreeTextProps {
356
358
  /** Product modifier data */
357
- modifier: ConnectedModifier;
359
+ modifier: productsV3.ConnectedModifier;
358
360
  /** Render prop function that receives toggle data */
359
361
  children: (props: ToggleFreeTextRenderProps) => React.ReactNode;
360
362
  }
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
3
  import { useService, WixServices } from '@wix/services-manager-react';
4
4
  import { ProductModifiersServiceDefinition, ProductModifiersService, } from '../../services/product-modifiers-service.js';
5
- import { ModifierRenderType, } from '@wix/auto_sdk_stores_products-v-3';
5
+ import { productsV3 } from '@wix/stores';
6
6
  import { createServicesMap } from '@wix/services-manager';
7
7
  /**
8
8
  * Root component that provides the ProductModifiers service context to its children.
@@ -208,17 +208,20 @@ export function Modifier(props) {
208
208
  const modifiersService = useModifiersService();
209
209
  const { modifier } = props;
210
210
  const name = modifier.name || '';
211
+ // @ts-expect-error - This field is currently INTERNAL but will be public in the future
212
+ const key = modifier.key || name;
211
213
  const type = modifier.modifierRenderType;
212
214
  const mandatory = modifier.mandatory || false;
213
215
  const choices = modifier.choicesSettings?.choices || [];
214
216
  const hasChoices = choices.length > 0;
215
- const isFreeText = type === ModifierRenderType.FREE_TEXT;
217
+ const isFreeText = type === productsV3.ModifierRenderType.FREE_TEXT;
216
218
  const freeTextSettings = modifier.freeTextSettings;
217
219
  const maxChars = freeTextSettings?.maxLength;
218
220
  const placeholder = freeTextSettings?.placeholder;
219
221
  const selectedValue = modifiersService?.selectedModifiers.get()[name] || null;
220
222
  return props.children({
221
223
  name,
224
+ key,
222
225
  type,
223
226
  mandatory,
224
227
  choices,
@@ -265,7 +268,7 @@ export function Choice(props) {
265
268
  const modifierName = modifier.name || '';
266
269
  const renderType = modifier.modifierRenderType;
267
270
  // For TEXT_CHOICES, use choice.key; for SWATCH_CHOICES, use choice.name
268
- const choiceValue = renderType === ModifierRenderType.TEXT_CHOICES
271
+ const choiceValue = renderType === productsV3.ModifierRenderType.TEXT_CHOICES
269
272
  ? choice.key || choice.name || ''
270
273
  : choice.name || '';
271
274
  const value = choice.name || ''; // Display name is always choice.name
@@ -1,5 +1,5 @@
1
1
  import { SelectedVariantServiceConfig } from '../../services/selected-variant-service.js';
2
- import { type ConnectedOption, type ConnectedOptionChoice, InventoryAvailabilityStatus } from '@wix/auto_sdk_stores_products-v-3';
2
+ import { productsV3 } from '@wix/stores';
3
3
  export interface RootProps {
4
4
  children: React.ReactNode;
5
5
  selectedVariantServiceConfig?: SelectedVariantServiceConfig;
@@ -55,7 +55,7 @@ export interface OptionsProps {
55
55
  */
56
56
  export interface OptionsRenderProps {
57
57
  /** Array of product options */
58
- options: ConnectedOption[];
58
+ options: productsV3.ConnectedOption[];
59
59
  /** Whether product has options */
60
60
  hasOptions: boolean;
61
61
  /** Currently selected choices */
@@ -99,7 +99,7 @@ export declare function Options(props: OptionsProps): import("react").ReactNode;
99
99
  */
100
100
  export interface OptionProps {
101
101
  /** Product option data */
102
- option: ConnectedOption;
102
+ option: productsV3.ConnectedOption;
103
103
  /** Render prop function that receives option data */
104
104
  children: (props: OptionRenderProps) => React.ReactNode;
105
105
  }
@@ -107,10 +107,12 @@ export interface OptionProps {
107
107
  * Render props for Option component
108
108
  */
109
109
  export interface OptionRenderProps {
110
- /** Option name */
110
+ /** Option name (may be translated) */
111
111
  name: string;
112
+ /** Option key (unique identifier) */
113
+ key: string;
112
114
  /** Array of choices for this option */
113
- choices: ConnectedOptionChoice[];
115
+ choices: productsV3.ConnectedOptionChoice[];
114
116
  /** Currently selected value for this option */
115
117
  selectedValue: string | null;
116
118
  /** Whether this option has choices */
@@ -153,9 +155,9 @@ export declare function Option(props: OptionProps): import("react").ReactNode;
153
155
  */
154
156
  export interface ChoiceProps {
155
157
  /** Product option data */
156
- option: ConnectedOption;
158
+ option: productsV3.ConnectedOption;
157
159
  /** Choice data */
158
- choice: ConnectedOptionChoice;
160
+ choice: productsV3.ConnectedOptionChoice;
159
161
  /** Render prop function that receives choice data */
160
162
  children: (props: ChoiceRenderProps) => React.ReactNode;
161
163
  }
@@ -175,8 +177,10 @@ export interface ChoiceRenderProps {
175
177
  isPreOrderEnabled: boolean;
176
178
  /** Function to select this choice */
177
179
  select: () => void;
178
- /** Option name */
180
+ /** Option name (may be translated) */
179
181
  optionName: string;
182
+ /** Option key (unique identifier) */
183
+ optionKey: string;
180
184
  /** Choice value */
181
185
  choiceValue: string;
182
186
  }
@@ -223,7 +227,7 @@ export interface StockRenderProps {
223
227
  /** Whether pre-order is enabled */
224
228
  isPreOrderEnabled: boolean;
225
229
  /** Raw inventory availability status */
226
- availabilityStatus: InventoryAvailabilityStatus | string;
230
+ availabilityStatus: productsV3.InventoryAvailabilityStatus | string;
227
231
  /** Whether stock tracking is enabled */
228
232
  trackInventory: boolean;
229
233
  /** Current variant id */
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useService, WixServices } from '@wix/services-manager-react';
3
3
  import { SelectedVariantServiceDefinition, SelectedVariantService, } from '../../services/selected-variant-service.js';
4
4
  import { createServicesMap } from '@wix/services-manager';
5
- import { InventoryAvailabilityStatus, } from '@wix/auto_sdk_stores_products-v-3';
5
+ import { productsV3 } from '@wix/stores';
6
6
  /**
7
7
  * Root component that provides the ProductVariantSelector service context to its children.
8
8
  * This component sets up the necessary services for rendering and managing product variant selection.
@@ -122,10 +122,13 @@ export function Option(props) {
122
122
  const selectedChoices = variantService.selectedChoices.get();
123
123
  const { option } = props;
124
124
  const name = option.name || '';
125
+ // @ts-expect-error - This field is currently INTERNAL but will be public in the future
126
+ const key = option.key || name;
125
127
  const choices = option.choicesSettings?.choices || [];
126
128
  const selectedValue = selectedChoices[name] || null;
127
129
  return props.children({
128
130
  name,
131
+ key,
129
132
  choices,
130
133
  selectedValue,
131
134
  hasChoices: choices.length > 0,
@@ -162,19 +165,21 @@ export function Choice(props) {
162
165
  const selectedChoices = variantService.selectedChoices.get();
163
166
  const { option, choice } = props;
164
167
  const optionName = option.name || '';
168
+ // @ts-expect-error - This field is currently INTERNAL but will be public in the future
169
+ const optionKey = option.key || optionName;
165
170
  const choiceValue = choice.name || '';
166
- const isSelected = selectedChoices[optionName] === choiceValue;
171
+ const isSelected = selectedChoices[optionKey] === choiceValue;
167
172
  // Check if this choice is available based on current selections
168
- const isVisible = variantService.isChoiceAvailable(optionName, choiceValue);
173
+ const isVisible = variantService.isChoiceAvailable(optionKey, choiceValue);
169
174
  // Check if this choice results in an in-stock variant
170
- const isInStock = variantService.isChoiceInStock(optionName, choiceValue);
175
+ const isInStock = variantService.isChoiceInStock(optionKey, choiceValue);
171
176
  // Check if this choice is available for pre-order
172
- const isPreOrderEnabled = variantService.isChoicePreOrderEnabled(optionName, choiceValue);
177
+ const isPreOrderEnabled = variantService.isChoicePreOrderEnabled(optionKey, choiceValue);
173
178
  const value = choiceValue;
174
179
  const select = () => {
175
180
  const newChoices = {
176
181
  ...selectedChoices,
177
- [optionName]: choiceValue,
182
+ [optionKey]: choiceValue,
178
183
  };
179
184
  variantService.setSelectedChoices(newChoices);
180
185
  };
@@ -186,6 +191,7 @@ export function Choice(props) {
186
191
  isPreOrderEnabled,
187
192
  select,
188
193
  optionName,
194
+ optionKey,
189
195
  choiceValue,
190
196
  });
191
197
  }
@@ -230,8 +236,8 @@ export function Stock(props) {
230
236
  const selectedQuantity = variantService.selectedQuantity.get();
231
237
  // Return raw availability status - UI components will handle display conversion
232
238
  const availabilityStatus = inStock
233
- ? InventoryAvailabilityStatus.IN_STOCK
234
- : InventoryAvailabilityStatus.OUT_OF_STOCK;
239
+ ? productsV3.InventoryAvailabilityStatus.IN_STOCK
240
+ : productsV3.InventoryAvailabilityStatus.OUT_OF_STOCK;
235
241
  const incrementQuantity = () => {
236
242
  variantService.incrementQuantity();
237
243
  };
@@ -1,7 +1,7 @@
1
1
  import { defineService, implementService } from '@wix/services-definitions';
2
2
  import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
3
3
  import { getCheckoutUrlForProduct } from '../utils/index.js';
4
- import { getProductBySlug } from '@wix/auto_sdk_stores_products-v-3';
4
+ import { productsV3 } from '@wix/stores';
5
5
  /**
6
6
  * Service definition for the Buy Now service.
7
7
  * This defines the reactive API contract for managing buy now functionality.
@@ -136,7 +136,7 @@ export const BuyNowServiceImplementation = implementService.withConfig()(BuyNowS
136
136
  * ```
137
137
  */
138
138
  export const loadBuyNowServiceInitialData = async (productSlug, variantId) => {
139
- const res = await getProductBySlug(productSlug, {
139
+ const res = await productsV3.getProductBySlug(productSlug, {
140
140
  fields: ['CURRENCY'],
141
141
  });
142
142
  const product = res.product;
@@ -1,6 +1,6 @@
1
1
  import { type ServiceFactoryConfig } from '@wix/services-definitions';
2
2
  import { type Signal, type ReadOnlySignal } from '@wix/services-definitions/core-services/signals';
3
- import * as productsV3 from '@wix/auto_sdk_stores_products-v-3';
3
+ import { productsV3 } from '@wix/stores';
4
4
  export interface ModifierValue {
5
5
  modifierName: string;
6
6
  choiceValue?: string;
@@ -1,6 +1,6 @@
1
1
  import { defineService, implementService, } from '@wix/services-definitions';
2
2
  import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
3
- import * as productsV3 from '@wix/auto_sdk_stores_products-v-3';
3
+ import { productsV3 } from '@wix/stores';
4
4
  import { ProductServiceDefinition } from './product-service.js';
5
5
  export const ProductModifiersServiceDefinition = defineService('productModifiers');
6
6
  export const ProductModifiersService = implementService.withConfig()(ProductModifiersServiceDefinition, ({ getService }) => {
@@ -1,4 +1,4 @@
1
- import * as productsV3 from '@wix/auto_sdk_stores_products-v-3';
1
+ import { productsV3 } from '@wix/stores';
2
2
  import { type Signal } from '@wix/services-definitions/core-services/signals';
3
3
  /**
4
4
  * API interface for the Product service, providing reactive product data management.
@@ -1,4 +1,4 @@
1
- import * as productsV3 from '@wix/auto_sdk_stores_products-v-3';
1
+ import { productsV3 } from '@wix/stores';
2
2
  import { defineService, implementService } from '@wix/services-definitions';
3
3
  import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
4
4
  import { analytics } from '@wix/site';
@@ -1,5 +1,5 @@
1
1
  import { type Signal, type ReadOnlySignal } from '@wix/services-definitions/core-services/signals';
2
- import * as productsV3 from '@wix/auto_sdk_stores_products-v-3';
2
+ import { productsV3 } from '@wix/stores';
3
3
  export interface SelectedVariantServiceAPI {
4
4
  selectedQuantity: Signal<number>;
5
5
  selectedChoices: Signal<Record<string, string>>;
@@ -39,15 +39,15 @@ export interface SelectedVariantServiceAPI {
39
39
  decrementQuantity: () => void;
40
40
  selectVariantById: (id: string) => void;
41
41
  resetSelections: () => void;
42
- getAvailableChoicesForOption: (optionName: string) => string[];
43
- getChoiceInfo: (optionName: string, choiceValue: string) => {
42
+ getAvailableChoicesForOption: (optionKey: string) => string[];
43
+ getChoiceInfo: (optionKey: string, choiceValue: string) => {
44
44
  isAvailable: boolean;
45
45
  isInStock: boolean;
46
46
  isPreOrderEnabled: boolean;
47
47
  };
48
- isChoiceAvailable: (optionName: string, choiceValue: string) => boolean;
49
- isChoiceInStock: (optionName: string, choiceValue: string) => boolean;
50
- isChoicePreOrderEnabled: (optionName: string, choiceValue: string) => boolean;
48
+ isChoiceAvailable: (optionKey: string, choiceValue: string) => boolean;
49
+ isChoiceInStock: (optionKey: string, choiceValue: string) => boolean;
50
+ isChoicePreOrderEnabled: (optionKey: string, choiceValue: string) => boolean;
51
51
  hasAnySelections: () => boolean;
52
52
  IsAllVariantsAreOutOfStock: () => boolean;
53
53
  }
@@ -1,7 +1,6 @@
1
1
  import { defineService, implementService } from '@wix/services-definitions';
2
2
  import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
3
- import * as productsV3 from '@wix/auto_sdk_stores_products-v-3';
4
- import * as inventoryItemsV3 from '@wix/auto_sdk_stores_inventory-items-v-3';
3
+ import { inventoryItemsV3, productsV3 } from '@wix/stores';
5
4
  import { CurrentCartServiceDefinition } from '@wix/headless-ecom/services';
6
5
  import { MediaGalleryServiceDefinition } from '@wix/headless-media/services';
7
6
  import { ProductServiceDefinition } from './product-service.js';
@@ -202,8 +201,8 @@ export const SelectedVariantService = implementService.withConfig()(SelectedVari
202
201
  if (Object.keys(choices).length !==
203
202
  Object.keys(variantChoices).length)
204
203
  return false;
205
- return Object.entries(choices).every(([optionName, optionValue]) => {
206
- return variantChoices[optionName] === optionValue;
204
+ return Object.entries(choices).every(([optionKey, optionValue]) => {
205
+ return variantChoices[optionKey] === optionValue;
207
206
  });
208
207
  }) || null);
209
208
  }));
@@ -410,7 +409,7 @@ export const SelectedVariantService = implementService.withConfig()(SelectedVari
410
409
  selectedQuantity.set(newQuantity);
411
410
  };
412
411
  // New methods for smart variant selection
413
- const getAvailableChoicesForOption = (optionName) => {
412
+ const getAvailableChoicesForOption = (optionKey) => {
414
413
  const currentChoices = selectedChoices.get();
415
414
  const variantsList = variants.get();
416
415
  // Get all possible choices for this option that result in valid variants
@@ -419,21 +418,21 @@ export const SelectedVariantService = implementService.withConfig()(SelectedVari
419
418
  const variantChoices = processVariantChoices(variant);
420
419
  // Check if this variant matches all currently selected choices (except for the option we're checking)
421
420
  const matchesOtherChoices = Object.entries(currentChoices)
422
- .filter(([key]) => key !== optionName)
421
+ .filter(([key]) => key !== optionKey)
423
422
  .every(([key, value]) => variantChoices[key] === value);
424
- if (matchesOtherChoices && variantChoices[optionName]) {
425
- availableChoices.add(variantChoices[optionName]);
423
+ if (matchesOtherChoices && variantChoices[optionKey]) {
424
+ availableChoices.add(variantChoices[optionKey]);
426
425
  }
427
426
  });
428
427
  return Array.from(availableChoices);
429
428
  };
430
429
  // Core method that provides both availability and stock info efficiently
431
- const getChoiceInfo = (optionName, choiceValue) => {
430
+ const getChoiceInfo = (optionKey, choiceValue) => {
432
431
  // Create hypothetical choices with this choice selected
433
432
  const currentChoices = selectedChoices.get();
434
433
  const hypotheticalChoices = {
435
434
  ...currentChoices,
436
- [optionName]: choiceValue,
435
+ [optionKey]: choiceValue,
437
436
  };
438
437
  // Get all variants and find one that matches these choices
439
438
  const variantsList = variants.get();
@@ -459,14 +458,14 @@ export const SelectedVariantService = implementService.withConfig()(SelectedVari
459
458
  return { isAvailable, isInStock, isPreOrderEnabled };
460
459
  };
461
460
  // Simplified methods using the core getChoiceInfo
462
- const isChoiceAvailable = (optionName, choiceValue) => {
463
- return getChoiceInfo(optionName, choiceValue).isAvailable;
461
+ const isChoiceAvailable = (optionKey, choiceValue) => {
462
+ return getChoiceInfo(optionKey, choiceValue).isAvailable;
464
463
  };
465
- const isChoiceInStock = (optionName, choiceValue) => {
466
- return getChoiceInfo(optionName, choiceValue).isInStock;
464
+ const isChoiceInStock = (optionKey, choiceValue) => {
465
+ return getChoiceInfo(optionKey, choiceValue).isInStock;
467
466
  };
468
- const isChoicePreOrderEnabled = (optionName, choiceValue) => {
469
- return getChoiceInfo(optionName, choiceValue).isPreOrderEnabled;
467
+ const isChoicePreOrderEnabled = (optionKey, choiceValue) => {
468
+ return getChoiceInfo(optionKey, choiceValue).isPreOrderEnabled;
470
469
  };
471
470
  const hasAnySelections = () => {
472
471
  const currentChoices = selectedChoices.get();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/headless-stores",
3
- "version": "0.0.105",
3
+ "version": "0.0.106",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -50,7 +50,7 @@
50
50
  "@vitest/ui": "^3.1.4",
51
51
  "@wix/categories": "^1.0.133",
52
52
  "@wix/headless-components": "0.0.0",
53
- "@wix/stores": "^1.0.551",
53
+ "@wix/stores": "^1.0.606",
54
54
  "jsdom": "^26.1.0",
55
55
  "prettier": "^3.4.2",
56
56
  "typescript": "^5.8.3",
@@ -60,11 +60,7 @@
60
60
  "@radix-ui/react-slot": "^1.2.3",
61
61
  "@wix/auto_sdk_bookings_availability-calendar": "^1.0.155",
62
62
  "@wix/auto_sdk_categories_categories": "^1.0.62",
63
- "@wix/auto_sdk_stores_customizations-v-3": "^1.0.26",
64
- "@wix/auto_sdk_stores_inventory-items-v-3": "^1.0.26",
65
- "@wix/auto_sdk_stores_products-v-3": "^1.0.53",
66
- "@wix/auto_sdk_stores_read-only-variants-v-3": "^1.0.23",
67
- "@wix/ecom": "^1.0.1461",
63
+ "@wix/ecom": "^1.0.1560",
68
64
  "@wix/essentials": "^0.1.24",
69
65
  "@wix/headless-ecom": "0.0.38",
70
66
  "@wix/headless-media": "0.0.18",
@@ -72,7 +68,8 @@
72
68
  "@wix/redirects": "^1.0.83",
73
69
  "@wix/services-definitions": "^0.1.4",
74
70
  "@wix/services-manager-react": "^0.1.26",
75
- "@wix/site": "^1.27.0"
71
+ "@wix/site": "^1.37.0",
72
+ "@wix/stores": "^1.0.606"
76
73
  },
77
74
  "peerDependencies": {
78
75
  "@wix/headless-components": "^0.0.0"
@@ -87,5 +84,5 @@
87
84
  "groupId": "com.wixpress.headless-components"
88
85
  }
89
86
  },
90
- "falconPackageHash": "2937c978ada9e33f794daf2161a4f84ffe9ea93141e59938401efb95"
87
+ "falconPackageHash": "98aa3c62ed1cd635109ed3fc6def9b78f40ad252ce17e70b7950de36"
91
88
  }