@wix/headless-stores 0.0.34 → 0.0.35
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/ProductModifiers.d.ts +76 -0
- package/cjs/dist/react/ProductModifiers.js +81 -2
- package/cjs/dist/react/index.d.ts +0 -1
- package/cjs/dist/react/index.js +0 -1
- package/cjs/dist/services/index.d.ts +1 -2
- package/cjs/dist/services/index.js +1 -2
- package/dist/react/ProductModifiers.d.ts +76 -0
- package/dist/react/ProductModifiers.js +81 -2
- package/dist/react/index.d.ts +0 -1
- package/dist/react/index.js +0 -1
- package/dist/services/index.d.ts +1 -2
- package/dist/services/index.js +1 -2
- package/package.json +1 -1
- package/cjs/dist/react/SocialSharing.d.ts +0 -194
- package/cjs/dist/react/SocialSharing.js +0 -170
- package/cjs/dist/services/social-sharing-service.d.ts +0 -34
- package/cjs/dist/services/social-sharing-service.js +0 -129
- package/dist/react/SocialSharing.d.ts +0 -194
- package/dist/react/SocialSharing.js +0 -170
- package/dist/services/social-sharing-service.d.ts +0 -34
- package/dist/services/social-sharing-service.js +0 -129
|
@@ -1,4 +1,80 @@
|
|
|
1
1
|
import { type ConnectedModifier, type ConnectedModifierChoice } from "@wix/auto_sdk_stores_products-v-3";
|
|
2
|
+
import type { PropsWithChildren } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Root component that provides the ProductModifiers service context to its children.
|
|
5
|
+
* This component sets up the necessary services for managing product modifier functionality.
|
|
6
|
+
*
|
|
7
|
+
* @order 1
|
|
8
|
+
* @component
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* import { ProductModifiers } from '@wix/stores/components';
|
|
12
|
+
*
|
|
13
|
+
* function ProductCustomization() {
|
|
14
|
+
* return (
|
|
15
|
+
* <ProductModifiers.Root>
|
|
16
|
+
* <div>
|
|
17
|
+
* <ProductModifiers.Modifiers>
|
|
18
|
+
* {({ modifiers, hasModifiers, selectedModifiers, areAllRequiredModifiersFilled }) => (
|
|
19
|
+
* <div>
|
|
20
|
+
* {hasModifiers && (
|
|
21
|
+
* <div>
|
|
22
|
+
* <h3>Customize your product</h3>
|
|
23
|
+
* {modifiers.map(modifier => (
|
|
24
|
+
* <ProductModifiers.Modifier key={modifier.id} modifier={modifier}>
|
|
25
|
+
* {({ name, mandatory, hasChoices, choices, isFreeText }) => (
|
|
26
|
+
* <div className="modifier-field">
|
|
27
|
+
* <label>
|
|
28
|
+
* {name} {mandatory && <span className="required">*</span>}
|
|
29
|
+
* </label>
|
|
30
|
+
* {hasChoices && (
|
|
31
|
+
* <div className="choices">
|
|
32
|
+
* {choices.map(choice => (
|
|
33
|
+
* <ProductModifiers.Choice key={choice.id} modifier={modifier} choice={choice}>
|
|
34
|
+
* {({ value, isSelected, onSelect }) => (
|
|
35
|
+
* <button
|
|
36
|
+
* onClick={onSelect}
|
|
37
|
+
* className={isSelected ? 'selected' : ''}
|
|
38
|
+
* >
|
|
39
|
+
* {value}
|
|
40
|
+
* </button>
|
|
41
|
+
* )}
|
|
42
|
+
* </ProductModifiers.Choice>
|
|
43
|
+
* ))}
|
|
44
|
+
* </div>
|
|
45
|
+
* )}
|
|
46
|
+
* {isFreeText && (
|
|
47
|
+
* <ProductModifiers.FreeText modifier={modifier}>
|
|
48
|
+
* {({ value, onChange, placeholder, maxChars }) => (
|
|
49
|
+
* <input
|
|
50
|
+
* type="text"
|
|
51
|
+
* value={value}
|
|
52
|
+
* onChange={(e) => onChange(e.target.value)}
|
|
53
|
+
* placeholder={placeholder}
|
|
54
|
+
* maxLength={maxChars}
|
|
55
|
+
* />
|
|
56
|
+
* )}
|
|
57
|
+
* </ProductModifiers.FreeText>
|
|
58
|
+
* )}
|
|
59
|
+
* </div>
|
|
60
|
+
* )}
|
|
61
|
+
* </ProductModifiers.Modifier>
|
|
62
|
+
* ))}
|
|
63
|
+
* {!areAllRequiredModifiersFilled && (
|
|
64
|
+
* <div className="warning">Please fill all required options</div>
|
|
65
|
+
* )}
|
|
66
|
+
* </div>
|
|
67
|
+
* )}
|
|
68
|
+
* </div>
|
|
69
|
+
* )}
|
|
70
|
+
* </ProductModifiers.Modifiers>
|
|
71
|
+
* </div>
|
|
72
|
+
* </ProductModifiers.Root>
|
|
73
|
+
* );
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export declare function Root(props: PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element;
|
|
2
78
|
/**
|
|
3
79
|
* Props for Modifiers headless component
|
|
4
80
|
*/
|
|
@@ -1,7 +1,86 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
import { useState } from "react";
|
|
2
|
-
import { useService } from "@wix/services-manager-react";
|
|
3
|
-
import { ProductModifiersServiceDefinition } from "../services/product-modifiers-service.js";
|
|
3
|
+
import { useService, WixServices } from "@wix/services-manager-react";
|
|
4
|
+
import { ProductModifiersServiceDefinition, ProductModifiersService, } from "../services/product-modifiers-service.js";
|
|
4
5
|
import { ModifierRenderType, } from "@wix/auto_sdk_stores_products-v-3";
|
|
6
|
+
import { createServicesMap } from "@wix/services-manager";
|
|
7
|
+
/**
|
|
8
|
+
* Root component that provides the ProductModifiers service context to its children.
|
|
9
|
+
* This component sets up the necessary services for managing product modifier functionality.
|
|
10
|
+
*
|
|
11
|
+
* @order 1
|
|
12
|
+
* @component
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* import { ProductModifiers } from '@wix/stores/components';
|
|
16
|
+
*
|
|
17
|
+
* function ProductCustomization() {
|
|
18
|
+
* return (
|
|
19
|
+
* <ProductModifiers.Root>
|
|
20
|
+
* <div>
|
|
21
|
+
* <ProductModifiers.Modifiers>
|
|
22
|
+
* {({ modifiers, hasModifiers, selectedModifiers, areAllRequiredModifiersFilled }) => (
|
|
23
|
+
* <div>
|
|
24
|
+
* {hasModifiers && (
|
|
25
|
+
* <div>
|
|
26
|
+
* <h3>Customize your product</h3>
|
|
27
|
+
* {modifiers.map(modifier => (
|
|
28
|
+
* <ProductModifiers.Modifier key={modifier.id} modifier={modifier}>
|
|
29
|
+
* {({ name, mandatory, hasChoices, choices, isFreeText }) => (
|
|
30
|
+
* <div className="modifier-field">
|
|
31
|
+
* <label>
|
|
32
|
+
* {name} {mandatory && <span className="required">*</span>}
|
|
33
|
+
* </label>
|
|
34
|
+
* {hasChoices && (
|
|
35
|
+
* <div className="choices">
|
|
36
|
+
* {choices.map(choice => (
|
|
37
|
+
* <ProductModifiers.Choice key={choice.id} modifier={modifier} choice={choice}>
|
|
38
|
+
* {({ value, isSelected, onSelect }) => (
|
|
39
|
+
* <button
|
|
40
|
+
* onClick={onSelect}
|
|
41
|
+
* className={isSelected ? 'selected' : ''}
|
|
42
|
+
* >
|
|
43
|
+
* {value}
|
|
44
|
+
* </button>
|
|
45
|
+
* )}
|
|
46
|
+
* </ProductModifiers.Choice>
|
|
47
|
+
* ))}
|
|
48
|
+
* </div>
|
|
49
|
+
* )}
|
|
50
|
+
* {isFreeText && (
|
|
51
|
+
* <ProductModifiers.FreeText modifier={modifier}>
|
|
52
|
+
* {({ value, onChange, placeholder, maxChars }) => (
|
|
53
|
+
* <input
|
|
54
|
+
* type="text"
|
|
55
|
+
* value={value}
|
|
56
|
+
* onChange={(e) => onChange(e.target.value)}
|
|
57
|
+
* placeholder={placeholder}
|
|
58
|
+
* maxLength={maxChars}
|
|
59
|
+
* />
|
|
60
|
+
* )}
|
|
61
|
+
* </ProductModifiers.FreeText>
|
|
62
|
+
* )}
|
|
63
|
+
* </div>
|
|
64
|
+
* )}
|
|
65
|
+
* </ProductModifiers.Modifier>
|
|
66
|
+
* ))}
|
|
67
|
+
* {!areAllRequiredModifiersFilled && (
|
|
68
|
+
* <div className="warning">Please fill all required options</div>
|
|
69
|
+
* )}
|
|
70
|
+
* </div>
|
|
71
|
+
* )}
|
|
72
|
+
* </div>
|
|
73
|
+
* )}
|
|
74
|
+
* </ProductModifiers.Modifiers>
|
|
75
|
+
* </div>
|
|
76
|
+
* </ProductModifiers.Root>
|
|
77
|
+
* );
|
|
78
|
+
* }
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
export function Root(props) {
|
|
82
|
+
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(ProductModifiersServiceDefinition, ProductModifiersService, {}), children: props.children }));
|
|
83
|
+
}
|
|
5
84
|
/**
|
|
6
85
|
* Custom hook to safely get the modifiers service
|
|
7
86
|
*/
|
|
@@ -5,7 +5,6 @@ export * as Category from "./Category.js";
|
|
|
5
5
|
export * as FilteredCollection from "./FilteredCollection.js";
|
|
6
6
|
export * as ProductVariantSelector from "./ProductVariantSelector.js";
|
|
7
7
|
export * as RelatedProducts from "./RelatedProducts.js";
|
|
8
|
-
export * as SocialSharing from "./SocialSharing.js";
|
|
9
8
|
export * as Collection from "./Collection.js";
|
|
10
9
|
export * as Product from "./Product.js";
|
|
11
10
|
export * as ProductModifiers from "./ProductModifiers.js";
|
package/cjs/dist/react/index.js
CHANGED
|
@@ -5,7 +5,6 @@ export * as Category from "./Category.js";
|
|
|
5
5
|
export * as FilteredCollection from "./FilteredCollection.js";
|
|
6
6
|
export * as ProductVariantSelector from "./ProductVariantSelector.js";
|
|
7
7
|
export * as RelatedProducts from "./RelatedProducts.js";
|
|
8
|
-
export * as SocialSharing from "./SocialSharing.js";
|
|
9
8
|
export * as Collection from "./Collection.js";
|
|
10
9
|
export * as Product from "./Product.js";
|
|
11
10
|
export * as ProductModifiers from "./ProductModifiers.js";
|
|
@@ -6,6 +6,5 @@ export { ProductModifiersService, ProductModifiersServiceDefinition, } from "./p
|
|
|
6
6
|
export { ProductService, ProductServiceDefinition, loadProductServiceConfig, } from "./product-service.js";
|
|
7
7
|
export { RelatedProductsService, RelatedProductsServiceDefinition, loadRelatedProductsServiceConfig, } from "./related-products-service.js";
|
|
8
8
|
export { SelectedVariantService, SelectedVariantServiceDefinition, } from "./selected-variant-service.js";
|
|
9
|
-
export {
|
|
10
|
-
export { ProductListService, ProductsListServiceDefinition, loadProductsListServiceConfig } from "./products-list-service.js";
|
|
9
|
+
export { ProductListService, ProductsListServiceDefinition, loadProductsListServiceConfig, } from "./products-list-service.js";
|
|
11
10
|
export { SortService, SortServiceDefinition, SortBy } from "./sort-service.js";
|
|
@@ -16,6 +16,5 @@ export { ProductModifiersService, ProductModifiersServiceDefinition, } from "./p
|
|
|
16
16
|
export { ProductService, ProductServiceDefinition, loadProductServiceConfig, } from "./product-service.js";
|
|
17
17
|
export { RelatedProductsService, RelatedProductsServiceDefinition, loadRelatedProductsServiceConfig, } from "./related-products-service.js";
|
|
18
18
|
export { SelectedVariantService, SelectedVariantServiceDefinition, } from "./selected-variant-service.js";
|
|
19
|
-
export {
|
|
20
|
-
export { ProductListService, ProductsListServiceDefinition, loadProductsListServiceConfig } from "./products-list-service.js";
|
|
19
|
+
export { ProductListService, ProductsListServiceDefinition, loadProductsListServiceConfig, } from "./products-list-service.js";
|
|
21
20
|
export { SortService, SortServiceDefinition } from "./sort-service.js";
|
|
@@ -1,4 +1,80 @@
|
|
|
1
1
|
import { type ConnectedModifier, type ConnectedModifierChoice } from "@wix/auto_sdk_stores_products-v-3";
|
|
2
|
+
import type { PropsWithChildren } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Root component that provides the ProductModifiers service context to its children.
|
|
5
|
+
* This component sets up the necessary services for managing product modifier functionality.
|
|
6
|
+
*
|
|
7
|
+
* @order 1
|
|
8
|
+
* @component
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* import { ProductModifiers } from '@wix/stores/components';
|
|
12
|
+
*
|
|
13
|
+
* function ProductCustomization() {
|
|
14
|
+
* return (
|
|
15
|
+
* <ProductModifiers.Root>
|
|
16
|
+
* <div>
|
|
17
|
+
* <ProductModifiers.Modifiers>
|
|
18
|
+
* {({ modifiers, hasModifiers, selectedModifiers, areAllRequiredModifiersFilled }) => (
|
|
19
|
+
* <div>
|
|
20
|
+
* {hasModifiers && (
|
|
21
|
+
* <div>
|
|
22
|
+
* <h3>Customize your product</h3>
|
|
23
|
+
* {modifiers.map(modifier => (
|
|
24
|
+
* <ProductModifiers.Modifier key={modifier.id} modifier={modifier}>
|
|
25
|
+
* {({ name, mandatory, hasChoices, choices, isFreeText }) => (
|
|
26
|
+
* <div className="modifier-field">
|
|
27
|
+
* <label>
|
|
28
|
+
* {name} {mandatory && <span className="required">*</span>}
|
|
29
|
+
* </label>
|
|
30
|
+
* {hasChoices && (
|
|
31
|
+
* <div className="choices">
|
|
32
|
+
* {choices.map(choice => (
|
|
33
|
+
* <ProductModifiers.Choice key={choice.id} modifier={modifier} choice={choice}>
|
|
34
|
+
* {({ value, isSelected, onSelect }) => (
|
|
35
|
+
* <button
|
|
36
|
+
* onClick={onSelect}
|
|
37
|
+
* className={isSelected ? 'selected' : ''}
|
|
38
|
+
* >
|
|
39
|
+
* {value}
|
|
40
|
+
* </button>
|
|
41
|
+
* )}
|
|
42
|
+
* </ProductModifiers.Choice>
|
|
43
|
+
* ))}
|
|
44
|
+
* </div>
|
|
45
|
+
* )}
|
|
46
|
+
* {isFreeText && (
|
|
47
|
+
* <ProductModifiers.FreeText modifier={modifier}>
|
|
48
|
+
* {({ value, onChange, placeholder, maxChars }) => (
|
|
49
|
+
* <input
|
|
50
|
+
* type="text"
|
|
51
|
+
* value={value}
|
|
52
|
+
* onChange={(e) => onChange(e.target.value)}
|
|
53
|
+
* placeholder={placeholder}
|
|
54
|
+
* maxLength={maxChars}
|
|
55
|
+
* />
|
|
56
|
+
* )}
|
|
57
|
+
* </ProductModifiers.FreeText>
|
|
58
|
+
* )}
|
|
59
|
+
* </div>
|
|
60
|
+
* )}
|
|
61
|
+
* </ProductModifiers.Modifier>
|
|
62
|
+
* ))}
|
|
63
|
+
* {!areAllRequiredModifiersFilled && (
|
|
64
|
+
* <div className="warning">Please fill all required options</div>
|
|
65
|
+
* )}
|
|
66
|
+
* </div>
|
|
67
|
+
* )}
|
|
68
|
+
* </div>
|
|
69
|
+
* )}
|
|
70
|
+
* </ProductModifiers.Modifiers>
|
|
71
|
+
* </div>
|
|
72
|
+
* </ProductModifiers.Root>
|
|
73
|
+
* );
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export declare function Root(props: PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element;
|
|
2
78
|
/**
|
|
3
79
|
* Props for Modifiers headless component
|
|
4
80
|
*/
|
|
@@ -1,7 +1,86 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
import { useState } from "react";
|
|
2
|
-
import { useService } from "@wix/services-manager-react";
|
|
3
|
-
import { ProductModifiersServiceDefinition } from "../services/product-modifiers-service.js";
|
|
3
|
+
import { useService, WixServices } from "@wix/services-manager-react";
|
|
4
|
+
import { ProductModifiersServiceDefinition, ProductModifiersService, } from "../services/product-modifiers-service.js";
|
|
4
5
|
import { ModifierRenderType, } from "@wix/auto_sdk_stores_products-v-3";
|
|
6
|
+
import { createServicesMap } from "@wix/services-manager";
|
|
7
|
+
/**
|
|
8
|
+
* Root component that provides the ProductModifiers service context to its children.
|
|
9
|
+
* This component sets up the necessary services for managing product modifier functionality.
|
|
10
|
+
*
|
|
11
|
+
* @order 1
|
|
12
|
+
* @component
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* import { ProductModifiers } from '@wix/stores/components';
|
|
16
|
+
*
|
|
17
|
+
* function ProductCustomization() {
|
|
18
|
+
* return (
|
|
19
|
+
* <ProductModifiers.Root>
|
|
20
|
+
* <div>
|
|
21
|
+
* <ProductModifiers.Modifiers>
|
|
22
|
+
* {({ modifiers, hasModifiers, selectedModifiers, areAllRequiredModifiersFilled }) => (
|
|
23
|
+
* <div>
|
|
24
|
+
* {hasModifiers && (
|
|
25
|
+
* <div>
|
|
26
|
+
* <h3>Customize your product</h3>
|
|
27
|
+
* {modifiers.map(modifier => (
|
|
28
|
+
* <ProductModifiers.Modifier key={modifier.id} modifier={modifier}>
|
|
29
|
+
* {({ name, mandatory, hasChoices, choices, isFreeText }) => (
|
|
30
|
+
* <div className="modifier-field">
|
|
31
|
+
* <label>
|
|
32
|
+
* {name} {mandatory && <span className="required">*</span>}
|
|
33
|
+
* </label>
|
|
34
|
+
* {hasChoices && (
|
|
35
|
+
* <div className="choices">
|
|
36
|
+
* {choices.map(choice => (
|
|
37
|
+
* <ProductModifiers.Choice key={choice.id} modifier={modifier} choice={choice}>
|
|
38
|
+
* {({ value, isSelected, onSelect }) => (
|
|
39
|
+
* <button
|
|
40
|
+
* onClick={onSelect}
|
|
41
|
+
* className={isSelected ? 'selected' : ''}
|
|
42
|
+
* >
|
|
43
|
+
* {value}
|
|
44
|
+
* </button>
|
|
45
|
+
* )}
|
|
46
|
+
* </ProductModifiers.Choice>
|
|
47
|
+
* ))}
|
|
48
|
+
* </div>
|
|
49
|
+
* )}
|
|
50
|
+
* {isFreeText && (
|
|
51
|
+
* <ProductModifiers.FreeText modifier={modifier}>
|
|
52
|
+
* {({ value, onChange, placeholder, maxChars }) => (
|
|
53
|
+
* <input
|
|
54
|
+
* type="text"
|
|
55
|
+
* value={value}
|
|
56
|
+
* onChange={(e) => onChange(e.target.value)}
|
|
57
|
+
* placeholder={placeholder}
|
|
58
|
+
* maxLength={maxChars}
|
|
59
|
+
* />
|
|
60
|
+
* )}
|
|
61
|
+
* </ProductModifiers.FreeText>
|
|
62
|
+
* )}
|
|
63
|
+
* </div>
|
|
64
|
+
* )}
|
|
65
|
+
* </ProductModifiers.Modifier>
|
|
66
|
+
* ))}
|
|
67
|
+
* {!areAllRequiredModifiersFilled && (
|
|
68
|
+
* <div className="warning">Please fill all required options</div>
|
|
69
|
+
* )}
|
|
70
|
+
* </div>
|
|
71
|
+
* )}
|
|
72
|
+
* </div>
|
|
73
|
+
* )}
|
|
74
|
+
* </ProductModifiers.Modifiers>
|
|
75
|
+
* </div>
|
|
76
|
+
* </ProductModifiers.Root>
|
|
77
|
+
* );
|
|
78
|
+
* }
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
export function Root(props) {
|
|
82
|
+
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(ProductModifiersServiceDefinition, ProductModifiersService, {}), children: props.children }));
|
|
83
|
+
}
|
|
5
84
|
/**
|
|
6
85
|
* Custom hook to safely get the modifiers service
|
|
7
86
|
*/
|
package/dist/react/index.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ export * as Category from "./Category.js";
|
|
|
5
5
|
export * as FilteredCollection from "./FilteredCollection.js";
|
|
6
6
|
export * as ProductVariantSelector from "./ProductVariantSelector.js";
|
|
7
7
|
export * as RelatedProducts from "./RelatedProducts.js";
|
|
8
|
-
export * as SocialSharing from "./SocialSharing.js";
|
|
9
8
|
export * as Collection from "./Collection.js";
|
|
10
9
|
export * as Product from "./Product.js";
|
|
11
10
|
export * as ProductModifiers from "./ProductModifiers.js";
|
package/dist/react/index.js
CHANGED
|
@@ -5,7 +5,6 @@ export * as Category from "./Category.js";
|
|
|
5
5
|
export * as FilteredCollection from "./FilteredCollection.js";
|
|
6
6
|
export * as ProductVariantSelector from "./ProductVariantSelector.js";
|
|
7
7
|
export * as RelatedProducts from "./RelatedProducts.js";
|
|
8
|
-
export * as SocialSharing from "./SocialSharing.js";
|
|
9
8
|
export * as Collection from "./Collection.js";
|
|
10
9
|
export * as Product from "./Product.js";
|
|
11
10
|
export * as ProductModifiers from "./ProductModifiers.js";
|
package/dist/services/index.d.ts
CHANGED
|
@@ -6,6 +6,5 @@ export { ProductModifiersService, ProductModifiersServiceDefinition, } from "./p
|
|
|
6
6
|
export { ProductService, ProductServiceDefinition, loadProductServiceConfig, } from "./product-service.js";
|
|
7
7
|
export { RelatedProductsService, RelatedProductsServiceDefinition, loadRelatedProductsServiceConfig, } from "./related-products-service.js";
|
|
8
8
|
export { SelectedVariantService, SelectedVariantServiceDefinition, } from "./selected-variant-service.js";
|
|
9
|
-
export {
|
|
10
|
-
export { ProductListService, ProductsListServiceDefinition, loadProductsListServiceConfig } from "./products-list-service.js";
|
|
9
|
+
export { ProductListService, ProductsListServiceDefinition, loadProductsListServiceConfig, } from "./products-list-service.js";
|
|
11
10
|
export { SortService, SortServiceDefinition, SortBy } from "./sort-service.js";
|
package/dist/services/index.js
CHANGED
|
@@ -16,6 +16,5 @@ export { ProductModifiersService, ProductModifiersServiceDefinition, } from "./p
|
|
|
16
16
|
export { ProductService, ProductServiceDefinition, loadProductServiceConfig, } from "./product-service.js";
|
|
17
17
|
export { RelatedProductsService, RelatedProductsServiceDefinition, loadRelatedProductsServiceConfig, } from "./related-products-service.js";
|
|
18
18
|
export { SelectedVariantService, SelectedVariantServiceDefinition, } from "./selected-variant-service.js";
|
|
19
|
-
export {
|
|
20
|
-
export { ProductListService, ProductsListServiceDefinition, loadProductsListServiceConfig } from "./products-list-service.js";
|
|
19
|
+
export { ProductListService, ProductsListServiceDefinition, loadProductsListServiceConfig, } from "./products-list-service.js";
|
|
21
20
|
export { SortService, SortServiceDefinition } from "./sort-service.js";
|
package/package.json
CHANGED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { type SharingPlatform } from "../services/social-sharing-service.js";
|
|
3
|
-
/**
|
|
4
|
-
* Props for Root headless component
|
|
5
|
-
*/
|
|
6
|
-
export interface RootProps {
|
|
7
|
-
/** Render prop function that receives sharing data */
|
|
8
|
-
children: (props: RootRenderProps) => React.ReactNode;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Render props for Root component
|
|
12
|
-
*/
|
|
13
|
-
export interface RootRenderProps {
|
|
14
|
-
/** Available sharing platforms */
|
|
15
|
-
platforms: SharingPlatform[];
|
|
16
|
-
/** Total share count */
|
|
17
|
-
shareCount: number;
|
|
18
|
-
/** Last shared platform */
|
|
19
|
-
lastShared: string | null;
|
|
20
|
-
/** Share to Facebook */
|
|
21
|
-
shareFacebook: (url: string, title: string, description?: string) => void;
|
|
22
|
-
/** Share to Twitter */
|
|
23
|
-
shareTwitter: (url: string, text: string, hashtags?: string[]) => void;
|
|
24
|
-
/** Share to LinkedIn */
|
|
25
|
-
shareLinkedIn: (url: string, title: string, summary?: string) => void;
|
|
26
|
-
/** Share to WhatsApp */
|
|
27
|
-
shareWhatsApp: (url: string, text: string) => void;
|
|
28
|
-
/** Share via Email */
|
|
29
|
-
shareEmail: (url: string, subject: string, body: string) => void;
|
|
30
|
-
/** Copy to clipboard */
|
|
31
|
-
copyLink: (url: string) => Promise<boolean>;
|
|
32
|
-
/** Native share API */
|
|
33
|
-
shareNative: (data: {
|
|
34
|
-
title: string;
|
|
35
|
-
text: string;
|
|
36
|
-
url: string;
|
|
37
|
-
}) => Promise<boolean>;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Headless component for social sharing root
|
|
41
|
-
*
|
|
42
|
-
* @component
|
|
43
|
-
* @example
|
|
44
|
-
* ```tsx
|
|
45
|
-
* import { SocialSharing } from '@wix/stores/components';
|
|
46
|
-
*
|
|
47
|
-
* function ShareProduct() {
|
|
48
|
-
* const productUrl = 'https://example.com/product/123';
|
|
49
|
-
* const productTitle = 'Amazing Product';
|
|
50
|
-
*
|
|
51
|
-
* return (
|
|
52
|
-
* <SocialSharing.Root>
|
|
53
|
-
* {({ platforms, shareCount, shareFacebook, shareTwitter, copyLink, shareNative }) => (
|
|
54
|
-
* <div>
|
|
55
|
-
* <p>Share this product ({shareCount} shares)</p>
|
|
56
|
-
* <div className="share-buttons">
|
|
57
|
-
* <button onClick={() => shareFacebook(productUrl, productTitle)}>
|
|
58
|
-
* Share on Facebook
|
|
59
|
-
* </button>
|
|
60
|
-
* <button onClick={() => shareTwitter(productUrl, `Check out ${productTitle}!`)}>
|
|
61
|
-
* Share on Twitter
|
|
62
|
-
* </button>
|
|
63
|
-
* <button onClick={() => copyLink(productUrl)}>
|
|
64
|
-
* Copy Link
|
|
65
|
-
* </button>
|
|
66
|
-
* <button onClick={() => shareNative({
|
|
67
|
-
* title: productTitle,
|
|
68
|
-
* text: 'Check this out!',
|
|
69
|
-
* url: productUrl
|
|
70
|
-
* })}>
|
|
71
|
-
* Share
|
|
72
|
-
* </button>
|
|
73
|
-
* </div>
|
|
74
|
-
* </div>
|
|
75
|
-
* )}
|
|
76
|
-
* </SocialSharing.Root>
|
|
77
|
-
* );
|
|
78
|
-
* }
|
|
79
|
-
* ```
|
|
80
|
-
*/
|
|
81
|
-
export declare const Root: (props: RootProps) => React.ReactNode;
|
|
82
|
-
/**
|
|
83
|
-
* Props for Platform headless component
|
|
84
|
-
*/
|
|
85
|
-
export interface PlatformProps {
|
|
86
|
-
/** Platform data */
|
|
87
|
-
platform: SharingPlatform;
|
|
88
|
-
/** Click handler */
|
|
89
|
-
onClick: () => void;
|
|
90
|
-
/** Render prop function that receives platform data */
|
|
91
|
-
children: (props: PlatformRenderProps) => React.ReactNode;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Render props for Platform component
|
|
95
|
-
*/
|
|
96
|
-
export interface PlatformRenderProps {
|
|
97
|
-
/** Platform data */
|
|
98
|
-
platform: SharingPlatform;
|
|
99
|
-
/** Platform click handler */
|
|
100
|
-
onSelect: () => void;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Headless component for individual social platform
|
|
104
|
-
*
|
|
105
|
-
* @component
|
|
106
|
-
* @example
|
|
107
|
-
* ```tsx
|
|
108
|
-
* import { SocialSharing } from '@wix/stores/components';
|
|
109
|
-
*
|
|
110
|
-
* function SocialButton({ platform, onClick }) {
|
|
111
|
-
* return (
|
|
112
|
-
* <SocialSharing.Platform platform={platform} onClick={onClick}>
|
|
113
|
-
* {({ platform, onSelect }) => (
|
|
114
|
-
* <button
|
|
115
|
-
* onClick={onSelect}
|
|
116
|
-
* className={`social-btn social-btn-${platform.name.toLowerCase()}`}
|
|
117
|
-
* >
|
|
118
|
-
* <span className="icon">{platform.icon}</span>
|
|
119
|
-
* Share on {platform.name}
|
|
120
|
-
* </button>
|
|
121
|
-
* )}
|
|
122
|
-
* </SocialSharing.Platform>
|
|
123
|
-
* );
|
|
124
|
-
* }
|
|
125
|
-
* ```
|
|
126
|
-
*/
|
|
127
|
-
export declare const Platform: (props: PlatformProps) => React.ReactNode;
|
|
128
|
-
/**
|
|
129
|
-
* Props for Platforms headless component
|
|
130
|
-
*/
|
|
131
|
-
export interface PlatformsProps {
|
|
132
|
-
/** URL to share */
|
|
133
|
-
url: string;
|
|
134
|
-
/** Share title */
|
|
135
|
-
title: string;
|
|
136
|
-
/** Share description */
|
|
137
|
-
description?: string;
|
|
138
|
-
/** Hashtags for sharing */
|
|
139
|
-
hashtags?: string[];
|
|
140
|
-
/** Render prop function that receives platforms data */
|
|
141
|
-
children: (props: PlatformsRenderProps) => React.ReactNode;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Render props for Platforms component
|
|
145
|
-
*/
|
|
146
|
-
export interface PlatformsRenderProps {
|
|
147
|
-
/** Available platforms */
|
|
148
|
-
platforms: SharingPlatform[];
|
|
149
|
-
/** Share to Facebook */
|
|
150
|
-
shareFacebook: () => void;
|
|
151
|
-
/** Share to Twitter */
|
|
152
|
-
shareTwitter: () => void;
|
|
153
|
-
/** Share to LinkedIn */
|
|
154
|
-
shareLinkedIn: () => void;
|
|
155
|
-
/** Share to WhatsApp */
|
|
156
|
-
shareWhatsApp: () => void;
|
|
157
|
-
/** Share via Email */
|
|
158
|
-
shareEmail: () => void;
|
|
159
|
-
/** Copy link to clipboard */
|
|
160
|
-
copyLink: () => Promise<boolean>;
|
|
161
|
-
/** Share natively */
|
|
162
|
-
shareNative: () => Promise<boolean>;
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Headless component for social sharing platforms with logic
|
|
166
|
-
*
|
|
167
|
-
* @component
|
|
168
|
-
* @example
|
|
169
|
-
* ```tsx
|
|
170
|
-
* import { SocialSharing } from '@wix/stores/components';
|
|
171
|
-
*
|
|
172
|
-
* function SocialShareButtons() {
|
|
173
|
-
* return (
|
|
174
|
-
* <SocialSharing.Platforms
|
|
175
|
-
* url="https://example.com/product/123"
|
|
176
|
-
* title="Amazing Product"
|
|
177
|
-
* description="Check out this amazing product!"
|
|
178
|
-
* hashtags={['product', 'amazing']}
|
|
179
|
-
* >
|
|
180
|
-
* {({ platforms, shareFacebook, shareTwitter, shareLinkedIn, copyLink, shareNative }) => (
|
|
181
|
-
* <div className="social-platforms">
|
|
182
|
-
* <button onClick={shareFacebook}>Share on Facebook</button>
|
|
183
|
-
* <button onClick={shareTwitter}>Share on Twitter</button>
|
|
184
|
-
* <button onClick={shareLinkedIn}>Share on LinkedIn</button>
|
|
185
|
-
* <button onClick={() => copyLink()}>Copy Link</button>
|
|
186
|
-
* <button onClick={() => shareNative()}>Share</button>
|
|
187
|
-
* </div>
|
|
188
|
-
* )}
|
|
189
|
-
* </SocialSharing.Platforms>
|
|
190
|
-
* );
|
|
191
|
-
* }
|
|
192
|
-
* ```
|
|
193
|
-
*/
|
|
194
|
-
export declare const Platforms: (props: PlatformsProps) => React.ReactNode;
|