@wix/headless-stores 0.0.31 → 0.0.33

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.
@@ -10,6 +10,7 @@ export interface RootProps {
10
10
  * Root component that provides the ProductsList service context to its children.
11
11
  * This component sets up the necessary services for managing products list state.
12
12
  *
13
+ * @order 1
13
14
  * @component
14
15
  * @example
15
16
  * ```tsx
@@ -7,6 +7,7 @@ import { ProductService, ProductServiceDefinition, } from "@wix/headless-stores/
7
7
  * Root component that provides the ProductsList service context to its children.
8
8
  * This component sets up the necessary services for managing products list state.
9
9
  *
10
+ * @order 1
10
11
  * @component
11
12
  * @example
12
13
  * ```tsx
@@ -19,12 +19,13 @@ export declare const ProductService: import("@wix/services-definitions").Service
19
19
  __config: {};
20
20
  isServiceDefinition?: boolean;
21
21
  } & ProductServiceAPI, ProductServiceConfig>;
22
- export type ProductServiceConfigResult = {
22
+ export interface SuccessProductServiceConfigResult {
23
23
  type: "success";
24
24
  config: ProductServiceConfig;
25
- } | {
25
+ }
26
+ export interface NotFoundProductServiceConfigResult {
26
27
  type: "notFound";
27
- };
28
+ }
28
29
  /**
29
30
  * Loads product service configuration from the Wix Products API for SSR initialization.
30
31
  * This function is designed to be used during Server-Side Rendering (SSR) to preload
@@ -101,4 +102,4 @@ export type ProductServiceConfigResult = {
101
102
  * }
102
103
  * ```
103
104
  */
104
- export declare function loadProductServiceConfig(productSlug: string): Promise<ProductServiceConfigResult>;
105
+ export declare function loadProductServiceConfig(productSlug: string): Promise<SuccessProductServiceConfigResult | NotFoundProductServiceConfigResult>;
@@ -4,28 +4,27 @@ import * as productsV3 from "@wix/auto_sdk_stores_products-v-3";
4
4
  import * as inventoryItemsV3 from "@wix/auto_sdk_stores_inventory-items-v-3";
5
5
  import { CurrentCartServiceDefinition } from "@wix/headless-ecom/services";
6
6
  import { ProductServiceDefinition } from "./product-service.js";
7
- import { MediaGalleryServiceDefinition } from "@wix/headless-media/services";
8
7
  export const SelectedVariantServiceDefinition = defineService("selectedVariant");
9
8
  export const SelectedVariantService = implementService.withConfig()(SelectedVariantServiceDefinition, ({ getService, config: { fetchInventoryData = true } }) => {
10
9
  const signalsService = getService(SignalsServiceDefinition);
11
10
  const cartService = getService(CurrentCartServiceDefinition);
12
11
  const productService = getService(ProductServiceDefinition);
13
- const mediaService = getService(MediaGalleryServiceDefinition);
12
+ // const mediaService = getService(MediaGalleryServiceDefinition);
14
13
  const selectedChoices = signalsService.signal({});
15
14
  const preOrderMessage = signalsService.signal(null);
16
15
  const initialProduct = productService.product.get();
17
16
  signalsService.effect(() => {
18
17
  const product = productService.product.get();
19
18
  const selectedChoicesValue = selectedChoices.get() || {};
20
- let mediaToDisplay = [];
19
+ // let mediaToDisplay: productsV3.ProductMedia[] = [];
21
20
  const productItemsImages = product?.media?.itemsInfo?.items
22
21
  ?.map((item) => item)
23
22
  .filter(Boolean) ?? [];
24
23
  if (productItemsImages.length) {
25
- mediaToDisplay = productItemsImages;
24
+ // mediaToDisplay = productItemsImages;
26
25
  }
27
26
  else if (product?.media?.main) {
28
- mediaToDisplay = [product.media.main];
27
+ // mediaToDisplay = [product.media.main];
29
28
  }
30
29
  // Get images based on selected choices if available
31
30
  let selectedChoicesImages = [];
@@ -38,9 +37,9 @@ export const SelectedVariantService = implementService.withConfig()(SelectedVari
38
37
  }
39
38
  });
40
39
  if (selectedChoicesImages?.length) {
41
- mediaToDisplay = selectedChoicesImages;
40
+ // mediaToDisplay = selectedChoicesImages;
42
41
  }
43
- mediaService.setMediaToDisplay(mediaToDisplay ?? []);
42
+ // mediaService.setMediaToDisplay(mediaToDisplay ?? []);
44
43
  });
45
44
  const parsePrice = (amount) => {
46
45
  if (!amount)
@@ -10,6 +10,7 @@ export interface RootProps {
10
10
  * Root component that provides the ProductsList service context to its children.
11
11
  * This component sets up the necessary services for managing products list state.
12
12
  *
13
+ * @order 1
13
14
  * @component
14
15
  * @example
15
16
  * ```tsx
@@ -7,6 +7,7 @@ import { ProductService, ProductServiceDefinition, } from "@wix/headless-stores/
7
7
  * Root component that provides the ProductsList service context to its children.
8
8
  * This component sets up the necessary services for managing products list state.
9
9
  *
10
+ * @order 1
10
11
  * @component
11
12
  * @example
12
13
  * ```tsx
@@ -19,12 +19,13 @@ export declare const ProductService: import("@wix/services-definitions").Service
19
19
  __config: {};
20
20
  isServiceDefinition?: boolean;
21
21
  } & ProductServiceAPI, ProductServiceConfig>;
22
- export type ProductServiceConfigResult = {
22
+ export interface SuccessProductServiceConfigResult {
23
23
  type: "success";
24
24
  config: ProductServiceConfig;
25
- } | {
25
+ }
26
+ export interface NotFoundProductServiceConfigResult {
26
27
  type: "notFound";
27
- };
28
+ }
28
29
  /**
29
30
  * Loads product service configuration from the Wix Products API for SSR initialization.
30
31
  * This function is designed to be used during Server-Side Rendering (SSR) to preload
@@ -101,4 +102,4 @@ export type ProductServiceConfigResult = {
101
102
  * }
102
103
  * ```
103
104
  */
104
- export declare function loadProductServiceConfig(productSlug: string): Promise<ProductServiceConfigResult>;
105
+ export declare function loadProductServiceConfig(productSlug: string): Promise<SuccessProductServiceConfigResult | NotFoundProductServiceConfigResult>;
@@ -4,28 +4,27 @@ import * as productsV3 from "@wix/auto_sdk_stores_products-v-3";
4
4
  import * as inventoryItemsV3 from "@wix/auto_sdk_stores_inventory-items-v-3";
5
5
  import { CurrentCartServiceDefinition } from "@wix/headless-ecom/services";
6
6
  import { ProductServiceDefinition } from "./product-service.js";
7
- import { MediaGalleryServiceDefinition } from "@wix/headless-media/services";
8
7
  export const SelectedVariantServiceDefinition = defineService("selectedVariant");
9
8
  export const SelectedVariantService = implementService.withConfig()(SelectedVariantServiceDefinition, ({ getService, config: { fetchInventoryData = true } }) => {
10
9
  const signalsService = getService(SignalsServiceDefinition);
11
10
  const cartService = getService(CurrentCartServiceDefinition);
12
11
  const productService = getService(ProductServiceDefinition);
13
- const mediaService = getService(MediaGalleryServiceDefinition);
12
+ // const mediaService = getService(MediaGalleryServiceDefinition);
14
13
  const selectedChoices = signalsService.signal({});
15
14
  const preOrderMessage = signalsService.signal(null);
16
15
  const initialProduct = productService.product.get();
17
16
  signalsService.effect(() => {
18
17
  const product = productService.product.get();
19
18
  const selectedChoicesValue = selectedChoices.get() || {};
20
- let mediaToDisplay = [];
19
+ // let mediaToDisplay: productsV3.ProductMedia[] = [];
21
20
  const productItemsImages = product?.media?.itemsInfo?.items
22
21
  ?.map((item) => item)
23
22
  .filter(Boolean) ?? [];
24
23
  if (productItemsImages.length) {
25
- mediaToDisplay = productItemsImages;
24
+ // mediaToDisplay = productItemsImages;
26
25
  }
27
26
  else if (product?.media?.main) {
28
- mediaToDisplay = [product.media.main];
27
+ // mediaToDisplay = [product.media.main];
29
28
  }
30
29
  // Get images based on selected choices if available
31
30
  let selectedChoicesImages = [];
@@ -38,9 +37,9 @@ export const SelectedVariantService = implementService.withConfig()(SelectedVari
38
37
  }
39
38
  });
40
39
  if (selectedChoicesImages?.length) {
41
- mediaToDisplay = selectedChoicesImages;
40
+ // mediaToDisplay = selectedChoicesImages;
42
41
  }
43
- mediaService.setMediaToDisplay(mediaToDisplay ?? []);
42
+ // mediaService.setMediaToDisplay(mediaToDisplay ?? []);
44
43
  });
45
44
  const parsePrice = (amount) => {
46
45
  if (!amount)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/headless-stores",
3
- "version": "0.0.31",
3
+ "version": "0.0.33",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "prebuild": "cd ../media && yarn build && cd ../ecom && yarn build",