@faststore/api 1.8.31 → 1.8.34

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 (36) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/__generated__/schema.d.ts +17 -2
  3. package/dist/api.cjs.development.js +133 -20
  4. package/dist/api.cjs.development.js.map +1 -1
  5. package/dist/api.cjs.production.min.js +1 -1
  6. package/dist/api.cjs.production.min.js.map +1 -1
  7. package/dist/api.esm.js +134 -21
  8. package/dist/api.esm.js.map +1 -1
  9. package/dist/index.d.ts +50 -7
  10. package/dist/platforms/vtex/clients/commerce/types/OrderForm.d.ts +6 -0
  11. package/dist/platforms/vtex/index.d.ts +50 -7
  12. package/dist/platforms/vtex/resolvers/aggregateOffer.d.ts +1 -2
  13. package/dist/platforms/vtex/resolvers/mutation.d.ts +1 -0
  14. package/dist/platforms/vtex/resolvers/objectOrString.d.ts +2 -0
  15. package/dist/platforms/vtex/resolvers/product.d.ts +6 -2
  16. package/dist/platforms/vtex/resolvers/propertyValue.d.ts +5 -0
  17. package/dist/platforms/vtex/resolvers/validateCart.d.ts +1 -0
  18. package/dist/platforms/vtex/utils/enhanceCommercialOffer.d.ts +8 -9
  19. package/dist/platforms/vtex/utils/propertyValue.d.ts +12 -0
  20. package/package.json +2 -2
  21. package/src/__generated__/schema.ts +18 -2
  22. package/src/platforms/vtex/clients/commerce/types/OrderForm.ts +7 -0
  23. package/src/platforms/vtex/index.ts +4 -0
  24. package/src/platforms/vtex/resolvers/aggregateOffer.ts +1 -2
  25. package/src/platforms/vtex/resolvers/objectOrString.ts +46 -0
  26. package/src/platforms/vtex/resolvers/offer.ts +11 -1
  27. package/src/platforms/vtex/resolvers/product.ts +34 -5
  28. package/src/platforms/vtex/resolvers/productGroup.ts +6 -1
  29. package/src/platforms/vtex/resolvers/propertyValue.ts +12 -0
  30. package/src/platforms/vtex/resolvers/validateCart.ts +23 -1
  31. package/src/platforms/vtex/utils/enhanceCommercialOffer.ts +8 -12
  32. package/src/platforms/vtex/utils/propertyValue.ts +22 -0
  33. package/src/typeDefs/index.ts +2 -0
  34. package/src/typeDefs/objectOrString.graphql +1 -0
  35. package/src/typeDefs/product.graphql +4 -0
  36. package/src/typeDefs/propertyValue.graphql +25 -2
@@ -1,23 +1,19 @@
1
- import type {
2
- CommertialOffer,
3
- Seller,
4
- } from '../clients/search/types/ProductSearchResult'
5
- import type { EnhancedSku } from './enhanceSku'
1
+ import type { CommertialOffer } from '../clients/search/types/ProductSearchResult'
6
2
 
7
- export type EnhancedCommercialOffer = CommertialOffer & {
8
- seller: Seller
9
- product: EnhancedSku
3
+ export type EnhancedCommercialOffer<S, P> = CommertialOffer & {
4
+ seller: S
5
+ product: P
10
6
  }
11
7
 
12
- export const enhanceCommercialOffer = ({
8
+ export const enhanceCommercialOffer = <S, P>({
13
9
  offer,
14
10
  seller,
15
11
  product,
16
12
  }: {
17
13
  offer: CommertialOffer
18
- seller: Seller
19
- product: EnhancedSku
20
- }): EnhancedCommercialOffer => ({
14
+ seller: S
15
+ product: P
16
+ }): EnhancedCommercialOffer<S, P> => ({
21
17
  ...offer,
22
18
  product,
23
19
  seller,
@@ -0,0 +1,22 @@
1
+ import type { IStorePropertyValue } from '../../../__generated__/schema'
2
+ import type { Attachment } from '../clients/commerce/types/OrderForm'
3
+ import { md5 } from './md5'
4
+
5
+ export const VALUE_REFERENCES = {
6
+ attachment: 'ATTACHMENT',
7
+ specification: 'SPECIFICATION',
8
+ } as const
9
+
10
+ export function attachmentToPropertyValue(attachment: Attachment) {
11
+ return {
12
+ name: attachment.name,
13
+ value: attachment.content,
14
+ valueReference: VALUE_REFERENCES.attachment,
15
+ }
16
+ }
17
+
18
+ export function getPropertyId(item: IStorePropertyValue) {
19
+ return md5(
20
+ `${item.name}:${JSON.stringify(item.value)}:${item.valueReference}`
21
+ )
22
+ }
@@ -22,6 +22,7 @@ import Cart from './cart.graphql'
22
22
  import Status from './status.graphql'
23
23
  import PropertyValue from './propertyValue.graphql'
24
24
  import Person from './person.graphql'
25
+ import ObjectOrString from './objectOrString.graphql'
25
26
 
26
27
  export const typeDefs = [
27
28
  Query,
@@ -46,6 +47,7 @@ export const typeDefs = [
46
47
  Status,
47
48
  PropertyValue,
48
49
  Person,
50
+ ObjectOrString,
49
51
  ]
50
52
  .map(print)
51
53
  .join('\n')
@@ -0,0 +1 @@
1
+ scalar ObjectOrString
@@ -80,4 +80,8 @@ input IStoreProduct {
80
80
  Array of product images.
81
81
  """
82
82
  image: [IStoreImage!]!
83
+ """
84
+ Custom Product Additional Properties.
85
+ """
86
+ additionalProperty: [IStorePropertyValue!]
83
87
  }
@@ -3,11 +3,34 @@ Properties that can be associated with products and products groups.
3
3
  """
4
4
  type StorePropertyValue {
5
5
  """
6
- Property value.
6
+ Property id. This propert changes according to the content of the object.
7
7
  """
8
- value: String!
8
+ propertyID: String!
9
+ """
10
+ Property value. May hold a string or the string representation of an object.
11
+ """
12
+ value: ObjectOrString!
9
13
  """
10
14
  Property name.
11
15
  """
12
16
  name: String!
17
+ """
18
+ Specifies the nature of the value
19
+ """
20
+ valueReference: String!
21
+ }
22
+
23
+ input IStorePropertyValue {
24
+ """
25
+ Property value. May hold a string or the string representation of an object.
26
+ """
27
+ value: ObjectOrString!
28
+ """
29
+ Property name.
30
+ """
31
+ name: String!
32
+ """
33
+ Specifies the nature of the value
34
+ """
35
+ valueReference: String!
13
36
  }