@wix/stores 1.0.979 → 1.0.980
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/build/cjs/context-category-by-id.d.ts +4 -0
- package/build/cjs/context-category-by-id.js +1 -1
- package/build/cjs/context-category-by-id.js.map +1 -1
- package/build/cjs/context-category-by-slug.d.ts +4 -0
- package/build/cjs/context-category-by-slug.js +1 -1
- package/build/cjs/context-category-by-slug.js.map +1 -1
- package/build/cjs/context-product-by-id.d.ts +5 -0
- package/build/cjs/context-product-by-id.js +2 -2
- package/build/cjs/context-product-by-id.js.map +1 -1
- package/build/cjs/context-product-by-slug.d.ts +5 -0
- package/build/cjs/context-product-by-slug.js +2 -2
- package/build/cjs/context-product-by-slug.js.map +1 -1
- package/build/cjs/context-product-item.d.ts +5 -0
- package/build/cjs/context-product-item.js +1 -1
- package/build/cjs/context-product-item.js.map +1 -1
- package/build/cjs/context-product-list.d.ts +4 -0
- package/build/cjs/context-product.d.ts +21 -0
- package/build/es/context-category-by-id.d.mts +4 -0
- package/build/es/context-category-by-id.mjs +1 -1
- package/build/es/context-category-by-id.mjs.map +1 -1
- package/build/es/context-category-by-slug.d.mts +4 -0
- package/build/es/context-category-by-slug.mjs +1 -1
- package/build/es/context-category-by-slug.mjs.map +1 -1
- package/build/es/context-product-by-id.d.mts +5 -0
- package/build/es/context-product-by-id.mjs +2 -2
- package/build/es/context-product-by-id.mjs.map +1 -1
- package/build/es/context-product-by-slug.d.mts +5 -0
- package/build/es/context-product-by-slug.mjs +2 -2
- package/build/es/context-product-by-slug.mjs.map +1 -1
- package/build/es/context-product-item.d.mts +5 -0
- package/build/es/context-product-item.mjs +1 -1
- package/build/es/context-product-item.mjs.map +1 -1
- package/build/es/context-product-list.d.mts +4 -0
- package/build/es/context-product.d.mts +21 -0
- package/build/internal/cjs/context-category-by-id.d.ts +4 -0
- package/build/internal/cjs/context-category-by-slug.d.ts +4 -0
- package/build/internal/cjs/context-product-by-id.d.ts +5 -0
- package/build/internal/cjs/context-product-by-slug.d.ts +5 -0
- package/build/internal/cjs/context-product-item.d.ts +5 -0
- package/build/internal/cjs/context-product-list.d.ts +4 -0
- package/build/internal/cjs/context-product.d.ts +21 -0
- package/build/internal/es/context-category-by-id.d.mts +4 -0
- package/build/internal/es/context-category-by-slug.d.mts +4 -0
- package/build/internal/es/context-product-by-id.d.mts +5 -0
- package/build/internal/es/context-product-by-slug.d.mts +5 -0
- package/build/internal/es/context-product-item.d.mts +5 -0
- package/build/internal/es/context-product-list.d.mts +4 -0
- package/build/internal/es/context-product.d.mts +21 -0
- package/context-runtime/context-category-by-id/runtime.d.ts +4 -0
- package/context-runtime/context-category-by-id/runtime.js +2 -2
- package/context-runtime/context-category-by-slug/runtime.d.ts +4 -0
- package/context-runtime/context-category-by-slug/runtime.js +2 -2
- package/context-runtime/context-product/runtime.d.ts +21 -0
- package/context-runtime/context-product-by-id/runtime.d.ts +5 -0
- package/context-runtime/context-product-by-id/runtime.js +2 -2
- package/context-runtime/context-product-by-slug/runtime.d.ts +5 -0
- package/context-runtime/context-product-by-slug/runtime.js +2 -2
- package/context-runtime/context-product-item/runtime.d.ts +5 -0
- package/context-runtime/context-product-item/runtime.js +2 -2
- package/context-runtime/context-product-list/runtime.d.ts +4 -0
- package/package.json +2 -2
|
@@ -3765,6 +3765,9 @@ interface ProductPriceRange {
|
|
|
3765
3765
|
minCompareAtPrice?: number;
|
|
3766
3766
|
maxCompareAtPrice?: number;
|
|
3767
3767
|
}
|
|
3768
|
+
interface ProductExtendedFields {
|
|
3769
|
+
namespaces: Record<string, Record<string, unknown>>;
|
|
3770
|
+
}
|
|
3768
3771
|
interface Product {
|
|
3769
3772
|
id: string;
|
|
3770
3773
|
slug?: string;
|
|
@@ -3788,6 +3791,7 @@ interface Product {
|
|
|
3788
3791
|
inventory: ProductInventory;
|
|
3789
3792
|
discountRuleNames?: DiscountInfo['discountRuleNames'];
|
|
3790
3793
|
productGroupId?: string;
|
|
3794
|
+
extendedFields: ProductExtendedFields;
|
|
3791
3795
|
}
|
|
3792
3796
|
//#endregion
|
|
3793
3797
|
//#region src/api/product-groups/product-groups.d.ts
|
|
@@ -3847,6 +3847,9 @@ interface ProductCategory {
|
|
|
3847
3847
|
*/
|
|
3848
3848
|
id: string;
|
|
3849
3849
|
}
|
|
3850
|
+
interface ProductExtendedFields {
|
|
3851
|
+
namespaces: Record<string, Record<string, unknown>>;
|
|
3852
|
+
}
|
|
3850
3853
|
//#endregion
|
|
3851
3854
|
//#region src/extensions/product/providers/selectors/validate-user-input/validate-user-input.d.ts
|
|
3852
3855
|
/** Why the selected quantity isn't valid. */
|
|
@@ -3970,6 +3973,24 @@ interface ProductContextValue {
|
|
|
3970
3973
|
source: ProductContextSource;
|
|
3971
3974
|
/** Product's display name. */
|
|
3972
3975
|
name: string;
|
|
3976
|
+
/**
|
|
3977
|
+
* Custom product fields returned by the API, grouped by namespace: `_user_fields` for
|
|
3978
|
+
* site-defined fields and app namespaces for app-defined fields. Includes only fields the
|
|
3979
|
+
* caller has permission to read. `namespaces` is empty when no extended fields are returned.
|
|
3980
|
+
*
|
|
3981
|
+
* Available through this hook only, without editor bindings. Values are `unknown` because
|
|
3982
|
+
* each namespace has its own schema; validate them before use.
|
|
3983
|
+
*
|
|
3984
|
+
* @example Read a field from an app namespace
|
|
3985
|
+
* ```tsx
|
|
3986
|
+
* const { extendedFields } = useProductContext();
|
|
3987
|
+
* const warranty = extendedFields.namespaces['@my-app/products']?.warranty;
|
|
3988
|
+
* if (typeof warranty === 'string') {
|
|
3989
|
+
* return <span>{warranty}</span>;
|
|
3990
|
+
* }
|
|
3991
|
+
* ```
|
|
3992
|
+
*/
|
|
3993
|
+
extendedFields: ProductExtendedFields;
|
|
3973
3994
|
/** Link to the product's page */
|
|
3974
3995
|
link: Link$1 | undefined;
|
|
3975
3996
|
/**
|
|
@@ -3873,6 +3873,9 @@ interface ProductPriceRange {
|
|
|
3873
3873
|
minCompareAtPrice?: number;
|
|
3874
3874
|
maxCompareAtPrice?: number;
|
|
3875
3875
|
}
|
|
3876
|
+
interface ProductExtendedFields {
|
|
3877
|
+
namespaces: Record<string, Record<string, unknown>>;
|
|
3878
|
+
}
|
|
3876
3879
|
interface Product {
|
|
3877
3880
|
id: string;
|
|
3878
3881
|
slug?: string;
|
|
@@ -3896,6 +3899,7 @@ interface Product {
|
|
|
3896
3899
|
inventory: ProductInventory;
|
|
3897
3900
|
discountRuleNames?: DiscountInfo['discountRuleNames'];
|
|
3898
3901
|
productGroupId?: string;
|
|
3902
|
+
extendedFields: ProductExtendedFields;
|
|
3899
3903
|
}
|
|
3900
3904
|
//#endregion
|
|
3901
3905
|
//#region src/extensions/gallery/providers/selectors/filter-selection/filter-selection.d.ts
|
|
@@ -3874,6 +3874,9 @@ interface ProductPriceRange {
|
|
|
3874
3874
|
minCompareAtPrice?: number;
|
|
3875
3875
|
maxCompareAtPrice?: number;
|
|
3876
3876
|
}
|
|
3877
|
+
interface ProductExtendedFields {
|
|
3878
|
+
namespaces: Record<string, Record<string, unknown>>;
|
|
3879
|
+
}
|
|
3877
3880
|
interface Product {
|
|
3878
3881
|
id: string;
|
|
3879
3882
|
slug?: string;
|
|
@@ -3897,6 +3900,7 @@ interface Product {
|
|
|
3897
3900
|
inventory: ProductInventory;
|
|
3898
3901
|
discountRuleNames?: DiscountInfo['discountRuleNames'];
|
|
3899
3902
|
productGroupId?: string;
|
|
3903
|
+
extendedFields: ProductExtendedFields;
|
|
3900
3904
|
}
|
|
3901
3905
|
//#endregion
|
|
3902
3906
|
//#region src/extensions/gallery/providers/selectors/filter-selection/filter-selection.d.ts
|
|
@@ -3946,6 +3946,9 @@ interface ProductPriceRange {
|
|
|
3946
3946
|
minCompareAtPrice?: number;
|
|
3947
3947
|
maxCompareAtPrice?: number;
|
|
3948
3948
|
}
|
|
3949
|
+
interface ProductExtendedFields {
|
|
3950
|
+
namespaces: Record<string, Record<string, unknown>>;
|
|
3951
|
+
}
|
|
3949
3952
|
interface Product {
|
|
3950
3953
|
id: string;
|
|
3951
3954
|
slug?: string;
|
|
@@ -3969,6 +3972,7 @@ interface Product {
|
|
|
3969
3972
|
inventory: ProductInventory;
|
|
3970
3973
|
discountRuleNames?: DiscountInfo['discountRuleNames'];
|
|
3971
3974
|
productGroupId?: string;
|
|
3975
|
+
extendedFields: ProductExtendedFields;
|
|
3972
3976
|
}
|
|
3973
3977
|
//#endregion
|
|
3974
3978
|
//#region src/extensions/product/providers/selectors/validate-user-input/validate-user-input.d.ts
|
|
@@ -4216,6 +4220,7 @@ declare function useStandaloneProductContextValue({
|
|
|
4216
4220
|
discountRules: {
|
|
4217
4221
|
name: string;
|
|
4218
4222
|
}[] | undefined;
|
|
4223
|
+
extendedFields: ProductExtendedFields;
|
|
4219
4224
|
};
|
|
4220
4225
|
//#endregion
|
|
4221
4226
|
//#region src/extensions/product/providers/product-by-id-context/product-by-id-context-provider.d.ts
|
|
@@ -3946,6 +3946,9 @@ interface ProductPriceRange {
|
|
|
3946
3946
|
minCompareAtPrice?: number;
|
|
3947
3947
|
maxCompareAtPrice?: number;
|
|
3948
3948
|
}
|
|
3949
|
+
interface ProductExtendedFields {
|
|
3950
|
+
namespaces: Record<string, Record<string, unknown>>;
|
|
3951
|
+
}
|
|
3949
3952
|
interface Product {
|
|
3950
3953
|
id: string;
|
|
3951
3954
|
slug?: string;
|
|
@@ -3969,6 +3972,7 @@ interface Product {
|
|
|
3969
3972
|
inventory: ProductInventory;
|
|
3970
3973
|
discountRuleNames?: DiscountInfo['discountRuleNames'];
|
|
3971
3974
|
productGroupId?: string;
|
|
3975
|
+
extendedFields: ProductExtendedFields;
|
|
3972
3976
|
}
|
|
3973
3977
|
//#endregion
|
|
3974
3978
|
//#region src/extensions/product/providers/selectors/validate-user-input/validate-user-input.d.ts
|
|
@@ -4216,6 +4220,7 @@ declare function useStandaloneProductContextValue({
|
|
|
4216
4220
|
discountRules: {
|
|
4217
4221
|
name: string;
|
|
4218
4222
|
}[] | undefined;
|
|
4223
|
+
extendedFields: ProductExtendedFields;
|
|
4219
4224
|
};
|
|
4220
4225
|
//#endregion
|
|
4221
4226
|
//#region src/extensions/product/providers/product-by-slug-context/product-by-slug-context-provider.d.ts
|
|
@@ -3931,6 +3931,9 @@ interface ProductPriceRange {
|
|
|
3931
3931
|
minCompareAtPrice?: number;
|
|
3932
3932
|
maxCompareAtPrice?: number;
|
|
3933
3933
|
}
|
|
3934
|
+
interface ProductExtendedFields {
|
|
3935
|
+
namespaces: Record<string, Record<string, unknown>>;
|
|
3936
|
+
}
|
|
3934
3937
|
interface Product {
|
|
3935
3938
|
id: string;
|
|
3936
3939
|
slug?: string;
|
|
@@ -3954,6 +3957,7 @@ interface Product {
|
|
|
3954
3957
|
inventory: ProductInventory;
|
|
3955
3958
|
discountRuleNames?: DiscountInfo['discountRuleNames'];
|
|
3956
3959
|
productGroupId?: string;
|
|
3960
|
+
extendedFields: ProductExtendedFields;
|
|
3957
3961
|
}
|
|
3958
3962
|
//#endregion
|
|
3959
3963
|
//#region src/extensions/product/providers/selectors/validate-user-input/validate-user-input.d.ts
|
|
@@ -4133,6 +4137,7 @@ declare function useProductItemContextValue({
|
|
|
4133
4137
|
discountRules: {
|
|
4134
4138
|
name: string;
|
|
4135
4139
|
}[] | undefined;
|
|
4140
|
+
extendedFields: ProductExtendedFields;
|
|
4136
4141
|
source: ProductContextSource;
|
|
4137
4142
|
};
|
|
4138
4143
|
type ProductItemContextImplementation = ReturnType<typeof useProductItemContextValue>;
|
|
@@ -3765,6 +3765,9 @@ interface ProductPriceRange {
|
|
|
3765
3765
|
minCompareAtPrice?: number;
|
|
3766
3766
|
maxCompareAtPrice?: number;
|
|
3767
3767
|
}
|
|
3768
|
+
interface ProductExtendedFields {
|
|
3769
|
+
namespaces: Record<string, Record<string, unknown>>;
|
|
3770
|
+
}
|
|
3768
3771
|
interface Product {
|
|
3769
3772
|
id: string;
|
|
3770
3773
|
slug?: string;
|
|
@@ -3788,6 +3791,7 @@ interface Product {
|
|
|
3788
3791
|
inventory: ProductInventory;
|
|
3789
3792
|
discountRuleNames?: DiscountInfo['discountRuleNames'];
|
|
3790
3793
|
productGroupId?: string;
|
|
3794
|
+
extendedFields: ProductExtendedFields;
|
|
3791
3795
|
}
|
|
3792
3796
|
//#endregion
|
|
3793
3797
|
//#region src/api/product-groups/product-groups.d.ts
|
|
@@ -3847,6 +3847,9 @@ interface ProductCategory {
|
|
|
3847
3847
|
*/
|
|
3848
3848
|
id: string;
|
|
3849
3849
|
}
|
|
3850
|
+
interface ProductExtendedFields {
|
|
3851
|
+
namespaces: Record<string, Record<string, unknown>>;
|
|
3852
|
+
}
|
|
3850
3853
|
//#endregion
|
|
3851
3854
|
//#region src/extensions/product/providers/selectors/validate-user-input/validate-user-input.d.ts
|
|
3852
3855
|
/** Why the selected quantity isn't valid. */
|
|
@@ -3970,6 +3973,24 @@ interface ProductContextValue {
|
|
|
3970
3973
|
source: ProductContextSource;
|
|
3971
3974
|
/** Product's display name. */
|
|
3972
3975
|
name: string;
|
|
3976
|
+
/**
|
|
3977
|
+
* Custom product fields returned by the API, grouped by namespace: `_user_fields` for
|
|
3978
|
+
* site-defined fields and app namespaces for app-defined fields. Includes only fields the
|
|
3979
|
+
* caller has permission to read. `namespaces` is empty when no extended fields are returned.
|
|
3980
|
+
*
|
|
3981
|
+
* Available through this hook only, without editor bindings. Values are `unknown` because
|
|
3982
|
+
* each namespace has its own schema; validate them before use.
|
|
3983
|
+
*
|
|
3984
|
+
* @example Read a field from an app namespace
|
|
3985
|
+
* ```tsx
|
|
3986
|
+
* const { extendedFields } = useProductContext();
|
|
3987
|
+
* const warranty = extendedFields.namespaces['@my-app/products']?.warranty;
|
|
3988
|
+
* if (typeof warranty === 'string') {
|
|
3989
|
+
* return <span>{warranty}</span>;
|
|
3990
|
+
* }
|
|
3991
|
+
* ```
|
|
3992
|
+
*/
|
|
3993
|
+
extendedFields: ProductExtendedFields;
|
|
3973
3994
|
/** Link to the product's page */
|
|
3974
3995
|
link: Link$1 | undefined;
|
|
3975
3996
|
/**
|
|
@@ -3873,6 +3873,9 @@ interface ProductPriceRange {
|
|
|
3873
3873
|
minCompareAtPrice?: number;
|
|
3874
3874
|
maxCompareAtPrice?: number;
|
|
3875
3875
|
}
|
|
3876
|
+
interface ProductExtendedFields {
|
|
3877
|
+
namespaces: Record<string, Record<string, unknown>>;
|
|
3878
|
+
}
|
|
3876
3879
|
interface Product {
|
|
3877
3880
|
id: string;
|
|
3878
3881
|
slug?: string;
|
|
@@ -3896,6 +3899,7 @@ interface Product {
|
|
|
3896
3899
|
inventory: ProductInventory;
|
|
3897
3900
|
discountRuleNames?: DiscountInfo['discountRuleNames'];
|
|
3898
3901
|
productGroupId?: string;
|
|
3902
|
+
extendedFields: ProductExtendedFields;
|
|
3899
3903
|
}
|
|
3900
3904
|
//#endregion
|
|
3901
3905
|
//#region src/extensions/gallery/providers/selectors/filter-selection/filter-selection.d.ts
|
|
@@ -3874,6 +3874,9 @@ interface ProductPriceRange {
|
|
|
3874
3874
|
minCompareAtPrice?: number;
|
|
3875
3875
|
maxCompareAtPrice?: number;
|
|
3876
3876
|
}
|
|
3877
|
+
interface ProductExtendedFields {
|
|
3878
|
+
namespaces: Record<string, Record<string, unknown>>;
|
|
3879
|
+
}
|
|
3877
3880
|
interface Product {
|
|
3878
3881
|
id: string;
|
|
3879
3882
|
slug?: string;
|
|
@@ -3897,6 +3900,7 @@ interface Product {
|
|
|
3897
3900
|
inventory: ProductInventory;
|
|
3898
3901
|
discountRuleNames?: DiscountInfo['discountRuleNames'];
|
|
3899
3902
|
productGroupId?: string;
|
|
3903
|
+
extendedFields: ProductExtendedFields;
|
|
3900
3904
|
}
|
|
3901
3905
|
//#endregion
|
|
3902
3906
|
//#region src/extensions/gallery/providers/selectors/filter-selection/filter-selection.d.ts
|
|
@@ -3946,6 +3946,9 @@ interface ProductPriceRange {
|
|
|
3946
3946
|
minCompareAtPrice?: number;
|
|
3947
3947
|
maxCompareAtPrice?: number;
|
|
3948
3948
|
}
|
|
3949
|
+
interface ProductExtendedFields {
|
|
3950
|
+
namespaces: Record<string, Record<string, unknown>>;
|
|
3951
|
+
}
|
|
3949
3952
|
interface Product {
|
|
3950
3953
|
id: string;
|
|
3951
3954
|
slug?: string;
|
|
@@ -3969,6 +3972,7 @@ interface Product {
|
|
|
3969
3972
|
inventory: ProductInventory;
|
|
3970
3973
|
discountRuleNames?: DiscountInfo['discountRuleNames'];
|
|
3971
3974
|
productGroupId?: string;
|
|
3975
|
+
extendedFields: ProductExtendedFields;
|
|
3972
3976
|
}
|
|
3973
3977
|
//#endregion
|
|
3974
3978
|
//#region src/extensions/product/providers/selectors/validate-user-input/validate-user-input.d.ts
|
|
@@ -4216,6 +4220,7 @@ declare function useStandaloneProductContextValue({
|
|
|
4216
4220
|
discountRules: {
|
|
4217
4221
|
name: string;
|
|
4218
4222
|
}[] | undefined;
|
|
4223
|
+
extendedFields: ProductExtendedFields;
|
|
4219
4224
|
};
|
|
4220
4225
|
//#endregion
|
|
4221
4226
|
//#region src/extensions/product/providers/product-by-id-context/product-by-id-context-provider.d.ts
|
|
@@ -3946,6 +3946,9 @@ interface ProductPriceRange {
|
|
|
3946
3946
|
minCompareAtPrice?: number;
|
|
3947
3947
|
maxCompareAtPrice?: number;
|
|
3948
3948
|
}
|
|
3949
|
+
interface ProductExtendedFields {
|
|
3950
|
+
namespaces: Record<string, Record<string, unknown>>;
|
|
3951
|
+
}
|
|
3949
3952
|
interface Product {
|
|
3950
3953
|
id: string;
|
|
3951
3954
|
slug?: string;
|
|
@@ -3969,6 +3972,7 @@ interface Product {
|
|
|
3969
3972
|
inventory: ProductInventory;
|
|
3970
3973
|
discountRuleNames?: DiscountInfo['discountRuleNames'];
|
|
3971
3974
|
productGroupId?: string;
|
|
3975
|
+
extendedFields: ProductExtendedFields;
|
|
3972
3976
|
}
|
|
3973
3977
|
//#endregion
|
|
3974
3978
|
//#region src/extensions/product/providers/selectors/validate-user-input/validate-user-input.d.ts
|
|
@@ -4216,6 +4220,7 @@ declare function useStandaloneProductContextValue({
|
|
|
4216
4220
|
discountRules: {
|
|
4217
4221
|
name: string;
|
|
4218
4222
|
}[] | undefined;
|
|
4223
|
+
extendedFields: ProductExtendedFields;
|
|
4219
4224
|
};
|
|
4220
4225
|
//#endregion
|
|
4221
4226
|
//#region src/extensions/product/providers/product-by-slug-context/product-by-slug-context-provider.d.ts
|
|
@@ -3931,6 +3931,9 @@ interface ProductPriceRange {
|
|
|
3931
3931
|
minCompareAtPrice?: number;
|
|
3932
3932
|
maxCompareAtPrice?: number;
|
|
3933
3933
|
}
|
|
3934
|
+
interface ProductExtendedFields {
|
|
3935
|
+
namespaces: Record<string, Record<string, unknown>>;
|
|
3936
|
+
}
|
|
3934
3937
|
interface Product {
|
|
3935
3938
|
id: string;
|
|
3936
3939
|
slug?: string;
|
|
@@ -3954,6 +3957,7 @@ interface Product {
|
|
|
3954
3957
|
inventory: ProductInventory;
|
|
3955
3958
|
discountRuleNames?: DiscountInfo['discountRuleNames'];
|
|
3956
3959
|
productGroupId?: string;
|
|
3960
|
+
extendedFields: ProductExtendedFields;
|
|
3957
3961
|
}
|
|
3958
3962
|
//#endregion
|
|
3959
3963
|
//#region src/extensions/product/providers/selectors/validate-user-input/validate-user-input.d.ts
|
|
@@ -4133,6 +4137,7 @@ declare function useProductItemContextValue({
|
|
|
4133
4137
|
discountRules: {
|
|
4134
4138
|
name: string;
|
|
4135
4139
|
}[] | undefined;
|
|
4140
|
+
extendedFields: ProductExtendedFields;
|
|
4136
4141
|
source: ProductContextSource;
|
|
4137
4142
|
};
|
|
4138
4143
|
type ProductItemContextImplementation = ReturnType<typeof useProductItemContextValue>;
|
|
@@ -3765,6 +3765,9 @@ interface ProductPriceRange {
|
|
|
3765
3765
|
minCompareAtPrice?: number;
|
|
3766
3766
|
maxCompareAtPrice?: number;
|
|
3767
3767
|
}
|
|
3768
|
+
interface ProductExtendedFields {
|
|
3769
|
+
namespaces: Record<string, Record<string, unknown>>;
|
|
3770
|
+
}
|
|
3768
3771
|
interface Product {
|
|
3769
3772
|
id: string;
|
|
3770
3773
|
slug?: string;
|
|
@@ -3788,6 +3791,7 @@ interface Product {
|
|
|
3788
3791
|
inventory: ProductInventory;
|
|
3789
3792
|
discountRuleNames?: DiscountInfo['discountRuleNames'];
|
|
3790
3793
|
productGroupId?: string;
|
|
3794
|
+
extendedFields: ProductExtendedFields;
|
|
3791
3795
|
}
|
|
3792
3796
|
//#endregion
|
|
3793
3797
|
//#region src/api/product-groups/product-groups.d.ts
|
|
@@ -3847,6 +3847,9 @@ interface ProductCategory {
|
|
|
3847
3847
|
*/
|
|
3848
3848
|
id: string;
|
|
3849
3849
|
}
|
|
3850
|
+
interface ProductExtendedFields {
|
|
3851
|
+
namespaces: Record<string, Record<string, unknown>>;
|
|
3852
|
+
}
|
|
3850
3853
|
//#endregion
|
|
3851
3854
|
//#region src/extensions/product/providers/selectors/validate-user-input/validate-user-input.d.ts
|
|
3852
3855
|
/** Why the selected quantity isn't valid. */
|
|
@@ -3970,6 +3973,24 @@ interface ProductContextValue {
|
|
|
3970
3973
|
source: ProductContextSource;
|
|
3971
3974
|
/** Product's display name. */
|
|
3972
3975
|
name: string;
|
|
3976
|
+
/**
|
|
3977
|
+
* Custom product fields returned by the API, grouped by namespace: `_user_fields` for
|
|
3978
|
+
* site-defined fields and app namespaces for app-defined fields. Includes only fields the
|
|
3979
|
+
* caller has permission to read. `namespaces` is empty when no extended fields are returned.
|
|
3980
|
+
*
|
|
3981
|
+
* Available through this hook only, without editor bindings. Values are `unknown` because
|
|
3982
|
+
* each namespace has its own schema; validate them before use.
|
|
3983
|
+
*
|
|
3984
|
+
* @example Read a field from an app namespace
|
|
3985
|
+
* ```tsx
|
|
3986
|
+
* const { extendedFields } = useProductContext();
|
|
3987
|
+
* const warranty = extendedFields.namespaces['@my-app/products']?.warranty;
|
|
3988
|
+
* if (typeof warranty === 'string') {
|
|
3989
|
+
* return <span>{warranty}</span>;
|
|
3990
|
+
* }
|
|
3991
|
+
* ```
|
|
3992
|
+
*/
|
|
3993
|
+
extendedFields: ProductExtendedFields;
|
|
3973
3994
|
/** Link to the product's page */
|
|
3974
3995
|
link: Link$1 | undefined;
|
|
3975
3996
|
/**
|
|
@@ -3873,6 +3873,9 @@ interface ProductPriceRange {
|
|
|
3873
3873
|
minCompareAtPrice?: number;
|
|
3874
3874
|
maxCompareAtPrice?: number;
|
|
3875
3875
|
}
|
|
3876
|
+
interface ProductExtendedFields {
|
|
3877
|
+
namespaces: Record<string, Record<string, unknown>>;
|
|
3878
|
+
}
|
|
3876
3879
|
interface Product {
|
|
3877
3880
|
id: string;
|
|
3878
3881
|
slug?: string;
|
|
@@ -3896,6 +3899,7 @@ interface Product {
|
|
|
3896
3899
|
inventory: ProductInventory;
|
|
3897
3900
|
discountRuleNames?: DiscountInfo['discountRuleNames'];
|
|
3898
3901
|
productGroupId?: string;
|
|
3902
|
+
extendedFields: ProductExtendedFields;
|
|
3899
3903
|
}
|
|
3900
3904
|
//#endregion
|
|
3901
3905
|
//#region src/extensions/gallery/providers/selectors/filter-selection/filter-selection.d.ts
|