@faststore/api 1.8.39 → 1.8.40

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.
@@ -69,6 +69,8 @@ export type IStoreProduct = {
69
69
  export type IStorePropertyValue = {
70
70
  /** Property name. */
71
71
  name: Scalars['String'];
72
+ /** Property id. This propert changes according to the content of the object. */
73
+ propertyID?: Maybe<Scalars['String']>;
72
74
  /** Property value. May hold a string or the string representation of an object. */
73
75
  value: Scalars['ObjectOrString'];
74
76
  /** Specifies the nature of the value */
@@ -5,6 +5,7 @@ import type {
5
5
  IStoreCart,
6
6
  IStoreOffer,
7
7
  IStoreOrder,
8
+ IStorePropertyValue,
8
9
  } from '../../../__generated__/schema'
9
10
  import type {
10
11
  OrderForm,
@@ -20,17 +21,18 @@ import {
20
21
 
21
22
  type Indexed<T> = T & { index?: number }
22
23
 
23
- const getAttachments = (item: IStoreOffer) =>
24
- item.itemOffered.additionalProperty?.filter(
25
- (i) => i.valueReference === VALUE_REFERENCES.attachment
26
- )
24
+ const isAttachment = (value: IStorePropertyValue) =>
25
+ value.valueReference === VALUE_REFERENCES.attachment
27
26
 
28
27
  const getId = (item: IStoreOffer) =>
29
28
  [
30
29
  item.itemOffered.sku,
31
30
  item.seller.identifier,
32
31
  item.price,
33
- item.itemOffered.additionalProperty?.map(getPropertyId).join('-'),
32
+ item.itemOffered.additionalProperty
33
+ ?.filter(isAttachment)
34
+ .map(getPropertyId)
35
+ .join('-'),
34
36
  ]
35
37
  .filter(Boolean)
36
38
  .join('::')
@@ -59,7 +61,9 @@ const offerToOrderItemInput = (
59
61
  seller: offer.seller.identifier,
60
62
  id: offer.itemOffered.sku,
61
63
  index: offer.index,
62
- attachments: (getAttachments(offer) ?? []).map((attachment) => ({
64
+ attachments: (
65
+ offer.itemOffered.additionalProperty?.filter(isAttachment) ?? []
66
+ ).map((attachment) => ({
63
67
  name: attachment.name,
64
68
  content: attachment.value,
65
69
  })),
@@ -21,6 +21,10 @@ type StorePropertyValue {
21
21
  }
22
22
 
23
23
  input IStorePropertyValue {
24
+ """
25
+ Property id. This propert changes according to the content of the object.
26
+ """
27
+ propertyID: String
24
28
  """
25
29
  Property value. May hold a string or the string representation of an object.
26
30
  """