@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.
Files changed (61) hide show
  1. package/build/cjs/context-category-by-id.d.ts +4 -0
  2. package/build/cjs/context-category-by-id.js +1 -1
  3. package/build/cjs/context-category-by-id.js.map +1 -1
  4. package/build/cjs/context-category-by-slug.d.ts +4 -0
  5. package/build/cjs/context-category-by-slug.js +1 -1
  6. package/build/cjs/context-category-by-slug.js.map +1 -1
  7. package/build/cjs/context-product-by-id.d.ts +5 -0
  8. package/build/cjs/context-product-by-id.js +2 -2
  9. package/build/cjs/context-product-by-id.js.map +1 -1
  10. package/build/cjs/context-product-by-slug.d.ts +5 -0
  11. package/build/cjs/context-product-by-slug.js +2 -2
  12. package/build/cjs/context-product-by-slug.js.map +1 -1
  13. package/build/cjs/context-product-item.d.ts +5 -0
  14. package/build/cjs/context-product-item.js +1 -1
  15. package/build/cjs/context-product-item.js.map +1 -1
  16. package/build/cjs/context-product-list.d.ts +4 -0
  17. package/build/cjs/context-product.d.ts +21 -0
  18. package/build/es/context-category-by-id.d.mts +4 -0
  19. package/build/es/context-category-by-id.mjs +1 -1
  20. package/build/es/context-category-by-id.mjs.map +1 -1
  21. package/build/es/context-category-by-slug.d.mts +4 -0
  22. package/build/es/context-category-by-slug.mjs +1 -1
  23. package/build/es/context-category-by-slug.mjs.map +1 -1
  24. package/build/es/context-product-by-id.d.mts +5 -0
  25. package/build/es/context-product-by-id.mjs +2 -2
  26. package/build/es/context-product-by-id.mjs.map +1 -1
  27. package/build/es/context-product-by-slug.d.mts +5 -0
  28. package/build/es/context-product-by-slug.mjs +2 -2
  29. package/build/es/context-product-by-slug.mjs.map +1 -1
  30. package/build/es/context-product-item.d.mts +5 -0
  31. package/build/es/context-product-item.mjs +1 -1
  32. package/build/es/context-product-item.mjs.map +1 -1
  33. package/build/es/context-product-list.d.mts +4 -0
  34. package/build/es/context-product.d.mts +21 -0
  35. package/build/internal/cjs/context-category-by-id.d.ts +4 -0
  36. package/build/internal/cjs/context-category-by-slug.d.ts +4 -0
  37. package/build/internal/cjs/context-product-by-id.d.ts +5 -0
  38. package/build/internal/cjs/context-product-by-slug.d.ts +5 -0
  39. package/build/internal/cjs/context-product-item.d.ts +5 -0
  40. package/build/internal/cjs/context-product-list.d.ts +4 -0
  41. package/build/internal/cjs/context-product.d.ts +21 -0
  42. package/build/internal/es/context-category-by-id.d.mts +4 -0
  43. package/build/internal/es/context-category-by-slug.d.mts +4 -0
  44. package/build/internal/es/context-product-by-id.d.mts +5 -0
  45. package/build/internal/es/context-product-by-slug.d.mts +5 -0
  46. package/build/internal/es/context-product-item.d.mts +5 -0
  47. package/build/internal/es/context-product-list.d.mts +4 -0
  48. package/build/internal/es/context-product.d.mts +21 -0
  49. package/context-runtime/context-category-by-id/runtime.d.ts +4 -0
  50. package/context-runtime/context-category-by-id/runtime.js +2 -2
  51. package/context-runtime/context-category-by-slug/runtime.d.ts +4 -0
  52. package/context-runtime/context-category-by-slug/runtime.js +2 -2
  53. package/context-runtime/context-product/runtime.d.ts +21 -0
  54. package/context-runtime/context-product-by-id/runtime.d.ts +5 -0
  55. package/context-runtime/context-product-by-id/runtime.js +2 -2
  56. package/context-runtime/context-product-by-slug/runtime.d.ts +5 -0
  57. package/context-runtime/context-product-by-slug/runtime.js +2 -2
  58. package/context-runtime/context-product-item/runtime.d.ts +5 -0
  59. package/context-runtime/context-product-item/runtime.js +2 -2
  60. package/context-runtime/context-product-list/runtime.d.ts +4 -0
  61. 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
@@ -3193,7 +3193,7 @@ var is = { nodes: [] };
3193
3193
  var as = `@stores/product-groups`;
3194
3194
  function os(e2) {
3195
3195
  let t2 = Xo(e2.options ?? []), n2 = Qo(e2.modifiers ?? []), r2 = us(e2.subscriptionDetails?.subscriptions ?? []), i2 = $o(e2.variantsInfo?.variants ?? []), a2 = { subscriptions: r2, allowOneTimePurchases: e2.subscriptionDetails?.allowOneTimePurchases ?? false }, o2 = e2.additionalRibbons ?? [], s2 = { primary: e2.ribbon?.name ?? void 0, additional: o2.map((e3) => e3.name ?? void 0).filter((e3) => !!e3) }, c2 = e2.description ? ds(e2.description) : is, l2 = e2.discountInfo?.discountRuleNames, u2 = cs(e2);
3196
- return { id: e2._id, slug: e2.slug ?? void 0, url: e2.url ? { href: e2.url } : void 0, name: e2.name, description: c2, media: bs(e2), mainMedia: ys(e2.media?.main), ribbons: s2, breadcrumbs: fs(e2), mainCategoryId: e2.mainCategoryId ?? void 0, categories: ps(e2), infoSections: ss(e2), currency: e2.currency, options: t2, modifiers: n2, variants: i2, minPriceVariant: _s(e2), priceRange: vs(e2), subscriptionDetails: a2, inventory: { availabilityStatus: e2.inventory?.availabilityStatus, preorderAvailability: e2.inventory?.preorderAvailability }, discountRuleNames: l2, productGroupId: u2 };
3196
+ return { id: e2._id, slug: e2.slug ?? void 0, url: e2.url ? { href: e2.url } : void 0, name: e2.name, description: c2, media: bs(e2), mainMedia: ys(e2.media?.main), ribbons: s2, breadcrumbs: fs(e2), mainCategoryId: e2.mainCategoryId ?? void 0, categories: ps(e2), infoSections: ss(e2), currency: e2.currency, options: t2, modifiers: n2, variants: i2, minPriceVariant: _s(e2), priceRange: vs(e2), subscriptionDetails: a2, inventory: { availabilityStatus: e2.inventory?.availabilityStatus, preorderAvailability: e2.inventory?.preorderAvailability }, discountRuleNames: l2, productGroupId: u2, extendedFields: { namespaces: e2.extendedFields?.namespaces ?? {} } };
3197
3197
  }
3198
3198
  function ss(e2) {
3199
3199
  return (e2.infoSections ?? []).map((e3) => ({ _id: e3.uniqueName ?? e3._id, name: e3.title, body: e3.description ? ds(e3.description) : void 0 }));