@faststore/api 1.8.38 → 1.8.41
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/CHANGELOG.md +27 -0
- package/dist/__generated__/schema.d.ts +12 -2
- package/dist/api.cjs.development.js +17 -15
- package/dist/api.cjs.development.js.map +1 -1
- package/dist/api.cjs.production.min.js +1 -1
- package/dist/api.cjs.production.min.js.map +1 -1
- package/dist/api.esm.js +17 -15
- package/dist/api.esm.js.map +1 -1
- package/package.json +2 -3
- package/src/__generated__/schema.ts +13 -2
- package/src/platforms/vtex/resolvers/searchResult.ts +5 -2
- package/src/platforms/vtex/resolvers/validateCart.ts +10 -6
- package/src/typeDefs/propertyValue.graphql +4 -0
- package/src/typeDefs/query.graphql +16 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/api",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.41",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
"develop:no-server": "concurrently \"yarn generate -w\" \"tsdx watch\"",
|
|
19
19
|
"build": "graphql-codegen --config codegen.yml && tsdx build",
|
|
20
20
|
"test": "tsdx test",
|
|
21
|
-
"lint": "tsdx lint",
|
|
22
21
|
"generate": "graphql-codegen --config codegen.yml"
|
|
23
22
|
},
|
|
24
23
|
"dependencies": {
|
|
@@ -45,5 +44,5 @@
|
|
|
45
44
|
"peerDependencies": {
|
|
46
45
|
"graphql": "^15.6.0"
|
|
47
46
|
},
|
|
48
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "2bec55e07c976b1e18e0c9b7e41d9f37eea5ba71"
|
|
49
48
|
}
|
|
@@ -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 */
|
|
@@ -552,11 +554,20 @@ export const enum StoreStatus {
|
|
|
552
554
|
Warning = 'WARNING'
|
|
553
555
|
};
|
|
554
556
|
|
|
557
|
+
/** Suggestion term. */
|
|
558
|
+
export type StoreSuggestionTerm = {
|
|
559
|
+
__typename?: 'StoreSuggestionTerm';
|
|
560
|
+
/** Its occurrences count. */
|
|
561
|
+
count: Scalars['Int'];
|
|
562
|
+
/** The term. */
|
|
563
|
+
value: Scalars['String'];
|
|
564
|
+
};
|
|
565
|
+
|
|
555
566
|
/** Suggestions information. */
|
|
556
567
|
export type StoreSuggestions = {
|
|
557
568
|
__typename?: 'StoreSuggestions';
|
|
558
569
|
/** Array with suggestion products' information. */
|
|
559
|
-
products
|
|
570
|
+
products: Array<StoreProduct>;
|
|
560
571
|
/** Array with suggestion terms. */
|
|
561
|
-
terms
|
|
572
|
+
terms: Array<StoreSuggestionTerm>;
|
|
562
573
|
};
|
|
@@ -18,7 +18,10 @@ export const StoreSearchResult: Record<string, Resolver<Root>> = {
|
|
|
18
18
|
const topSearches = await search.topSearches()
|
|
19
19
|
|
|
20
20
|
return {
|
|
21
|
-
terms: topSearches.searches.map((item) =>
|
|
21
|
+
terms: topSearches.searches.map((item) => ({
|
|
22
|
+
value: item.term,
|
|
23
|
+
count: item.count,
|
|
24
|
+
})),
|
|
22
25
|
products: [],
|
|
23
26
|
}
|
|
24
27
|
}
|
|
@@ -37,7 +40,7 @@ export const StoreSearchResult: Record<string, Resolver<Root>> = {
|
|
|
37
40
|
const { searches } = terms
|
|
38
41
|
|
|
39
42
|
return {
|
|
40
|
-
terms: searches.map((item) => item.term),
|
|
43
|
+
terms: searches.map((item) => ({ value: item.term, count: item.count })),
|
|
41
44
|
products: skus,
|
|
42
45
|
}
|
|
43
46
|
},
|
|
@@ -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
|
|
24
|
-
|
|
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
|
|
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: (
|
|
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
|
"""
|
|
@@ -84,6 +84,20 @@ enum StoreFacetType {
|
|
|
84
84
|
RANGE
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
"""
|
|
88
|
+
Suggestion term.
|
|
89
|
+
"""
|
|
90
|
+
type StoreSuggestionTerm {
|
|
91
|
+
"""
|
|
92
|
+
The term.
|
|
93
|
+
"""
|
|
94
|
+
value: String!
|
|
95
|
+
"""
|
|
96
|
+
Its occurrences count.
|
|
97
|
+
"""
|
|
98
|
+
count: Int!
|
|
99
|
+
}
|
|
100
|
+
|
|
87
101
|
"""
|
|
88
102
|
Suggestions information.
|
|
89
103
|
"""
|
|
@@ -91,11 +105,11 @@ type StoreSuggestions {
|
|
|
91
105
|
"""
|
|
92
106
|
Array with suggestion terms.
|
|
93
107
|
"""
|
|
94
|
-
terms: [
|
|
108
|
+
terms: [StoreSuggestionTerm!]!
|
|
95
109
|
"""
|
|
96
110
|
Array with suggestion products' information.
|
|
97
111
|
"""
|
|
98
|
-
products: [StoreProduct!]
|
|
112
|
+
products: [StoreProduct!]!
|
|
99
113
|
}
|
|
100
114
|
|
|
101
115
|
"""
|