@wix/headless-stores 0.0.110 → 0.0.112

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 (42) hide show
  1. package/cjs/dist/astro/actions/custom-checkout.d.ts +1 -3
  2. package/cjs/dist/astro/actions/custom-checkout.js +8 -4
  3. package/cjs/dist/astro/actions/index.js +17 -1
  4. package/cjs/dist/data-component-tags.js +5 -2
  5. package/cjs/dist/enums/index.js +18 -2
  6. package/cjs/dist/enums/social-platform-enums.js +7 -4
  7. package/cjs/dist/enums/sort-enums.js +6 -3
  8. package/cjs/dist/react/Category.js +64 -25
  9. package/cjs/dist/react/CategoryList.js +55 -14
  10. package/cjs/dist/react/Choice.js +32 -25
  11. package/cjs/dist/react/Option.js +68 -29
  12. package/cjs/dist/react/Product.js +194 -155
  13. package/cjs/dist/react/ProductList.js +84 -45
  14. package/cjs/dist/react/core/CategoryList.js +26 -16
  15. package/cjs/dist/react/core/Product.js +30 -20
  16. package/cjs/dist/react/core/ProductList.js +29 -21
  17. package/cjs/dist/react/core/ProductListFilters.js +30 -22
  18. package/cjs/dist/react/core/ProductListPagination.js +7 -4
  19. package/cjs/dist/react/core/ProductListSort.js +11 -6
  20. package/cjs/dist/react/core/ProductModifiers.js +25 -18
  21. package/cjs/dist/react/core/ProductVariantSelector.js +27 -22
  22. package/cjs/dist/react/core/SelectedVariant.js +28 -21
  23. package/cjs/dist/react/index.js +42 -6
  24. package/cjs/dist/react/types.js +5 -2
  25. package/cjs/dist/server-actions/custom-checkout-action.js +11 -8
  26. package/cjs/dist/server-actions/index.js +17 -1
  27. package/cjs/dist/services/buy-now-service.js +20 -15
  28. package/cjs/dist/services/categories-list-service.js +12 -8
  29. package/cjs/dist/services/index.js +25 -5
  30. package/cjs/dist/services/pay-now-service.js +16 -11
  31. package/cjs/dist/services/product-modifiers-service.js +16 -12
  32. package/cjs/dist/services/product-service.js +16 -12
  33. package/cjs/dist/services/products-list-search-service.d.ts +0 -1
  34. package/cjs/dist/services/products-list-search-service.js +1 -1
  35. package/cjs/dist/services/products-list-service.js +66 -59
  36. package/cjs/dist/services/selected-variant-service.js +21 -18
  37. package/cjs/dist/utils/index.js +9 -6
  38. package/cjs/dist/utils/url-params.js +5 -1
  39. package/dist/astro/actions/custom-checkout.d.ts +1 -3
  40. package/dist/react/core/ProductModifiers.js +0 -1
  41. package/dist/react/core/ProductVariantSelector.js +0 -3
  42. package/package.json +7 -7
@@ -1,5 +1,8 @@
1
- import { useService } from '@wix/services-manager-react';
2
- import { ProductsListServiceDefinition } from '../../services/products-list-service.js';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LoadMoreTrigger = LoadMoreTrigger;
4
+ const services_manager_react_1 = require("@wix/services-manager-react");
5
+ const products_list_service_js_1 = require("../../services/products-list-service.js");
3
6
  /**
4
7
  * Headless component for loading more products (infinite scroll pattern)
5
8
  *
@@ -30,8 +33,8 @@ import { ProductsListServiceDefinition } from '../../services/products-list-serv
30
33
  * }
31
34
  * ```
32
35
  */
33
- export function LoadMoreTrigger(props) {
34
- const productsListService = useService(ProductsListServiceDefinition);
36
+ function LoadMoreTrigger(props) {
37
+ const productsListService = (0, services_manager_react_1.useService)(products_list_service_js_1.ProductsListServiceDefinition);
35
38
  const loadMore = productsListService.loadMore;
36
39
  const hasMoreProducts = productsListService.hasMoreProducts.get();
37
40
  const isLoading = productsListService.isLoading.get();
@@ -1,7 +1,11 @@
1
- import { useService } from '@wix/services-manager-react';
2
- import { ProductsListServiceDefinition } from '../../services/products-list-service.js';
3
- export const ProductListSort = (props) => {
4
- const productListService = useService(ProductsListServiceDefinition);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProductListSort = void 0;
4
+ exports.ProductListSeperateSort = ProductListSeperateSort;
5
+ const services_manager_react_1 = require("@wix/services-manager-react");
6
+ const products_list_service_js_1 = require("../../services/products-list-service.js");
7
+ const ProductListSort = (props) => {
8
+ const productListService = (0, services_manager_react_1.useService)(products_list_service_js_1.ProductsListServiceDefinition);
5
9
  const currentSort = productListService.searchOptions.get().sort;
6
10
  // Define sort options - primitive handles all conversion logic
7
11
  const sortOptions = [
@@ -26,8 +30,9 @@ export const ProductListSort = (props) => {
26
30
  },
27
31
  });
28
32
  };
29
- export function ProductListSeperateSort(props) {
30
- const productListService = useService(ProductsListServiceDefinition);
33
+ exports.ProductListSort = ProductListSort;
34
+ function ProductListSeperateSort(props) {
35
+ const productListService = (0, services_manager_react_1.useService)(products_list_service_js_1.ProductsListServiceDefinition);
31
36
  const currentSort = productListService.searchOptions.get().sort;
32
37
  // Define sort options - primitive handles all conversion logic
33
38
  const sortFieldOptions = [
@@ -1,9 +1,17 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
- import { useService, WixServices } from '@wix/services-manager-react';
4
- import { ProductModifiersServiceDefinition, ProductModifiersService, } from '../../services/product-modifiers-service.js';
5
- import { productsV3 } from '@wix/stores';
6
- import { createServicesMap } from '@wix/services-manager';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Root = Root;
4
+ exports.Modifiers = Modifiers;
5
+ exports.Modifier = Modifier;
6
+ exports.Choice = Choice;
7
+ exports.FreeText = FreeText;
8
+ exports.ToggleFreeText = ToggleFreeText;
9
+ const jsx_runtime_1 = require("react/jsx-runtime");
10
+ const react_1 = require("react");
11
+ const services_manager_react_1 = require("@wix/services-manager-react");
12
+ const product_modifiers_service_js_1 = require("../../services/product-modifiers-service.js");
13
+ const stores_1 = require("@wix/stores");
14
+ const services_manager_1 = require("@wix/services-manager");
7
15
  /**
8
16
  * Root component that provides the ProductModifiers service context to its children.
9
17
  * This component sets up the necessary services for managing product modifier functionality.
@@ -78,15 +86,15 @@ import { createServicesMap } from '@wix/services-manager';
78
86
  * }
79
87
  * ```
80
88
  */
81
- export function Root(props) {
82
- return (_jsx(WixServices, { servicesMap: createServicesMap().addService(ProductModifiersServiceDefinition, ProductModifiersService, {}), children: props.children }));
89
+ function Root(props) {
90
+ return ((0, jsx_runtime_1.jsx)(services_manager_react_1.WixServices, { servicesMap: (0, services_manager_1.createServicesMap)().addService(product_modifiers_service_js_1.ProductModifiersServiceDefinition, product_modifiers_service_js_1.ProductModifiersService, {}), children: props.children }));
83
91
  }
84
92
  /**
85
93
  * Custom hook to safely get the modifiers service
86
94
  */
87
95
  function useModifiersService() {
88
96
  try {
89
- return useService(ProductModifiersServiceDefinition);
97
+ return (0, services_manager_react_1.useService)(product_modifiers_service_js_1.ProductModifiersServiceDefinition);
90
98
  }
91
99
  catch {
92
100
  return null;
@@ -137,7 +145,7 @@ function useModifiersService() {
137
145
  * }
138
146
  * ```
139
147
  */
140
- export function Modifiers(props) {
148
+ function Modifiers(props) {
141
149
  const modifiersService = useModifiersService();
142
150
  if (!modifiersService) {
143
151
  return props.children({
@@ -204,17 +212,16 @@ export function Modifiers(props) {
204
212
  * }
205
213
  * ```
206
214
  */
207
- export function Modifier(props) {
215
+ function Modifier(props) {
208
216
  const modifiersService = useModifiersService();
209
217
  const { modifier } = props;
210
218
  const name = modifier.name || '';
211
- // @ts-expect-error - This field is currently INTERNAL but will be public in the future
212
219
  const key = modifier.key || name;
213
220
  const type = modifier.modifierRenderType;
214
221
  const mandatory = modifier.mandatory || false;
215
222
  const choices = modifier.choicesSettings?.choices || [];
216
223
  const hasChoices = choices.length > 0;
217
- const isFreeText = type === productsV3.ModifierRenderType.FREE_TEXT;
224
+ const isFreeText = type === stores_1.productsV3.ModifierRenderType.FREE_TEXT;
218
225
  const freeTextSettings = modifier.freeTextSettings;
219
226
  const maxChars = freeTextSettings?.maxLength;
220
227
  const placeholder = freeTextSettings?.placeholder;
@@ -262,13 +269,13 @@ export function Modifier(props) {
262
269
  * }
263
270
  * ```
264
271
  */
265
- export function Choice(props) {
272
+ function Choice(props) {
266
273
  const modifiersService = useModifiersService();
267
274
  const { modifier, choice } = props;
268
275
  const modifierName = modifier.name || '';
269
276
  const renderType = modifier.modifierRenderType;
270
277
  // For TEXT_CHOICES, use choice.key; for SWATCH_CHOICES, use choice.name
271
- const choiceValue = renderType === productsV3.ModifierRenderType.TEXT_CHOICES
278
+ const choiceValue = renderType === stores_1.productsV3.ModifierRenderType.TEXT_CHOICES
272
279
  ? choice.key || choice.name || ''
273
280
  : choice.name || '';
274
281
  const value = choice.name || ''; // Display name is always choice.name
@@ -324,7 +331,7 @@ export function Choice(props) {
324
331
  * }
325
332
  * ```
326
333
  */
327
- export function FreeText(props) {
334
+ function FreeText(props) {
328
335
  const modifiersService = useModifiersService();
329
336
  const { modifier } = props;
330
337
  const modifierName = modifier.name || '';
@@ -394,12 +401,12 @@ export function FreeText(props) {
394
401
  * }
395
402
  * ```
396
403
  */
397
- export function ToggleFreeText(props) {
404
+ function ToggleFreeText(props) {
398
405
  const modifiersService = useModifiersService();
399
406
  const { modifier } = props;
400
407
  const modifierName = modifier.name || '';
401
408
  const mandatory = modifier.mandatory || false;
402
- const [isTextInputShown, setIsTextInputShown] = useState(mandatory);
409
+ const [isTextInputShown, setIsTextInputShown] = (0, react_1.useState)(mandatory);
403
410
  const toggle = () => {
404
411
  const newState = !isTextInputShown;
405
412
  setIsTextInputShown(newState);
@@ -1,8 +1,16 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useService, WixServices } from '@wix/services-manager-react';
3
- import { SelectedVariantServiceDefinition, SelectedVariantService, } from '../../services/selected-variant-service.js';
4
- import { createServicesMap } from '@wix/services-manager';
5
- import { productsV3 } from '@wix/stores';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Root = Root;
4
+ exports.Options = Options;
5
+ exports.Option = Option;
6
+ exports.Choice = Choice;
7
+ exports.Stock = Stock;
8
+ exports.Reset = Reset;
9
+ const jsx_runtime_1 = require("react/jsx-runtime");
10
+ const services_manager_react_1 = require("@wix/services-manager-react");
11
+ const selected_variant_service_js_1 = require("../../services/selected-variant-service.js");
12
+ const services_manager_1 = require("@wix/services-manager");
13
+ const stores_1 = require("@wix/stores");
6
14
  /**
7
15
  * Root component that provides the ProductVariantSelector service context to its children.
8
16
  * This component sets up the necessary services for rendering and managing product variant selection.
@@ -41,8 +49,8 @@ import { productsV3 } from '@wix/stores';
41
49
  * }
42
50
  * ```
43
51
  */
44
- export function Root(props) {
45
- return (_jsx(WixServices, { servicesMap: createServicesMap().addService(SelectedVariantServiceDefinition, SelectedVariantService, props.selectedVariantServiceConfig), children: props.children }));
52
+ function Root(props) {
53
+ return ((0, jsx_runtime_1.jsx)(services_manager_react_1.WixServices, { servicesMap: (0, services_manager_1.createServicesMap)().addService(selected_variant_service_js_1.SelectedVariantServiceDefinition, selected_variant_service_js_1.SelectedVariantService, props.selectedVariantServiceConfig), children: props.children }));
46
54
  }
47
55
  /**
48
56
  * Headless component for all product options
@@ -76,8 +84,8 @@ export function Root(props) {
76
84
  * }
77
85
  * ```
78
86
  */
79
- export function Options(props) {
80
- const variantService = useService(SelectedVariantServiceDefinition);
87
+ function Options(props) {
88
+ const variantService = (0, services_manager_react_1.useService)(selected_variant_service_js_1.SelectedVariantServiceDefinition);
81
89
  const selectedChoices = variantService.selectedChoices.get();
82
90
  const options = variantService.productOptions.get();
83
91
  return props.children({
@@ -117,12 +125,11 @@ export function Options(props) {
117
125
  * }
118
126
  * ```
119
127
  */
120
- export function Option(props) {
121
- const variantService = useService(SelectedVariantServiceDefinition);
128
+ function Option(props) {
129
+ const variantService = (0, services_manager_react_1.useService)(selected_variant_service_js_1.SelectedVariantServiceDefinition);
122
130
  const selectedChoices = variantService.selectedChoices.get();
123
131
  const { option } = props;
124
132
  const name = option.name || '';
125
- // @ts-expect-error - This field is currently INTERNAL but will be public in the future
126
133
  const key = option.key || name;
127
134
  const choices = option.choicesSettings?.choices || [];
128
135
  const selectedValue = selectedChoices[name] || null;
@@ -160,15 +167,13 @@ export function Option(props) {
160
167
  * }
161
168
  * ```
162
169
  */
163
- export function Choice(props) {
164
- const variantService = useService(SelectedVariantServiceDefinition);
170
+ function Choice(props) {
171
+ const variantService = (0, services_manager_react_1.useService)(selected_variant_service_js_1.SelectedVariantServiceDefinition);
165
172
  const selectedChoices = variantService.selectedChoices.get();
166
173
  const { option, choice } = props;
167
174
  const optionName = option.name || '';
168
- // @ts-expect-error - This field is currently INTERNAL but will be public in the future
169
175
  const optionKey = option.key || optionName;
170
176
  const choiceValue = choice.name || '';
171
- // @ts-expect-error - This field is currently INTERNAL but will be public in the future
172
177
  const choiceKey = choice.key || choiceValue;
173
178
  const isSelected = selectedChoices[optionKey] === choiceKey;
174
179
  // Check if this choice is available based on current selections
@@ -229,8 +234,8 @@ export function Choice(props) {
229
234
  * }
230
235
  * ```
231
236
  */
232
- export function Stock(props) {
233
- const variantService = useService(SelectedVariantServiceDefinition);
237
+ function Stock(props) {
238
+ const variantService = (0, services_manager_react_1.useService)(selected_variant_service_js_1.SelectedVariantServiceDefinition);
234
239
  const inStock = variantService.isInStock.get();
235
240
  const isPreOrderEnabled = variantService.isPreOrderEnabled.get();
236
241
  const trackInventory = variantService.trackQuantity.get();
@@ -239,8 +244,8 @@ export function Stock(props) {
239
244
  const selectedQuantity = variantService.selectedQuantity.get();
240
245
  // Return raw availability status - UI components will handle display conversion
241
246
  const availabilityStatus = inStock
242
- ? productsV3.InventoryAvailabilityStatus.IN_STOCK
243
- : productsV3.InventoryAvailabilityStatus.OUT_OF_STOCK;
247
+ ? stores_1.productsV3.InventoryAvailabilityStatus.IN_STOCK
248
+ : stores_1.productsV3.InventoryAvailabilityStatus.OUT_OF_STOCK;
244
249
  const incrementQuantity = () => {
245
250
  variantService.incrementQuantity();
246
251
  };
@@ -286,8 +291,8 @@ export function Stock(props) {
286
291
  * }
287
292
  * ```
288
293
  */
289
- export function Reset(props) {
290
- const variantService = useService(SelectedVariantServiceDefinition);
294
+ function Reset(props) {
295
+ const variantService = (0, services_manager_react_1.useService)(selected_variant_service_js_1.SelectedVariantServiceDefinition);
291
296
  const selectedChoices = variantService.selectedChoices.get();
292
297
  const hasSelections = Object.keys(selectedChoices).length > 0;
293
298
  const reset = () => {
@@ -1,10 +1,17 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useService, WixServices } from '@wix/services-manager-react';
3
- import { SelectedVariantServiceDefinition, SelectedVariantService, } from '../../services/selected-variant-service.js';
4
- import { ProductModifiersServiceDefinition } from '../../services/product-modifiers-service.js';
5
- import { createServicesMap } from '@wix/services-manager';
6
- import { Commerce } from '@wix/headless-ecom/react';
7
- import { CheckoutServiceDefinition, CurrentCartServiceDefinition, } from '@wix/headless-ecom/services';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Root = Root;
4
+ exports.Details = Details;
5
+ exports.Price = Price;
6
+ exports.SKU = SKU;
7
+ exports.Actions = Actions;
8
+ const jsx_runtime_1 = require("react/jsx-runtime");
9
+ const services_manager_react_1 = require("@wix/services-manager-react");
10
+ const selected_variant_service_js_1 = require("../../services/selected-variant-service.js");
11
+ const product_modifiers_service_js_1 = require("../../services/product-modifiers-service.js");
12
+ const services_manager_1 = require("@wix/services-manager");
13
+ const react_1 = require("@wix/headless-ecom/react");
14
+ const services_1 = require("@wix/headless-ecom/services");
8
15
  /**
9
16
  * Root component that provides the SelectedVariant service context to its children.
10
17
  * This component sets up the necessary services for rendering and managing selected variant data.
@@ -38,8 +45,8 @@ import { CheckoutServiceDefinition, CurrentCartServiceDefinition, } from '@wix/h
38
45
  * }
39
46
  * ```
40
47
  */
41
- export function Root(props) {
42
- return (_jsx(WixServices, { servicesMap: createServicesMap().addService(SelectedVariantServiceDefinition, SelectedVariantService, props.selectedVariantServiceConfig), children: props.children }));
48
+ function Root(props) {
49
+ return ((0, jsx_runtime_1.jsx)(services_manager_react_1.WixServices, { servicesMap: (0, services_manager_1.createServicesMap)().addService(selected_variant_service_js_1.SelectedVariantServiceDefinition, selected_variant_service_js_1.SelectedVariantService, props.selectedVariantServiceConfig), children: props.children }));
43
50
  }
44
51
  /**
45
52
  * Headless component for selected variant details display
@@ -63,8 +70,8 @@ export function Root(props) {
63
70
  * }
64
71
  * ```
65
72
  */
66
- export function Details(props) {
67
- const selectedVariantService = useService(SelectedVariantServiceDefinition);
73
+ function Details(props) {
74
+ const selectedVariantService = (0, services_manager_react_1.useService)(selected_variant_service_js_1.SelectedVariantServiceDefinition);
68
75
  const selectedVariant = selectedVariantService.currentVariant?.get();
69
76
  let sku = selectedVariant?.sku || null;
70
77
  let weight = selectedVariant?.physicalProperties?.weight?.toString() || null;
@@ -100,8 +107,8 @@ export function Details(props) {
100
107
  * }
101
108
  * ```
102
109
  */
103
- export function Price(props) {
104
- const variantService = useService(SelectedVariantServiceDefinition);
110
+ function Price(props) {
111
+ const variantService = (0, services_manager_react_1.useService)(selected_variant_service_js_1.SelectedVariantServiceDefinition);
105
112
  const price = variantService.currentPrice.get();
106
113
  const compareAtPrice = variantService.currentCompareAtPrice.get();
107
114
  const currency = variantService.currency.get();
@@ -136,8 +143,8 @@ export function Price(props) {
136
143
  * }
137
144
  * ```
138
145
  */
139
- export function SKU(props) {
140
- const selectedVariantService = useService(SelectedVariantServiceDefinition);
146
+ function SKU(props) {
147
+ const selectedVariantService = (0, services_manager_react_1.useService)(selected_variant_service_js_1.SelectedVariantServiceDefinition);
141
148
  const selectedVariant = selectedVariantService.currentVariant?.get();
142
149
  const sku = selectedVariant?.sku || null;
143
150
  return props.children({
@@ -178,13 +185,13 @@ export function SKU(props) {
178
185
  * }
179
186
  * ```
180
187
  */
181
- export function Actions(props) {
182
- const variantService = useService(SelectedVariantServiceDefinition);
183
- const cartService = useService(CurrentCartServiceDefinition);
188
+ function Actions(props) {
189
+ const variantService = (0, services_manager_react_1.useService)(selected_variant_service_js_1.SelectedVariantServiceDefinition);
190
+ const cartService = (0, services_manager_react_1.useService)(services_1.CurrentCartServiceDefinition);
184
191
  // Try to get checkout service - it may not be available
185
192
  let checkoutService = null;
186
193
  try {
187
- checkoutService = useService(CheckoutServiceDefinition);
194
+ checkoutService = (0, services_manager_react_1.useService)(services_1.CheckoutServiceDefinition);
188
195
  }
189
196
  catch {
190
197
  // Checkout service not available
@@ -193,7 +200,7 @@ export function Actions(props) {
193
200
  // Try to get modifiers service - it may not exist for all products
194
201
  let modifiersService = null;
195
202
  try {
196
- modifiersService = useService(ProductModifiersServiceDefinition);
203
+ modifiersService = (0, services_manager_react_1.useService)(product_modifiers_service_js_1.ProductModifiersServiceDefinition);
197
204
  }
198
205
  catch {
199
206
  // Modifiers service not available for this product
@@ -255,7 +262,7 @@ export function Actions(props) {
255
262
  error,
256
263
  };
257
264
  if (checkoutService) {
258
- return (_jsx(Commerce.CheckoutTrigger, { children: ({ createCheckout, isLoading: checkoutLoading, error: checkoutError, }) => props.children({
265
+ return ((0, jsx_runtime_1.jsx)(react_1.Commerce.CheckoutTrigger, { children: ({ createCheckout, isLoading: checkoutLoading, error: checkoutError, }) => props.children({
259
266
  ...commonProps,
260
267
  isLoading: isLoading || checkoutLoading,
261
268
  error: error || checkoutError,
@@ -1,6 +1,42 @@
1
- export * as Product from './Product.js';
2
- export * as ProductList from './ProductList.js';
3
- export * as Option from './Option.js';
4
- export * as Choice from './Choice.js';
5
- export * as CategoryList from './CategoryList.js';
6
- export * as Category from './Category.js';
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Category = exports.CategoryList = exports.Choice = exports.Option = exports.ProductList = exports.Product = void 0;
37
+ exports.Product = __importStar(require("./Product.js"));
38
+ exports.ProductList = __importStar(require("./ProductList.js"));
39
+ exports.Option = __importStar(require("./Option.js"));
40
+ exports.Choice = __importStar(require("./Choice.js"));
41
+ exports.CategoryList = __importStar(require("./CategoryList.js"));
42
+ exports.Category = __importStar(require("./Category.js"));
@@ -1,9 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AsContent = void 0;
1
4
  /**
2
5
  * Enum for content rendering formats
3
6
  */
4
- export var AsContent;
7
+ var AsContent;
5
8
  (function (AsContent) {
6
9
  AsContent["Plain"] = "plain";
7
10
  AsContent["Html"] = "html";
8
11
  AsContent["Ricos"] = "ricos";
9
- })(AsContent || (AsContent = {}));
12
+ })(AsContent || (exports.AsContent = AsContent = {}));
@@ -1,6 +1,9 @@
1
- import { checkout } from '@wix/ecom';
2
- import { redirects } from '@wix/redirects';
3
- import { auth } from '@wix/essentials';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCustomLineItemCheckoutURLFactory = getCustomLineItemCheckoutURLFactory;
4
+ const ecom_1 = require("@wix/ecom");
5
+ const redirects_1 = require("@wix/redirects");
6
+ const essentials_1 = require("@wix/essentials");
4
7
  /**
5
8
  * Creates a factory function to generate checkout URLs for custom line items with a fixed price.
6
9
  * This is useful when you have a single product or service with a known price,
@@ -9,7 +12,7 @@ import { auth } from '@wix/essentials';
9
12
  * @param factoryOpts - The options for the factory, including the price.
10
13
  * @returns A function that takes `CustomLineItemCheckoutOptions` and returns a checkout URL.
11
14
  */
12
- export function getCustomLineItemCheckoutURLFactory(factoryOpts) {
15
+ function getCustomLineItemCheckoutURLFactory(factoryOpts) {
13
16
  /**
14
17
  * Generates a checkout URL for a custom line item.
15
18
  * @param opts - The options for the custom line item checkout.
@@ -18,7 +21,7 @@ export function getCustomLineItemCheckoutURLFactory(factoryOpts) {
18
21
  */
19
22
  return async function getCustomLineItemCheckoutURL() {
20
23
  try {
21
- const checkoutResult = await auth.elevate(checkout.createCheckout)({
24
+ const checkoutResult = await essentials_1.auth.elevate(ecom_1.checkout.createCheckout)({
22
25
  customLineItems: [
23
26
  {
24
27
  productName: {
@@ -27,7 +30,7 @@ export function getCustomLineItemCheckoutURLFactory(factoryOpts) {
27
30
  price: factoryOpts.price,
28
31
  quantity: factoryOpts.quantity || 1,
29
32
  itemType: {
30
- preset: checkout.ItemTypePreset.PHYSICAL,
33
+ preset: ecom_1.checkout.ItemTypePreset.PHYSICAL,
31
34
  },
32
35
  priceDescription: {
33
36
  original: factoryOpts.priceDescription,
@@ -35,7 +38,7 @@ export function getCustomLineItemCheckoutURLFactory(factoryOpts) {
35
38
  policies: factoryOpts.policies || [],
36
39
  },
37
40
  ],
38
- channelType: checkout.ChannelType.WEB,
41
+ channelType: ecom_1.checkout.ChannelType.WEB,
39
42
  ...(factoryOpts.currency
40
43
  ? {
41
44
  checkoutInfo: {
@@ -47,7 +50,7 @@ export function getCustomLineItemCheckoutURLFactory(factoryOpts) {
47
50
  if (!checkoutResult._id) {
48
51
  throw new Error(`Failed to create checkout for custom line item ${factoryOpts.productName}`);
49
52
  }
50
- const { redirectSession } = await redirects.createRedirectSession({
53
+ const { redirectSession } = await redirects_1.redirects.createRedirectSession({
51
54
  ecomCheckout: { checkoutId: checkoutResult._id },
52
55
  callbacks: {
53
56
  ...(factoryOpts.postFlowUrl
@@ -1 +1,17 @@
1
- export * from './custom-checkout-action.js';
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./custom-checkout-action.js"), exports);
@@ -1,14 +1,17 @@
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 { productsV3 } from '@wix/stores';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buyNowServiceBinding = exports.loadBuyNowServiceInitialData = exports.BuyNowServiceImplementation = exports.BuyNowServiceDefinition = void 0;
4
+ const services_definitions_1 = require("@wix/services-definitions");
5
+ const signals_1 = require("@wix/services-definitions/core-services/signals");
6
+ const index_js_1 = require("../utils/index.js");
7
+ const stores_1 = require("@wix/stores");
5
8
  /**
6
9
  * Service definition for the Buy Now service.
7
10
  * This defines the reactive API contract for managing buy now functionality.
8
11
  *
9
12
  * @constant
10
13
  */
11
- export const BuyNowServiceDefinition = defineService('BuyNow');
14
+ exports.BuyNowServiceDefinition = (0, services_definitions_1.defineService)('BuyNow');
12
15
  /**
13
16
  * Implementation of the Buy Now service that manages buy now functionality.
14
17
  * This service provides signals for loading state, stock status, and error handling,
@@ -56,8 +59,8 @@ export const BuyNowServiceDefinition = defineService('BuyNow');
56
59
  * }
57
60
  * ```
58
61
  */
59
- export const BuyNowServiceImplementation = implementService.withConfig()(BuyNowServiceDefinition, ({ getService, config }) => {
60
- const signalsService = getService(SignalsServiceDefinition);
62
+ exports.BuyNowServiceImplementation = services_definitions_1.implementService.withConfig()(exports.BuyNowServiceDefinition, ({ getService, config }) => {
63
+ const signalsService = getService(signals_1.SignalsServiceDefinition);
61
64
  const loadingSignal = signalsService.signal(false);
62
65
  const errorSignal = signalsService.signal(null);
63
66
  const inStockSignal = signalsService.signal(config.inStock);
@@ -66,7 +69,7 @@ export const BuyNowServiceImplementation = implementService.withConfig()(BuyNowS
66
69
  redirectToCheckout: async () => {
67
70
  loadingSignal.set(true);
68
71
  try {
69
- const checkoutUrl = await getCheckoutUrlForProduct(config.productId, config.variantId);
72
+ const checkoutUrl = await (0, index_js_1.getCheckoutUrlForProduct)(config.productId, config.variantId);
70
73
  window.location.href = checkoutUrl;
71
74
  }
72
75
  catch (error) {
@@ -135,8 +138,8 @@ export const BuyNowServiceImplementation = implementService.withConfig()(BuyNowS
135
138
  * };
136
139
  * ```
137
140
  */
138
- export const loadBuyNowServiceInitialData = async (productSlug, variantId) => {
139
- const res = await productsV3.getProductBySlug(productSlug, {
141
+ const loadBuyNowServiceInitialData = async (productSlug, variantId) => {
142
+ const res = await stores_1.productsV3.getProductBySlug(productSlug, {
140
143
  fields: ['CURRENCY'],
141
144
  });
142
145
  const product = res.product;
@@ -148,7 +151,7 @@ export const loadBuyNowServiceInitialData = async (productSlug, variantId) => {
148
151
  const inStock = selectedVariant?.inventoryStatus?.inStock;
149
152
  const preOrderAvailable = selectedVariant?.inventoryStatus?.preorderEnabled;
150
153
  return {
151
- [BuyNowServiceDefinition]: {
154
+ [exports.BuyNowServiceDefinition]: {
152
155
  productId: product._id,
153
156
  productName: product.name,
154
157
  price: price,
@@ -159,6 +162,7 @@ export const loadBuyNowServiceInitialData = async (productSlug, variantId) => {
159
162
  },
160
163
  };
161
164
  };
165
+ exports.loadBuyNowServiceInitialData = loadBuyNowServiceInitialData;
162
166
  /**
163
167
  * Helper function to create a buy now service binding with configuration.
164
168
  * This function simplifies the process of binding the buy now service with its configuration
@@ -185,13 +189,14 @@ export const loadBuyNowServiceInitialData = async (productSlug, variantId) => {
185
189
  * const services = createServicesMap([buyNowBinding]);
186
190
  * ```
187
191
  */
188
- export const buyNowServiceBinding = (servicesConfigs, additionalConfig = {}) => {
192
+ const buyNowServiceBinding = (servicesConfigs, additionalConfig = {}) => {
189
193
  return [
190
- BuyNowServiceDefinition,
191
- BuyNowServiceImplementation,
194
+ exports.BuyNowServiceDefinition,
195
+ exports.BuyNowServiceImplementation,
192
196
  {
193
- ...servicesConfigs[BuyNowServiceDefinition],
197
+ ...servicesConfigs[exports.BuyNowServiceDefinition],
194
198
  ...additionalConfig,
195
199
  },
196
200
  ];
197
201
  };
202
+ exports.buyNowServiceBinding = buyNowServiceBinding;
@@ -1,13 +1,17 @@
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
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CategoriesListService = exports.CategoriesListServiceDefinition = void 0;
4
+ exports.loadCategoriesListServiceConfig = loadCategoriesListServiceConfig;
5
+ const services_definitions_1 = require("@wix/services-definitions");
6
+ const signals_1 = require("@wix/services-definitions/core-services/signals");
7
+ const categories_1 = require("@wix/categories");
4
8
  /**
5
9
  * Service definition for the Categories List service.
6
10
  * This defines the reactive API contract for managing a list of product categories.
7
11
  *
8
12
  * @constant
9
13
  */
10
- export const CategoriesListServiceDefinition = defineService('categories-list');
14
+ exports.CategoriesListServiceDefinition = (0, services_definitions_1.defineService)('categories-list');
11
15
  /**
12
16
  * Implementation of the Categories List service that manages reactive categories data.
13
17
  * This service provides signals for categories data, loading state, and error handling.
@@ -47,8 +51,8 @@ export const CategoriesListServiceDefinition = defineService('categories-list');
47
51
  * }
48
52
  * ```
49
53
  */
50
- export const CategoriesListService = implementService.withConfig()(CategoriesListServiceDefinition, ({ getService, config }) => {
51
- const signalsService = getService(SignalsServiceDefinition);
54
+ exports.CategoriesListService = services_definitions_1.implementService.withConfig()(exports.CategoriesListServiceDefinition, ({ getService, config }) => {
55
+ const signalsService = getService(signals_1.SignalsServiceDefinition);
52
56
  const categoriesSignal = signalsService.signal(config.categories);
53
57
  const isLoadingSignal = signalsService.signal(false);
54
58
  const errorSignal = signalsService.signal(null);
@@ -125,8 +129,8 @@ export const CategoriesListService = implementService.withConfig()(CategoriesLis
125
129
  * }
126
130
  * ```
127
131
  */
128
- export async function loadCategoriesListServiceConfig() {
129
- const categoriesResponse = await categories
132
+ async function loadCategoriesListServiceConfig() {
133
+ const categoriesResponse = await categories_1.categories
130
134
  .queryCategories({
131
135
  treeReference: {
132
136
  appNamespace: '@wix/stores',