@wix/headless-stores 0.0.82 → 0.0.83
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.
- package/cjs/dist/react/ProductList.d.ts +39 -0
- package/cjs/dist/react/ProductList.js +38 -0
- package/cjs/dist/react/core/SelectedVariant.js +2 -2
- package/cjs/dist/react/index.d.ts +0 -7
- package/cjs/dist/react/index.js +0 -7
- package/dist/react/ProductList.d.ts +39 -0
- package/dist/react/ProductList.js +38 -0
- package/dist/react/core/SelectedVariant.js +2 -2
- package/dist/react/index.d.ts +0 -7
- package/dist/react/index.js +0 -7
- package/package.json +2 -2
|
@@ -344,3 +344,42 @@ export interface FilterResetTriggerProps {
|
|
|
344
344
|
* ```
|
|
345
345
|
*/
|
|
346
346
|
export declare const FilterResetTrigger: React.ForwardRefExoticComponent<FilterResetTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
347
|
+
/**
|
|
348
|
+
* Props for ProductList Error component
|
|
349
|
+
*/
|
|
350
|
+
export interface ErrorProps {
|
|
351
|
+
/** Whether to render as a child component */
|
|
352
|
+
asChild?: boolean;
|
|
353
|
+
/** Custom render function when using asChild */
|
|
354
|
+
children?: AsChildChildren<{
|
|
355
|
+
error: string | null;
|
|
356
|
+
}>;
|
|
357
|
+
/** CSS classes to apply to the default element */
|
|
358
|
+
className?: string;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Error component that displays product list errors.
|
|
362
|
+
* Provides error data to custom render functions.
|
|
363
|
+
* Only renders when there's an error.
|
|
364
|
+
*
|
|
365
|
+
* @component
|
|
366
|
+
* @example
|
|
367
|
+
* ```tsx
|
|
368
|
+
* // Default usage
|
|
369
|
+
* <ProductList.Error className="error-message" />
|
|
370
|
+
*
|
|
371
|
+
* // Custom rendering with forwardRef
|
|
372
|
+
* <ProductList.Error asChild>
|
|
373
|
+
* {React.forwardRef(({error, ...props}, ref) => (
|
|
374
|
+
* <div
|
|
375
|
+
* ref={ref}
|
|
376
|
+
* {...props}
|
|
377
|
+
* className="custom-error-container"
|
|
378
|
+
* >
|
|
379
|
+
* Error: {error}
|
|
380
|
+
* </div>
|
|
381
|
+
* ))}
|
|
382
|
+
* </ProductList.Error>
|
|
383
|
+
* ```
|
|
384
|
+
*/
|
|
385
|
+
export declare const Error: React.ForwardRefExoticComponent<ErrorProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -19,6 +19,7 @@ var TestIds;
|
|
|
19
19
|
TestIds["productListSort"] = "product-list-sort";
|
|
20
20
|
TestIds["productListFilter"] = "product-list-filter";
|
|
21
21
|
TestIds["productListFilterResetTrigger"] = "product-list-filter-reset-trigger";
|
|
22
|
+
TestIds["productListError"] = "product-list-error";
|
|
22
23
|
})(TestIds || (TestIds = {}));
|
|
23
24
|
/**
|
|
24
25
|
* Root component that provides the ProductList service context for rendering product lists.
|
|
@@ -350,3 +351,40 @@ export const FilterResetTrigger = React.forwardRef((props, ref) => {
|
|
|
350
351
|
} }));
|
|
351
352
|
});
|
|
352
353
|
FilterResetTrigger.displayName = 'ProductList.FilterResetTrigger';
|
|
354
|
+
/**
|
|
355
|
+
* Error component that displays product list errors.
|
|
356
|
+
* Provides error data to custom render functions.
|
|
357
|
+
* Only renders when there's an error.
|
|
358
|
+
*
|
|
359
|
+
* @component
|
|
360
|
+
* @example
|
|
361
|
+
* ```tsx
|
|
362
|
+
* // Default usage
|
|
363
|
+
* <ProductList.Error className="error-message" />
|
|
364
|
+
*
|
|
365
|
+
* // Custom rendering with forwardRef
|
|
366
|
+
* <ProductList.Error asChild>
|
|
367
|
+
* {React.forwardRef(({error, ...props}, ref) => (
|
|
368
|
+
* <div
|
|
369
|
+
* ref={ref}
|
|
370
|
+
* {...props}
|
|
371
|
+
* className="custom-error-container"
|
|
372
|
+
* >
|
|
373
|
+
* Error: {error}
|
|
374
|
+
* </div>
|
|
375
|
+
* ))}
|
|
376
|
+
* </ProductList.Error>
|
|
377
|
+
* ```
|
|
378
|
+
*/
|
|
379
|
+
export const Error = React.forwardRef((props, ref) => {
|
|
380
|
+
const { asChild, children, className } = props;
|
|
381
|
+
return (_jsx(CoreProductList.Error, { children: ({ error }) => {
|
|
382
|
+
if (!error) {
|
|
383
|
+
return null;
|
|
384
|
+
}
|
|
385
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.productListError, "data-error": error, customElement: children, customElementProps: {
|
|
386
|
+
error,
|
|
387
|
+
}, content: error, children: _jsx("div", { className: "text-status-error text-sm sm:text-base", children: error }) }));
|
|
388
|
+
} }));
|
|
389
|
+
});
|
|
390
|
+
Error.displayName = 'ProductList.Error';
|
|
@@ -3,7 +3,7 @@ import { useService, WixServices } from '@wix/services-manager-react';
|
|
|
3
3
|
import { SelectedVariantServiceDefinition, SelectedVariantService, } from '../../services/selected-variant-service.js';
|
|
4
4
|
import { ProductModifiersServiceDefinition } from '../../services/product-modifiers-service.js';
|
|
5
5
|
import { createServicesMap } from '@wix/services-manager';
|
|
6
|
-
import {
|
|
6
|
+
import { Commerce } from '@wix/headless-ecom/react';
|
|
7
7
|
import { CheckoutServiceDefinition, CurrentCartServiceDefinition, } from '@wix/headless-ecom/services';
|
|
8
8
|
/**
|
|
9
9
|
* Root component that provides the SelectedVariant service context to its children.
|
|
@@ -255,7 +255,7 @@ export function Actions(props) {
|
|
|
255
255
|
error,
|
|
256
256
|
};
|
|
257
257
|
if (checkoutService) {
|
|
258
|
-
return (_jsx(
|
|
258
|
+
return (_jsx(Commerce.CheckoutTrigger, { children: ({ createCheckout, isLoading: checkoutLoading, error: checkoutError, }) => props.children({
|
|
259
259
|
...commonProps,
|
|
260
260
|
isLoading: isLoading || checkoutLoading,
|
|
261
261
|
error: error || checkoutError,
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
export * as CategoryListCore from './core/CategoryList.js';
|
|
2
|
-
export * as ProductCore from './core/Product.js';
|
|
3
|
-
export * as ProductModifiers from './core/ProductModifiers.js';
|
|
4
|
-
export * as ProductListCore from './core/ProductList.js';
|
|
5
|
-
export * as ProductListPagination from './core/ProductListPagination.js';
|
|
6
|
-
export * as ProductVariantSelector from './core/ProductVariantSelector.js';
|
|
7
|
-
export * as SelectedVariant from './core/SelectedVariant.js';
|
|
8
1
|
export * as Product from './Product.js';
|
|
9
2
|
export * as ProductList from './ProductList.js';
|
|
10
3
|
export * as Option from './Option.js';
|
package/cjs/dist/react/index.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
export * as CategoryListCore from './core/CategoryList.js';
|
|
2
|
-
export * as ProductCore from './core/Product.js';
|
|
3
|
-
export * as ProductModifiers from './core/ProductModifiers.js';
|
|
4
|
-
export * as ProductListCore from './core/ProductList.js';
|
|
5
|
-
export * as ProductListPagination from './core/ProductListPagination.js';
|
|
6
|
-
export * as ProductVariantSelector from './core/ProductVariantSelector.js';
|
|
7
|
-
export * as SelectedVariant from './core/SelectedVariant.js';
|
|
8
1
|
export * as Product from './Product.js';
|
|
9
2
|
export * as ProductList from './ProductList.js';
|
|
10
3
|
export * as Option from './Option.js';
|
|
@@ -344,3 +344,42 @@ export interface FilterResetTriggerProps {
|
|
|
344
344
|
* ```
|
|
345
345
|
*/
|
|
346
346
|
export declare const FilterResetTrigger: React.ForwardRefExoticComponent<FilterResetTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
347
|
+
/**
|
|
348
|
+
* Props for ProductList Error component
|
|
349
|
+
*/
|
|
350
|
+
export interface ErrorProps {
|
|
351
|
+
/** Whether to render as a child component */
|
|
352
|
+
asChild?: boolean;
|
|
353
|
+
/** Custom render function when using asChild */
|
|
354
|
+
children?: AsChildChildren<{
|
|
355
|
+
error: string | null;
|
|
356
|
+
}>;
|
|
357
|
+
/** CSS classes to apply to the default element */
|
|
358
|
+
className?: string;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Error component that displays product list errors.
|
|
362
|
+
* Provides error data to custom render functions.
|
|
363
|
+
* Only renders when there's an error.
|
|
364
|
+
*
|
|
365
|
+
* @component
|
|
366
|
+
* @example
|
|
367
|
+
* ```tsx
|
|
368
|
+
* // Default usage
|
|
369
|
+
* <ProductList.Error className="error-message" />
|
|
370
|
+
*
|
|
371
|
+
* // Custom rendering with forwardRef
|
|
372
|
+
* <ProductList.Error asChild>
|
|
373
|
+
* {React.forwardRef(({error, ...props}, ref) => (
|
|
374
|
+
* <div
|
|
375
|
+
* ref={ref}
|
|
376
|
+
* {...props}
|
|
377
|
+
* className="custom-error-container"
|
|
378
|
+
* >
|
|
379
|
+
* Error: {error}
|
|
380
|
+
* </div>
|
|
381
|
+
* ))}
|
|
382
|
+
* </ProductList.Error>
|
|
383
|
+
* ```
|
|
384
|
+
*/
|
|
385
|
+
export declare const Error: React.ForwardRefExoticComponent<ErrorProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -19,6 +19,7 @@ var TestIds;
|
|
|
19
19
|
TestIds["productListSort"] = "product-list-sort";
|
|
20
20
|
TestIds["productListFilter"] = "product-list-filter";
|
|
21
21
|
TestIds["productListFilterResetTrigger"] = "product-list-filter-reset-trigger";
|
|
22
|
+
TestIds["productListError"] = "product-list-error";
|
|
22
23
|
})(TestIds || (TestIds = {}));
|
|
23
24
|
/**
|
|
24
25
|
* Root component that provides the ProductList service context for rendering product lists.
|
|
@@ -350,3 +351,40 @@ export const FilterResetTrigger = React.forwardRef((props, ref) => {
|
|
|
350
351
|
} }));
|
|
351
352
|
});
|
|
352
353
|
FilterResetTrigger.displayName = 'ProductList.FilterResetTrigger';
|
|
354
|
+
/**
|
|
355
|
+
* Error component that displays product list errors.
|
|
356
|
+
* Provides error data to custom render functions.
|
|
357
|
+
* Only renders when there's an error.
|
|
358
|
+
*
|
|
359
|
+
* @component
|
|
360
|
+
* @example
|
|
361
|
+
* ```tsx
|
|
362
|
+
* // Default usage
|
|
363
|
+
* <ProductList.Error className="error-message" />
|
|
364
|
+
*
|
|
365
|
+
* // Custom rendering with forwardRef
|
|
366
|
+
* <ProductList.Error asChild>
|
|
367
|
+
* {React.forwardRef(({error, ...props}, ref) => (
|
|
368
|
+
* <div
|
|
369
|
+
* ref={ref}
|
|
370
|
+
* {...props}
|
|
371
|
+
* className="custom-error-container"
|
|
372
|
+
* >
|
|
373
|
+
* Error: {error}
|
|
374
|
+
* </div>
|
|
375
|
+
* ))}
|
|
376
|
+
* </ProductList.Error>
|
|
377
|
+
* ```
|
|
378
|
+
*/
|
|
379
|
+
export const Error = React.forwardRef((props, ref) => {
|
|
380
|
+
const { asChild, children, className } = props;
|
|
381
|
+
return (_jsx(CoreProductList.Error, { children: ({ error }) => {
|
|
382
|
+
if (!error) {
|
|
383
|
+
return null;
|
|
384
|
+
}
|
|
385
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.productListError, "data-error": error, customElement: children, customElementProps: {
|
|
386
|
+
error,
|
|
387
|
+
}, content: error, children: _jsx("div", { className: "text-status-error text-sm sm:text-base", children: error }) }));
|
|
388
|
+
} }));
|
|
389
|
+
});
|
|
390
|
+
Error.displayName = 'ProductList.Error';
|
|
@@ -3,7 +3,7 @@ import { useService, WixServices } from '@wix/services-manager-react';
|
|
|
3
3
|
import { SelectedVariantServiceDefinition, SelectedVariantService, } from '../../services/selected-variant-service.js';
|
|
4
4
|
import { ProductModifiersServiceDefinition } from '../../services/product-modifiers-service.js';
|
|
5
5
|
import { createServicesMap } from '@wix/services-manager';
|
|
6
|
-
import {
|
|
6
|
+
import { Commerce } from '@wix/headless-ecom/react';
|
|
7
7
|
import { CheckoutServiceDefinition, CurrentCartServiceDefinition, } from '@wix/headless-ecom/services';
|
|
8
8
|
/**
|
|
9
9
|
* Root component that provides the SelectedVariant service context to its children.
|
|
@@ -255,7 +255,7 @@ export function Actions(props) {
|
|
|
255
255
|
error,
|
|
256
256
|
};
|
|
257
257
|
if (checkoutService) {
|
|
258
|
-
return (_jsx(
|
|
258
|
+
return (_jsx(Commerce.CheckoutTrigger, { children: ({ createCheckout, isLoading: checkoutLoading, error: checkoutError, }) => props.children({
|
|
259
259
|
...commonProps,
|
|
260
260
|
isLoading: isLoading || checkoutLoading,
|
|
261
261
|
error: error || checkoutError,
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
export * as CategoryListCore from './core/CategoryList.js';
|
|
2
|
-
export * as ProductCore from './core/Product.js';
|
|
3
|
-
export * as ProductModifiers from './core/ProductModifiers.js';
|
|
4
|
-
export * as ProductListCore from './core/ProductList.js';
|
|
5
|
-
export * as ProductListPagination from './core/ProductListPagination.js';
|
|
6
|
-
export * as ProductVariantSelector from './core/ProductVariantSelector.js';
|
|
7
|
-
export * as SelectedVariant from './core/SelectedVariant.js';
|
|
8
1
|
export * as Product from './Product.js';
|
|
9
2
|
export * as ProductList from './ProductList.js';
|
|
10
3
|
export * as Option from './Option.js';
|
package/dist/react/index.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
export * as CategoryListCore from './core/CategoryList.js';
|
|
2
|
-
export * as ProductCore from './core/Product.js';
|
|
3
|
-
export * as ProductModifiers from './core/ProductModifiers.js';
|
|
4
|
-
export * as ProductListCore from './core/ProductList.js';
|
|
5
|
-
export * as ProductListPagination from './core/ProductListPagination.js';
|
|
6
|
-
export * as ProductVariantSelector from './core/ProductVariantSelector.js';
|
|
7
|
-
export * as SelectedVariant from './core/SelectedVariant.js';
|
|
8
1
|
export * as Product from './Product.js';
|
|
9
2
|
export * as ProductList from './ProductList.js';
|
|
10
3
|
export * as Option from './Option.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/headless-stores",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.83",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prebuild": "cd ../media && yarn build && cd ../ecom && yarn build",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@wix/ecom": "^1.0.1278",
|
|
64
64
|
"@wix/essentials": "^0.1.24",
|
|
65
65
|
"@wix/headless-components": "0.0.12",
|
|
66
|
-
"@wix/headless-ecom": "0.0.
|
|
66
|
+
"@wix/headless-ecom": "0.0.26",
|
|
67
67
|
"@wix/headless-media": "0.0.11",
|
|
68
68
|
"@wix/headless-utils": "0.0.3",
|
|
69
69
|
"@wix/redirects": "^1.0.83",
|