@wix/headless-stores 0.0.52 → 0.0.53

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 (149) hide show
  1. package/cjs/dist/astro/actions/custom-checkout.d.ts +1 -1
  2. package/cjs/dist/astro/actions/custom-checkout.js +2 -2
  3. package/cjs/dist/astro/actions/index.d.ts +1 -1
  4. package/cjs/dist/astro/actions/index.js +1 -1
  5. package/cjs/dist/enums/index.d.ts +2 -2
  6. package/cjs/dist/enums/index.js +2 -2
  7. package/cjs/dist/react/Category.d.ts +168 -67
  8. package/cjs/dist/react/Category.js +166 -50
  9. package/cjs/dist/react/CategoryList.d.ts +56 -138
  10. package/cjs/dist/react/CategoryList.js +44 -129
  11. package/cjs/dist/react/Choice.d.ts +193 -0
  12. package/cjs/dist/react/Choice.js +259 -0
  13. package/cjs/dist/react/Option.d.ts +224 -0
  14. package/cjs/dist/react/Option.js +388 -0
  15. package/cjs/dist/react/Product.d.ts +339 -96
  16. package/cjs/dist/react/Product.js +507 -94
  17. package/cjs/dist/react/{BuyNow.js → core/BuyNow.js} +2 -2
  18. package/cjs/dist/react/core/Category.d.ts +98 -0
  19. package/cjs/dist/react/core/Category.js +81 -0
  20. package/cjs/dist/react/core/CategoryList.d.ts +185 -0
  21. package/cjs/dist/react/core/CategoryList.js +174 -0
  22. package/{dist/react → cjs/dist/react/core}/PayNow.js +2 -2
  23. package/cjs/dist/react/core/Product.d.ts +148 -0
  24. package/cjs/dist/react/core/Product.js +126 -0
  25. package/cjs/dist/react/{ProductList.d.ts → core/ProductList.d.ts} +3 -3
  26. package/cjs/dist/react/{ProductList.js → core/ProductList.js} +10 -10
  27. package/{dist/react → cjs/dist/react/core}/ProductListFilters.d.ts +3 -3
  28. package/{dist/react → cjs/dist/react/core}/ProductListFilters.js +7 -7
  29. package/cjs/dist/react/{ProductListPagination.js → core/ProductListPagination.js} +8 -8
  30. package/{dist/react → cjs/dist/react/core}/ProductListSort.d.ts +1 -1
  31. package/cjs/dist/react/{ProductListSort.js → core/ProductListSort.js} +3 -3
  32. package/{dist/react → cjs/dist/react/core}/ProductModifiers.d.ts +1 -1
  33. package/{dist/react → cjs/dist/react/core}/ProductModifiers.js +13 -13
  34. package/{dist/react → cjs/dist/react/core}/ProductVariantSelector.d.ts +2 -2
  35. package/{dist/react → cjs/dist/react/core}/ProductVariantSelector.js +7 -10
  36. package/{dist/react → cjs/dist/react/core}/SelectedVariant.d.ts +2 -2
  37. package/{dist/react → cjs/dist/react/core}/SelectedVariant.js +43 -15
  38. package/cjs/dist/react/index.d.ts +15 -10
  39. package/cjs/dist/react/index.js +15 -10
  40. package/cjs/dist/react/types.d.ts +8 -0
  41. package/cjs/dist/react/types.js +9 -0
  42. package/cjs/dist/server-actions/custom-checkout-action.js +14 -10
  43. package/cjs/dist/server-actions/index.d.ts +1 -1
  44. package/cjs/dist/server-actions/index.js +1 -1
  45. package/cjs/dist/services/buy-now-service.d.ts +1 -1
  46. package/cjs/dist/services/buy-now-service.js +6 -6
  47. package/cjs/dist/services/categories-list-service.d.ts +4 -4
  48. package/cjs/dist/services/categories-list-service.js +10 -10
  49. package/cjs/dist/services/category-service.d.ts +18 -22
  50. package/cjs/dist/services/category-service.js +12 -10
  51. package/cjs/dist/services/index.d.ts +7 -7
  52. package/cjs/dist/services/index.js +7 -7
  53. package/cjs/dist/services/pay-now-service.d.ts +1 -1
  54. package/cjs/dist/services/pay-now-service.js +4 -4
  55. package/cjs/dist/services/product-modifiers-service.d.ts +3 -3
  56. package/cjs/dist/services/product-modifiers-service.js +7 -7
  57. package/cjs/dist/services/product-service.d.ts +4 -4
  58. package/cjs/dist/services/product-service.js +18 -18
  59. package/cjs/dist/services/products-list-search-service.d.ts +5 -5
  60. package/cjs/dist/services/products-list-search-service.js +117 -117
  61. package/cjs/dist/services/products-list-service.d.ts +4 -4
  62. package/cjs/dist/services/products-list-service.js +12 -12
  63. package/cjs/dist/services/selected-variant-service.d.ts +6 -2
  64. package/cjs/dist/services/selected-variant-service.js +86 -83
  65. package/cjs/dist/utils/index.d.ts +1 -0
  66. package/cjs/dist/utils/index.js +5 -4
  67. package/cjs/dist/utils/renderAsChild.d.ts +96 -0
  68. package/cjs/dist/utils/renderAsChild.js +66 -0
  69. package/cjs/dist/utils/renderChildren.d.ts +41 -0
  70. package/cjs/dist/utils/renderChildren.js +44 -0
  71. package/cjs/dist/utils/url-params.js +3 -3
  72. package/dist/astro/actions/custom-checkout.d.ts +1 -1
  73. package/dist/astro/actions/custom-checkout.js +2 -2
  74. package/dist/astro/actions/index.d.ts +1 -1
  75. package/dist/astro/actions/index.js +1 -1
  76. package/dist/enums/index.d.ts +2 -2
  77. package/dist/enums/index.js +2 -2
  78. package/dist/react/Category.d.ts +168 -67
  79. package/dist/react/Category.js +166 -50
  80. package/dist/react/CategoryList.d.ts +56 -138
  81. package/dist/react/CategoryList.js +44 -129
  82. package/dist/react/Choice.d.ts +193 -0
  83. package/dist/react/Choice.js +259 -0
  84. package/dist/react/Option.d.ts +224 -0
  85. package/dist/react/Option.js +388 -0
  86. package/dist/react/Product.d.ts +339 -96
  87. package/dist/react/Product.js +507 -94
  88. package/dist/react/{BuyNow.js → core/BuyNow.js} +2 -2
  89. package/dist/react/core/Category.d.ts +98 -0
  90. package/dist/react/core/Category.js +81 -0
  91. package/dist/react/core/CategoryList.d.ts +185 -0
  92. package/dist/react/core/CategoryList.js +174 -0
  93. package/{cjs/dist/react → dist/react/core}/PayNow.js +2 -2
  94. package/dist/react/core/Product.d.ts +148 -0
  95. package/dist/react/core/Product.js +126 -0
  96. package/dist/react/{ProductList.d.ts → core/ProductList.d.ts} +3 -3
  97. package/dist/react/{ProductList.js → core/ProductList.js} +10 -10
  98. package/{cjs/dist/react → dist/react/core}/ProductListFilters.d.ts +3 -3
  99. package/{cjs/dist/react → dist/react/core}/ProductListFilters.js +7 -7
  100. package/dist/react/{ProductListPagination.js → core/ProductListPagination.js} +8 -8
  101. package/{cjs/dist/react → dist/react/core}/ProductListSort.d.ts +1 -1
  102. package/dist/react/{ProductListSort.js → core/ProductListSort.js} +3 -3
  103. package/{cjs/dist/react → dist/react/core}/ProductModifiers.d.ts +1 -1
  104. package/{cjs/dist/react → dist/react/core}/ProductModifiers.js +13 -13
  105. package/{cjs/dist/react → dist/react/core}/ProductVariantSelector.d.ts +2 -2
  106. package/{cjs/dist/react → dist/react/core}/ProductVariantSelector.js +7 -10
  107. package/{cjs/dist/react → dist/react/core}/SelectedVariant.d.ts +2 -2
  108. package/{cjs/dist/react → dist/react/core}/SelectedVariant.js +43 -15
  109. package/dist/react/index.d.ts +15 -10
  110. package/dist/react/index.js +15 -10
  111. package/dist/react/types.d.ts +8 -0
  112. package/dist/react/types.js +9 -0
  113. package/dist/server-actions/custom-checkout-action.js +14 -10
  114. package/dist/server-actions/index.d.ts +1 -1
  115. package/dist/server-actions/index.js +1 -1
  116. package/dist/services/buy-now-service.d.ts +1 -1
  117. package/dist/services/buy-now-service.js +6 -6
  118. package/dist/services/categories-list-service.d.ts +4 -4
  119. package/dist/services/categories-list-service.js +10 -10
  120. package/dist/services/category-service.d.ts +18 -22
  121. package/dist/services/category-service.js +12 -10
  122. package/dist/services/index.d.ts +7 -7
  123. package/dist/services/index.js +7 -7
  124. package/dist/services/pay-now-service.d.ts +1 -1
  125. package/dist/services/pay-now-service.js +4 -4
  126. package/dist/services/product-modifiers-service.d.ts +3 -3
  127. package/dist/services/product-modifiers-service.js +7 -7
  128. package/dist/services/product-service.d.ts +4 -4
  129. package/dist/services/product-service.js +18 -18
  130. package/dist/services/products-list-search-service.d.ts +5 -5
  131. package/dist/services/products-list-search-service.js +117 -117
  132. package/dist/services/products-list-service.d.ts +4 -4
  133. package/dist/services/products-list-service.js +12 -12
  134. package/dist/services/selected-variant-service.d.ts +6 -2
  135. package/dist/services/selected-variant-service.js +86 -83
  136. package/dist/utils/index.d.ts +1 -0
  137. package/dist/utils/index.js +5 -4
  138. package/dist/utils/renderAsChild.d.ts +96 -0
  139. package/dist/utils/renderAsChild.js +66 -0
  140. package/dist/utils/renderChildren.d.ts +41 -0
  141. package/dist/utils/renderChildren.js +44 -0
  142. package/dist/utils/url-params.js +3 -3
  143. package/package.json +7 -3
  144. /package/cjs/dist/react/{BuyNow.d.ts → core/BuyNow.d.ts} +0 -0
  145. /package/cjs/dist/react/{PayNow.d.ts → core/PayNow.d.ts} +0 -0
  146. /package/cjs/dist/react/{ProductListPagination.d.ts → core/ProductListPagination.d.ts} +0 -0
  147. /package/dist/react/{BuyNow.d.ts → core/BuyNow.d.ts} +0 -0
  148. /package/dist/react/{PayNow.d.ts → core/PayNow.d.ts} +0 -0
  149. /package/dist/react/{ProductListPagination.d.ts → core/ProductListPagination.d.ts} +0 -0
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Enum for content rendering formats
3
+ */
4
+ export declare enum AsContent {
5
+ Plain = "plain",
6
+ Html = "html",
7
+ Ricos = "ricos"
8
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Enum for content rendering formats
3
+ */
4
+ export var AsContent;
5
+ (function (AsContent) {
6
+ AsContent["Plain"] = "plain";
7
+ AsContent["Html"] = "html";
8
+ AsContent["Ricos"] = "ricos";
9
+ })(AsContent || (AsContent = {}));
@@ -1,6 +1,6 @@
1
- import { checkout } from "@wix/ecom";
2
- import { redirects } from "@wix/redirects";
3
- import { auth } from "@wix/essentials";
1
+ import { checkout } from '@wix/ecom';
2
+ import { redirects } from '@wix/redirects';
3
+ import { auth } from '@wix/essentials';
4
4
  /**
5
5
  * Creates a factory function to generate checkout URLs for custom line items with a fixed price.
6
6
  * This is useful when you have a single product or service with a known price,
@@ -30,17 +30,19 @@ export function getCustomLineItemCheckoutURLFactory(factoryOpts) {
30
30
  preset: checkout.ItemTypeItemType.PHYSICAL,
31
31
  },
32
32
  priceDescription: {
33
- original: factoryOpts.priceDescription
33
+ original: factoryOpts.priceDescription,
34
34
  },
35
35
  policies: factoryOpts.policies || [],
36
- }
36
+ },
37
37
  ],
38
38
  channelType: checkout.ChannelType.WEB,
39
- ...(factoryOpts.currency ? {
40
- checkoutInfo: {
41
- currency: factoryOpts.currency,
39
+ ...(factoryOpts.currency
40
+ ? {
41
+ checkoutInfo: {
42
+ currency: factoryOpts.currency,
43
+ },
42
44
  }
43
- } : {})
45
+ : {}),
44
46
  });
45
47
  if (!checkoutResult._id) {
46
48
  throw new Error(`Failed to create checkout for custom line item ${factoryOpts.productName}`);
@@ -48,7 +50,9 @@ export function getCustomLineItemCheckoutURLFactory(factoryOpts) {
48
50
  const { redirectSession } = await redirects.createRedirectSession({
49
51
  ecomCheckout: { checkoutId: checkoutResult._id },
50
52
  callbacks: {
51
- ...(factoryOpts.postFlowUrl ? { postFlowUrl: factoryOpts.postFlowUrl } : {})
53
+ ...(factoryOpts.postFlowUrl
54
+ ? { postFlowUrl: factoryOpts.postFlowUrl }
55
+ : {}),
52
56
  },
53
57
  });
54
58
  return redirectSession?.fullUrl;
@@ -1 +1 @@
1
- export * from "./custom-checkout-action.js";
1
+ export * from './custom-checkout-action.js';
@@ -1 +1 @@
1
- export * from "./custom-checkout-action.js";
1
+ export * from './custom-checkout-action.js';
@@ -1,4 +1,4 @@
1
- import { type Signal } from "@wix/services-definitions/core-services/signals";
1
+ import { type Signal } from '@wix/services-definitions/core-services/signals';
2
2
  /**
3
3
  * Service definition for the Buy Now service.
4
4
  * This defines the reactive API contract for managing buy now functionality.
@@ -1,14 +1,14 @@
1
- import { defineService, implementService } from "@wix/services-definitions";
2
- import { SignalsServiceDefinition, } from "@wix/services-definitions/core-services/signals";
3
- import { getCheckoutUrlForProduct } from "../utils/index.js";
4
- import { getProductBySlug } from "@wix/auto_sdk_stores_products-v-3";
1
+ import { defineService, implementService } from '@wix/services-definitions';
2
+ import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
3
+ import { getCheckoutUrlForProduct } from '../utils/index.js';
4
+ import { getProductBySlug } from '@wix/auto_sdk_stores_products-v-3';
5
5
  /**
6
6
  * Service definition for the Buy Now service.
7
7
  * This defines the reactive API contract for managing buy now functionality.
8
8
  *
9
9
  * @constant
10
10
  */
11
- export const BuyNowServiceDefinition = defineService("BuyNow");
11
+ export const BuyNowServiceDefinition = defineService('BuyNow');
12
12
  /**
13
13
  * Implementation of the Buy Now service that manages buy now functionality.
14
14
  * This service provides signals for loading state, stock status, and error handling,
@@ -137,7 +137,7 @@ export const BuyNowServiceImplementation = implementService.withConfig()(BuyNowS
137
137
  */
138
138
  export const loadBuyNowServiceInitialData = async (productSlug, variantId) => {
139
139
  const res = await getProductBySlug(productSlug, {
140
- fields: ["CURRENCY"],
140
+ fields: ['CURRENCY'],
141
141
  });
142
142
  const product = res.product;
143
143
  const selectedVariant = variantId
@@ -1,5 +1,5 @@
1
- import { type Signal } from "@wix/services-definitions/core-services/signals";
2
- import { type Category } from "./category-service.js";
1
+ import { type Signal } from '@wix/services-definitions/core-services/signals';
2
+ import { type Category } from './category-service.js';
3
3
  /**
4
4
  * Configuration interface for the Categories List service.
5
5
  * Contains the initial categories data that will be loaded into the service.
@@ -105,7 +105,7 @@ export declare const CategoriesListService: import("@wix/services-definitions").
105
105
  * ---
106
106
  * // Astro page example - pages/categories.astro
107
107
  * import { loadCategoriesListServiceConfig } from '@wix/stores/services';
108
- * import { CategoryList } from '@wix/stores/components';
108
+ * import { CategoryList } from '@wix/stores/components/react';
109
109
  *
110
110
  * // Load categories data during SSR
111
111
  * const categoriesConfig = await loadCategoriesListServiceConfig();
@@ -128,7 +128,7 @@ export declare const CategoriesListService: import("@wix/services-definitions").
128
128
  * // Next.js page example - pages/categories.tsx
129
129
  * import { GetServerSideProps } from 'next';
130
130
  * import { loadCategoriesListServiceConfig } from '@wix/stores/services';
131
- * import { CategoryList } from '@wix/stores/components';
131
+ * import { CategoryList } from '@wix/stores/components/react';
132
132
  *
133
133
  * interface CategoriesPageProps {
134
134
  * categoriesConfig: Awaited<ReturnType<typeof loadCategoriesListServiceConfig>>;
@@ -1,13 +1,13 @@
1
- import { defineService, implementService } from "@wix/services-definitions";
2
- import { SignalsServiceDefinition, } from "@wix/services-definitions/core-services/signals";
3
- import { categories } from "@wix/categories";
1
+ import { defineService, implementService } from '@wix/services-definitions';
2
+ import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
3
+ import { categories } from '@wix/categories';
4
4
  /**
5
5
  * Service definition for the Categories List service.
6
6
  * This defines the reactive API contract for managing a list of product categories.
7
7
  *
8
8
  * @constant
9
9
  */
10
- export const CategoriesListServiceDefinition = defineService("categories-list");
10
+ export const CategoriesListServiceDefinition = defineService('categories-list');
11
11
  /**
12
12
  * Implementation of the Categories List service that manages reactive categories data.
13
13
  * This service provides signals for categories data, loading state, and error handling.
@@ -70,7 +70,7 @@ export const CategoriesListService = implementService.withConfig()(CategoriesLis
70
70
  * ---
71
71
  * // Astro page example - pages/categories.astro
72
72
  * import { loadCategoriesListServiceConfig } from '@wix/stores/services';
73
- * import { CategoryList } from '@wix/stores/components';
73
+ * import { CategoryList } from '@wix/stores/components/react';
74
74
  *
75
75
  * // Load categories data during SSR
76
76
  * const categoriesConfig = await loadCategoriesListServiceConfig();
@@ -93,7 +93,7 @@ export const CategoriesListService = implementService.withConfig()(CategoriesLis
93
93
  * // Next.js page example - pages/categories.tsx
94
94
  * import { GetServerSideProps } from 'next';
95
95
  * import { loadCategoriesListServiceConfig } from '@wix/stores/services';
96
- * import { CategoryList } from '@wix/stores/components';
96
+ * import { CategoryList } from '@wix/stores/components/react';
97
97
  *
98
98
  * interface CategoriesPageProps {
99
99
  * categoriesConfig: Awaited<ReturnType<typeof loadCategoriesListServiceConfig>>;
@@ -129,16 +129,16 @@ export async function loadCategoriesListServiceConfig() {
129
129
  const categoriesResponse = await categories
130
130
  .queryCategories({
131
131
  treeReference: {
132
- appNamespace: "@wix/stores",
132
+ appNamespace: '@wix/stores',
133
133
  treeKey: null,
134
134
  },
135
135
  })
136
- .eq("visible", true)
136
+ .eq('visible', true)
137
137
  .find();
138
138
  const fetchedCategories = categoriesResponse.items || [];
139
139
  // Sort categories to put "all-products" first, keep the rest in original order
140
- const allProductsCategory = fetchedCategories.find((cat) => cat.slug === "all-products");
141
- const otherCategories = fetchedCategories.filter((cat) => cat.slug !== "all-products");
140
+ const allProductsCategory = fetchedCategories.find((cat) => cat.slug === 'all-products');
141
+ const otherCategories = fetchedCategories.filter((cat) => cat.slug !== 'all-products');
142
142
  const allCategories = allProductsCategory
143
143
  ? [allProductsCategory, ...otherCategories]
144
144
  : fetchedCategories;
@@ -1,5 +1,5 @@
1
- import { categories } from "@wix/categories";
2
- import { type Signal } from "@wix/services-definitions/core-services/signals";
1
+ import { categories } from '@wix/categories';
2
+ import { type Signal } from '@wix/services-definitions/core-services/signals';
3
3
  /**
4
4
  * Type representing a category from the Wix Categories API.
5
5
  * This type is used to define the structure of category objects in the service.
@@ -7,6 +7,12 @@ import { type Signal } from "@wix/services-definitions/core-services/signals";
7
7
  * @type Category
8
8
  */
9
9
  export type Category = categories.Category;
10
+ export interface CategoryServiceAPI {
11
+ /** Reactive signal containing the current category data */
12
+ category: Signal<Category>;
13
+ /** Reactive signal indicating if a category is currently selected */
14
+ isSelected: Signal<boolean>;
15
+ }
10
16
  /**
11
17
  * Service definition for the Category service.
12
18
  * This defines the reactive API contract for managing a single product category.
@@ -14,16 +20,10 @@ export type Category = categories.Category;
14
20
  * @constant
15
21
  */
16
22
  export declare const CategoryServiceDefinition: string & {
17
- __api: {
18
- /** Reactive signal containing the current category data */
19
- category: Signal<Category>;
20
- };
23
+ __api: CategoryServiceAPI;
21
24
  __config: {};
22
25
  isServiceDefinition?: boolean;
23
- } & {
24
- /** Reactive signal containing the current category data */
25
- category: Signal<Category>;
26
- };
26
+ } & CategoryServiceAPI;
27
27
  /**
28
28
  * Configuration interface for the Category service.
29
29
  * Contains the initial category data that will be loaded into the service.
@@ -33,6 +33,8 @@ export declare const CategoryServiceDefinition: string & {
33
33
  export type CategoryServiceConfig = {
34
34
  /** The category object to initialize the service with */
35
35
  category: Category;
36
+ /** Whether the category is currently selected */
37
+ isSelected?: boolean;
36
38
  };
37
39
  /**
38
40
  * Implementation of the Category service that manages reactive category data.
@@ -68,16 +70,10 @@ export type CategoryServiceConfig = {
68
70
  * ```
69
71
  */
70
72
  export declare const CategoryService: import("@wix/services-definitions").ServiceFactory<string & {
71
- __api: {
72
- /** Reactive signal containing the current category data */
73
- category: Signal<Category>;
74
- };
73
+ __api: CategoryServiceAPI;
75
74
  __config: {};
76
75
  isServiceDefinition?: boolean;
77
- } & {
78
- /** Reactive signal containing the current category data */
79
- category: Signal<Category>;
80
- }, CategoryServiceConfig>;
76
+ } & CategoryServiceAPI, CategoryServiceConfig>;
81
77
  /**
82
78
  * Loads category service configuration from the Wix Categories API for SSR initialization.
83
79
  * This function is designed to be used during Server-Side Rendering (SSR) to preload
@@ -91,7 +87,7 @@ export declare const CategoryService: import("@wix/services-definitions").Servic
91
87
  * ---
92
88
  * // Astro page example - pages/category/[slug].astro
93
89
  * import { loadCategoryServiceConfig } from '@wix/stores/services';
94
- * import { Category } from '@wix/stores/components';
90
+ * import { Category } from '@wix/stores/components/react';
95
91
  *
96
92
  * // Get category slug from URL params
97
93
  * const { slug } = Astro.params;
@@ -117,7 +113,7 @@ export declare const CategoryService: import("@wix/services-definitions").Servic
117
113
  * // Next.js page example - pages/category/[slug].tsx
118
114
  * import { GetServerSideProps } from 'next';
119
115
  * import { loadCategoryServiceConfig } from '@wix/stores/services';
120
- * import { Category } from '@wix/stores/components';
116
+ * import { Category } from '@wix/stores/components/react';
121
117
  *
122
118
  * interface CategoryPageProps {
123
119
  * categoryConfig: Awaited<ReturnType<typeof loadCategoryServiceConfig>>['config'];
@@ -156,10 +152,10 @@ export declare const CategoryService: import("@wix/services-definitions").Servic
156
152
  */
157
153
  export declare function loadCategoryServiceConfig(slug: string): Promise<{
158
154
  /** Type "success" means that the category was found and the config is valid */
159
- type: "success";
155
+ type: 'success';
160
156
  /** The category config containing the loaded category data */
161
157
  config: CategoryServiceConfig;
162
158
  } | {
163
159
  /** Type "not-found" means that the category was not found */
164
- type: "not-found";
160
+ type: 'not-found';
165
161
  }>;
@@ -1,13 +1,13 @@
1
- import { defineService, implementService } from "@wix/services-definitions";
2
- import { categories } from "@wix/categories";
3
- import { SignalsServiceDefinition, } from "@wix/services-definitions/core-services/signals";
1
+ import { defineService, implementService } from '@wix/services-definitions';
2
+ import { categories } from '@wix/categories';
3
+ import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
4
4
  /**
5
5
  * Service definition for the Category service.
6
6
  * This defines the reactive API contract for managing a single product category.
7
7
  *
8
8
  * @constant
9
9
  */
10
- export const CategoryServiceDefinition = defineService("category");
10
+ export const CategoryServiceDefinition = defineService('category');
11
11
  /**
12
12
  * Implementation of the Category service that manages reactive category data.
13
13
  * This service provides a signal for category data and maintains it in a reactive state.
@@ -44,8 +44,10 @@ export const CategoryServiceDefinition = defineService("category");
44
44
  export const CategoryService = implementService.withConfig()(CategoryServiceDefinition, ({ getService, config }) => {
45
45
  const signalsService = getService(SignalsServiceDefinition);
46
46
  const categorySignal = signalsService.signal(config.category);
47
+ const isSelectedSignal = signalsService.signal(config.isSelected ?? false);
47
48
  return {
48
49
  category: categorySignal,
50
+ isSelected: isSelectedSignal,
49
51
  };
50
52
  });
51
53
  /**
@@ -61,7 +63,7 @@ export const CategoryService = implementService.withConfig()(CategoryServiceDefi
61
63
  * ---
62
64
  * // Astro page example - pages/category/[slug].astro
63
65
  * import { loadCategoryServiceConfig } from '@wix/stores/services';
64
- * import { Category } from '@wix/stores/components';
66
+ * import { Category } from '@wix/stores/components/react';
65
67
  *
66
68
  * // Get category slug from URL params
67
69
  * const { slug } = Astro.params;
@@ -87,7 +89,7 @@ export const CategoryService = implementService.withConfig()(CategoryServiceDefi
87
89
  * // Next.js page example - pages/category/[slug].tsx
88
90
  * import { GetServerSideProps } from 'next';
89
91
  * import { loadCategoryServiceConfig } from '@wix/stores/services';
90
- * import { Category } from '@wix/stores/components';
92
+ * import { Category } from '@wix/stores/components/react';
91
93
  *
92
94
  * interface CategoryPageProps {
93
95
  * categoryConfig: Awaited<ReturnType<typeof loadCategoryServiceConfig>>['config'];
@@ -128,18 +130,18 @@ export async function loadCategoryServiceConfig(slug) {
128
130
  const category = await categories
129
131
  .queryCategories({
130
132
  treeReference: {
131
- appNamespace: "@wix/stores",
133
+ appNamespace: '@wix/stores',
132
134
  },
133
135
  })
134
- .eq("slug", slug)
136
+ .eq('slug', slug)
135
137
  .find();
136
138
  if (category.items.length === 0) {
137
139
  return {
138
- type: "not-found",
140
+ type: 'not-found',
139
141
  };
140
142
  }
141
143
  return {
142
- type: "success",
144
+ type: 'success',
143
145
  config: {
144
146
  category: category.items[0],
145
147
  },
@@ -1,7 +1,7 @@
1
- export { CategoryService, CategoryServiceDefinition, loadCategoryServiceConfig, CategoryServiceConfig, Category, } from "./category-service.js";
2
- export { CategoriesListService, CategoriesListServiceDefinition, loadCategoriesListServiceConfig, CategoriesListServiceConfig, } from "./categories-list-service.js";
3
- export { ProductModifiersService, ProductModifiersServiceDefinition, } from "./product-modifiers-service.js";
4
- export { ProductService, ProductServiceDefinition, loadProductServiceConfig, } from "./product-service.js";
5
- export { SelectedVariantService, SelectedVariantServiceDefinition, } from "./selected-variant-service.js";
6
- export { ProductListService, ProductsListServiceDefinition, loadProductsListServiceConfig, ProductsListServiceConfig, } from "./products-list-service.js";
7
- export { ProductOption, InventoryStatusType, SortType, ProductChoice, ProductsListSearchService, ProductsListSearchServiceDefinition, ProductsListSearchServiceConfig, loadProductsListSearchServiceConfig, parseUrlToSearchOptions, convertUrlSortToSortType, } from "./products-list-search-service.js";
1
+ export { CategoryService, CategoryServiceDefinition, loadCategoryServiceConfig, CategoryServiceConfig, Category, } from './category-service.js';
2
+ export { CategoriesListService, CategoriesListServiceDefinition, loadCategoriesListServiceConfig, CategoriesListServiceConfig, } from './categories-list-service.js';
3
+ export { ProductModifiersService, ProductModifiersServiceDefinition, } from './product-modifiers-service.js';
4
+ export { ProductService, ProductServiceDefinition, loadProductServiceConfig, } from './product-service.js';
5
+ export { SelectedVariantService, SelectedVariantServiceDefinition, } from './selected-variant-service.js';
6
+ export { ProductListService, ProductsListServiceDefinition, loadProductsListServiceConfig, ProductsListServiceConfig, } from './products-list-service.js';
7
+ export { ProductOption, InventoryStatusType, SortType, ProductChoice, ProductsListSearchService, ProductsListSearchServiceDefinition, ProductsListSearchServiceConfig, loadProductsListSearchServiceConfig, parseUrlToSearchOptions, convertUrlSortToSortType, } from './products-list-search-service.js';
@@ -1,7 +1,7 @@
1
- export { CategoryService, CategoryServiceDefinition, loadCategoryServiceConfig, } from "./category-service.js";
2
- export { CategoriesListService, CategoriesListServiceDefinition, loadCategoriesListServiceConfig, } from "./categories-list-service.js";
3
- export { ProductModifiersService, ProductModifiersServiceDefinition, } from "./product-modifiers-service.js";
4
- export { ProductService, ProductServiceDefinition, loadProductServiceConfig, } from "./product-service.js";
5
- export { SelectedVariantService, SelectedVariantServiceDefinition, } from "./selected-variant-service.js";
6
- export { ProductListService, ProductsListServiceDefinition, loadProductsListServiceConfig, } from "./products-list-service.js";
7
- export { InventoryStatusType, SortType, ProductsListSearchService, ProductsListSearchServiceDefinition, loadProductsListSearchServiceConfig, parseUrlToSearchOptions, convertUrlSortToSortType, } from "./products-list-search-service.js";
1
+ export { CategoryService, CategoryServiceDefinition, loadCategoryServiceConfig, } from './category-service.js';
2
+ export { CategoriesListService, CategoriesListServiceDefinition, loadCategoriesListServiceConfig, } from './categories-list-service.js';
3
+ export { ProductModifiersService, ProductModifiersServiceDefinition, } from './product-modifiers-service.js';
4
+ export { ProductService, ProductServiceDefinition, loadProductServiceConfig, } from './product-service.js';
5
+ export { SelectedVariantService, SelectedVariantServiceDefinition, } from './selected-variant-service.js';
6
+ export { ProductListService, ProductsListServiceDefinition, loadProductsListServiceConfig, } from './products-list-service.js';
7
+ export { InventoryStatusType, SortType, ProductsListSearchService, ProductsListSearchServiceDefinition, loadProductsListSearchServiceConfig, parseUrlToSearchOptions, convertUrlSortToSortType, } from './products-list-search-service.js';
@@ -1,4 +1,4 @@
1
- import { type Signal } from "@wix/services-definitions/core-services/signals";
1
+ import { type Signal } from '@wix/services-definitions/core-services/signals';
2
2
  /**
3
3
  * Service definition for the Pay Now service.
4
4
  * This defines the reactive API contract for managing custom payment checkout functionality.
@@ -1,12 +1,12 @@
1
- import { defineService, implementService } from "@wix/services-definitions";
2
- import { SignalsServiceDefinition, } from "@wix/services-definitions/core-services/signals";
1
+ import { defineService, implementService } from '@wix/services-definitions';
2
+ import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
3
3
  /**
4
4
  * Service definition for the Pay Now service.
5
5
  * This defines the reactive API contract for managing custom payment checkout functionality.
6
6
  *
7
7
  * @constant
8
8
  */
9
- export const PayNowServiceDefinition = defineService("PayNow");
9
+ export const PayNowServiceDefinition = defineService('PayNow');
10
10
  /**
11
11
  * Implementation of the Pay Now service that manages custom payment checkout functionality.
12
12
  * This service provides signals for loading state and error handling, along with a method
@@ -65,7 +65,7 @@ export const PayNowServiceImplementation = implementService.withConfig()(PayNowS
65
65
  window.location.href = result.data;
66
66
  }
67
67
  else {
68
- throw new Error("Failed to create checkout" + result?.error);
68
+ throw new Error('Failed to create checkout' + result?.error);
69
69
  }
70
70
  }
71
71
  }
@@ -1,6 +1,6 @@
1
- import { type ServiceFactoryConfig } from "@wix/services-definitions";
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";
1
+ import { type ServiceFactoryConfig } from '@wix/services-definitions';
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';
4
4
  export interface ModifierValue {
5
5
  modifierName: string;
6
6
  choiceValue?: string;
@@ -1,8 +1,8 @@
1
- import { defineService, implementService, } from "@wix/services-definitions";
2
- import { SignalsServiceDefinition, } from "@wix/services-definitions/core-services/signals";
3
- import * as productsV3 from "@wix/auto_sdk_stores_products-v-3";
4
- import { ProductServiceDefinition } from "./product-service.js";
5
- export const ProductModifiersServiceDefinition = defineService("productModifiers");
1
+ import { defineService, implementService, } from '@wix/services-definitions';
2
+ import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
3
+ import * as productsV3 from '@wix/auto_sdk_stores_products-v-3';
4
+ import { ProductServiceDefinition } from './product-service.js';
5
+ export const ProductModifiersServiceDefinition = defineService('productModifiers');
6
6
  export const ProductModifiersService = implementService.withConfig()(ProductModifiersServiceDefinition, ({ getService }) => {
7
7
  const signalsService = getService(SignalsServiceDefinition);
8
8
  const productService = getService(ProductServiceDefinition);
@@ -66,7 +66,7 @@ export const ProductModifiersService = implementService.withConfig()(ProductModi
66
66
  return mods.every((modifier) => {
67
67
  if (!modifier.mandatory)
68
68
  return true;
69
- const selectedValue = current[modifier.name || ""];
69
+ const selectedValue = current[modifier.name || ''];
70
70
  if (!selectedValue)
71
71
  return false;
72
72
  // Check based on modifier type
@@ -79,7 +79,7 @@ export const ProductModifiersService = implementService.withConfig()(ProductModi
79
79
  }
80
80
  else if (renderType === productsV3.ModifierRenderType.FREE_TEXT) {
81
81
  return (!!selectedValue.freeTextValue &&
82
- selectedValue.freeTextValue.trim() !== "");
82
+ selectedValue.freeTextValue.trim() !== '');
83
83
  }
84
84
  return false;
85
85
  });
@@ -1,5 +1,5 @@
1
- import { type Signal } from "@wix/services-definitions/core-services/signals";
2
- import * as productsV3 from "@wix/auto_sdk_stores_products-v-3";
1
+ import { type Signal } from '@wix/services-definitions/core-services/signals';
2
+ import * as productsV3 from '@wix/auto_sdk_stores_products-v-3';
3
3
  /**
4
4
  * API interface for the Product service, providing reactive product data management.
5
5
  * This service handles loading and managing a single product's data, loading state, and errors.
@@ -84,7 +84,7 @@ export declare const ProductService: import("@wix/services-definitions").Service
84
84
  */
85
85
  export interface SuccessProductServiceConfigResult {
86
86
  /** Type "success" means that the product was found and the config is valid */
87
- type: "success";
87
+ type: 'success';
88
88
  /** The product config containing the loaded product data */
89
89
  config: ProductServiceConfig;
90
90
  }
@@ -96,7 +96,7 @@ export interface SuccessProductServiceConfigResult {
96
96
  */
97
97
  export interface NotFoundProductServiceConfigResult {
98
98
  /** Type "notFound" means that the product was not found */
99
- type: "notFound";
99
+ type: 'notFound';
100
100
  }
101
101
  /**
102
102
  * Loads product service configuration from the Wix Products API for SSR initialization.
@@ -1,13 +1,13 @@
1
- import { defineService, implementService } from "@wix/services-definitions";
2
- import { SignalsServiceDefinition, } from "@wix/services-definitions/core-services/signals";
3
- import * as productsV3 from "@wix/auto_sdk_stores_products-v-3";
1
+ import { defineService, implementService } from '@wix/services-definitions';
2
+ import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
3
+ import * as productsV3 from '@wix/auto_sdk_stores_products-v-3';
4
4
  /**
5
5
  * Service definition for the Product service.
6
6
  * This defines the contract that the ProductService must implement.
7
7
  *
8
8
  * @constant
9
9
  */
10
- export const ProductServiceDefinition = defineService("product");
10
+ export const ProductServiceDefinition = defineService('product');
11
11
  /**
12
12
  * Implementation of the Product service that manages reactive product data.
13
13
  * This service provides signals for product data, loading state, and error handling,
@@ -50,7 +50,7 @@ export const ProductService = implementService.withConfig()(ProductServiceDefini
50
50
  isLoading.set(true);
51
51
  const productResponse = await loadProductBySlug(slug);
52
52
  if (!productResponse.product) {
53
- error.set("Product not found");
53
+ error.set('Product not found');
54
54
  }
55
55
  else {
56
56
  product.set(productResponse.product);
@@ -79,16 +79,16 @@ export const ProductService = implementService.withConfig()(ProductServiceDefini
79
79
  const loadProductBySlug = async (slug) => {
80
80
  const productResponse = await productsV3.getProductBySlug(slug, {
81
81
  fields: [
82
- "DESCRIPTION",
83
- "DIRECT_CATEGORIES_INFO",
84
- "BREADCRUMBS_INFO",
85
- "INFO_SECTION",
86
- "MEDIA_ITEMS_INFO",
87
- "PLAIN_DESCRIPTION",
88
- "THUMBNAIL",
89
- "URL",
90
- "VARIANT_OPTION_CHOICE_NAMES",
91
- "WEIGHT_MEASUREMENT_UNIT_INFO",
82
+ 'DESCRIPTION',
83
+ 'DIRECT_CATEGORIES_INFO',
84
+ 'BREADCRUMBS_INFO',
85
+ 'INFO_SECTION',
86
+ 'MEDIA_ITEMS_INFO',
87
+ 'PLAIN_DESCRIPTION',
88
+ 'THUMBNAIL',
89
+ 'URL',
90
+ 'VARIANT_OPTION_CHOICE_NAMES',
91
+ 'WEIGHT_MEASUREMENT_UNIT_INFO',
92
92
  ],
93
93
  });
94
94
  return productResponse;
@@ -174,10 +174,10 @@ export async function loadProductServiceConfig(productSlug) {
174
174
  // Use getProductBySlug directly - single API call with comprehensive fields
175
175
  const productResponse = await loadProductBySlug(productSlug);
176
176
  if (!productResponse.product) {
177
- return { type: "notFound" };
177
+ return { type: 'notFound' };
178
178
  }
179
179
  return {
180
- type: "success",
180
+ type: 'success',
181
181
  config: {
182
182
  product: productResponse.product,
183
183
  },
@@ -185,6 +185,6 @@ export async function loadProductServiceConfig(productSlug) {
185
185
  }
186
186
  catch (error) {
187
187
  console.error(`Failed to load product for slug "${productSlug}":`, error);
188
- return { type: "notFound" };
188
+ return { type: 'notFound' };
189
189
  }
190
190
  }
@@ -1,8 +1,8 @@
1
- import type { Signal } from "@wix/services-definitions/core-services/signals";
2
- import { productsV3, customizationsV3 } from "@wix/stores";
3
- import { type Category } from "./category-service.js";
4
- import { SortType } from "./../enums/sort-enums.js";
5
- export { SortType } from "./../enums/sort-enums.js";
1
+ import type { Signal } from '@wix/services-definitions/core-services/signals';
2
+ import { productsV3, customizationsV3 } from '@wix/stores';
3
+ import { type Category } from './category-service.js';
4
+ import { SortType } from './../enums/sort-enums.js';
5
+ export { SortType } from './../enums/sort-enums.js';
6
6
  /**
7
7
  * Enumeration of inventory status types available for filtering.
8
8
  * Re-exports the Wix inventory availability status enum values.