@faststore/api 1.7.30 → 1.7.33
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/api.cjs.development.js +313 -181
- 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 +313 -181
- package/dist/api.esm.js.map +1 -1
- package/dist/index.d.ts +27 -13
- package/dist/platforms/vtex/clients/index.d.ts +4 -1
- package/dist/platforms/vtex/clients/search/index.d.ts +3 -3
- package/dist/platforms/vtex/clients/search/types/AttributeSearchResult.d.ts +25 -51
- package/dist/platforms/vtex/clients/search/types/FacetSearchResult.d.ts +31 -0
- package/dist/platforms/vtex/clients/search/types/ProductSearchResult.d.ts +146 -154
- package/dist/platforms/vtex/clients/sp/index.d.ts +13 -0
- package/dist/platforms/vtex/index.d.ts +28 -14
- package/dist/platforms/vtex/resolvers/aggregateOffer.d.ts +10 -6
- package/dist/platforms/vtex/resolvers/facet.d.ts +2 -2
- package/dist/platforms/vtex/resolvers/facetValue.d.ts +2 -2
- package/dist/platforms/vtex/resolvers/offer.d.ts +7 -6
- package/dist/platforms/vtex/resolvers/product.d.ts +11 -2
- package/dist/platforms/vtex/resolvers/productGroup.d.ts +5 -2
- package/dist/platforms/vtex/utils/enhanceSku.d.ts +3 -3
- package/dist/platforms/vtex/utils/price.d.ts +2 -0
- package/dist/platforms/vtex/utils/productStock.d.ts +5 -0
- package/dist/typings/index.d.ts +2 -0
- package/package.json +2 -2
- package/src/platforms/vtex/clients/fetch.ts +1 -1
- package/src/platforms/vtex/clients/index.ts +3 -0
- package/src/platforms/vtex/clients/search/index.ts +6 -6
- package/src/platforms/vtex/clients/search/types/AttributeSearchResult.ts +24 -53
- package/src/platforms/vtex/clients/search/types/FacetSearchResult.ts +33 -0
- package/src/platforms/vtex/clients/search/types/ProductSearchResult.ts +135 -164
- package/src/platforms/vtex/clients/sp/index.ts +67 -0
- package/src/platforms/vtex/index.ts +2 -2
- package/src/platforms/vtex/loaders/sku.ts +2 -2
- package/src/platforms/vtex/resolvers/aggregateOffer.ts +17 -35
- package/src/platforms/vtex/resolvers/facet.ts +5 -5
- package/src/platforms/vtex/resolvers/facetValue.ts +7 -6
- package/src/platforms/vtex/resolvers/offer.ts +107 -17
- package/src/platforms/vtex/resolvers/product.ts +55 -73
- package/src/platforms/vtex/resolvers/productGroup.ts +22 -13
- package/src/platforms/vtex/resolvers/query.ts +3 -3
- package/src/platforms/vtex/resolvers/searchResult.ts +24 -12
- package/src/platforms/vtex/utils/enhanceSku.ts +4 -4
- package/src/platforms/vtex/utils/facets.ts +8 -2
- package/src/platforms/vtex/utils/price.ts +10 -0
- package/src/platforms/vtex/utils/productStock.ts +25 -0
- package/src/typings/index.ts +4 -0
|
@@ -1,56 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
translated: boolean;
|
|
6
|
-
locale: string;
|
|
7
|
-
query: string;
|
|
8
|
-
operator: string;
|
|
9
|
-
fuzzy: string;
|
|
10
|
-
attributes: Attribute[] | null;
|
|
1
|
+
declare type FilterType = 'PRICERANGE' | 'TEXT' | 'NUMBER' | 'CATEGORYTREE';
|
|
2
|
+
export interface FacetSearchResult {
|
|
3
|
+
facets: Facet[];
|
|
4
|
+
breadcrumb: Breadcrumb;
|
|
11
5
|
}
|
|
12
|
-
export interface
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
originalKey: string;
|
|
19
|
-
label: string;
|
|
20
|
-
originalLabel: string;
|
|
21
|
-
type: string;
|
|
22
|
-
minValue?: number;
|
|
23
|
-
maxValue?: number;
|
|
24
|
-
templateURL?: string;
|
|
25
|
-
proxyURL?: string;
|
|
6
|
+
export interface Facet {
|
|
7
|
+
type: FilterType;
|
|
8
|
+
name: string;
|
|
9
|
+
hidden: boolean;
|
|
10
|
+
values: FacetValue[];
|
|
11
|
+
quantity?: number;
|
|
26
12
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
key
|
|
31
|
-
|
|
13
|
+
interface FacetValue {
|
|
14
|
+
quantity: number;
|
|
15
|
+
name: string;
|
|
16
|
+
key: string;
|
|
17
|
+
value: string;
|
|
18
|
+
selected?: boolean;
|
|
19
|
+
range?: {
|
|
20
|
+
from: number;
|
|
21
|
+
to: number;
|
|
22
|
+
};
|
|
23
|
+
children?: FacetValue[];
|
|
32
24
|
id?: string;
|
|
33
|
-
originalKey?: string;
|
|
34
|
-
originalLabel?: string;
|
|
35
|
-
proxyURL: string;
|
|
36
|
-
from?: string;
|
|
37
|
-
to?: string;
|
|
38
|
-
}
|
|
39
|
-
export interface Pagination {
|
|
40
|
-
count: number;
|
|
41
|
-
current: Current;
|
|
42
|
-
before: any[];
|
|
43
|
-
after: any[];
|
|
44
|
-
perPage: number;
|
|
45
|
-
next: First;
|
|
46
|
-
previous: First;
|
|
47
|
-
first: First;
|
|
48
|
-
last: First;
|
|
49
|
-
}
|
|
50
|
-
export interface Current {
|
|
51
|
-
index: number;
|
|
52
|
-
proxyURL: string;
|
|
53
25
|
}
|
|
54
|
-
|
|
55
|
-
|
|
26
|
+
interface Breadcrumb {
|
|
27
|
+
href: string;
|
|
28
|
+
name: string;
|
|
56
29
|
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
declare type FilterType = 'PRICERANGE' | 'TEXT' | 'NUMBER' | 'CATEGORYTREE';
|
|
2
|
+
export interface FacetSearchResult {
|
|
3
|
+
facets: Facet[];
|
|
4
|
+
breadcrumb: Breadcrumb;
|
|
5
|
+
}
|
|
6
|
+
export interface Facet {
|
|
7
|
+
type: FilterType;
|
|
8
|
+
name: string;
|
|
9
|
+
hidden: boolean;
|
|
10
|
+
values: FacetValue[];
|
|
11
|
+
quantity?: number;
|
|
12
|
+
key?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface FacetValue {
|
|
15
|
+
quantity: number;
|
|
16
|
+
name: string;
|
|
17
|
+
key: string;
|
|
18
|
+
value: string;
|
|
19
|
+
selected?: boolean;
|
|
20
|
+
range?: {
|
|
21
|
+
from: number;
|
|
22
|
+
to: number;
|
|
23
|
+
};
|
|
24
|
+
children?: FacetValue[];
|
|
25
|
+
id?: string;
|
|
26
|
+
}
|
|
27
|
+
interface Breadcrumb {
|
|
28
|
+
href: string;
|
|
29
|
+
name: string;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export interface ProductSearchResult {
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* @description Total of products.
|
|
4
|
+
*/
|
|
5
|
+
recordsFiltered: number;
|
|
3
6
|
products: Product[];
|
|
4
7
|
pagination: Pagination;
|
|
5
8
|
sampling: boolean;
|
|
@@ -7,193 +10,182 @@ export interface ProductSearchResult {
|
|
|
7
10
|
translated: boolean;
|
|
8
11
|
locale: string;
|
|
9
12
|
query: string;
|
|
10
|
-
operator:
|
|
13
|
+
operator: 'and' | 'or';
|
|
11
14
|
fuzzy: string;
|
|
12
15
|
correction: Correction;
|
|
13
16
|
}
|
|
14
|
-
|
|
17
|
+
interface Correction {
|
|
15
18
|
misspelled: boolean;
|
|
16
19
|
}
|
|
17
|
-
|
|
20
|
+
interface Options {
|
|
18
21
|
sorts: Sort[];
|
|
19
22
|
counts: Count[];
|
|
20
23
|
}
|
|
21
|
-
|
|
24
|
+
interface Count {
|
|
22
25
|
count: number;
|
|
23
26
|
proxyURL: string;
|
|
24
27
|
}
|
|
25
|
-
|
|
28
|
+
interface Sort {
|
|
26
29
|
field: string;
|
|
27
30
|
order: string;
|
|
28
31
|
active?: boolean;
|
|
29
32
|
proxyURL: string;
|
|
30
33
|
}
|
|
31
|
-
|
|
34
|
+
interface Pagination {
|
|
32
35
|
count: number;
|
|
33
|
-
current:
|
|
34
|
-
before:
|
|
35
|
-
after:
|
|
36
|
+
current: Page;
|
|
37
|
+
before: Page[];
|
|
38
|
+
after: Page[];
|
|
36
39
|
perPage: number;
|
|
37
|
-
next:
|
|
38
|
-
previous:
|
|
39
|
-
first:
|
|
40
|
-
last:
|
|
40
|
+
next: Page;
|
|
41
|
+
previous: Page;
|
|
42
|
+
first: Page;
|
|
43
|
+
last: Page;
|
|
41
44
|
}
|
|
42
|
-
|
|
45
|
+
interface Page {
|
|
43
46
|
index: number;
|
|
44
47
|
proxyURL: string;
|
|
45
48
|
}
|
|
46
|
-
export interface First {
|
|
47
|
-
index: number;
|
|
48
|
-
}
|
|
49
49
|
export interface Product {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
extraData: ExtraDatum[];
|
|
53
|
-
release: number;
|
|
54
|
-
discount: number;
|
|
55
|
-
reference: string;
|
|
56
|
-
split: Split;
|
|
57
|
-
collections: Collection[];
|
|
58
|
-
price: number;
|
|
59
|
-
customSort: number;
|
|
60
|
-
stickers: Sticker[];
|
|
61
|
-
id: string;
|
|
62
|
-
stock: number;
|
|
50
|
+
productId: string;
|
|
51
|
+
productName: string;
|
|
63
52
|
brand: string;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
name: string;
|
|
74
|
-
boost: Boost;
|
|
75
|
-
skus: Sku[];
|
|
53
|
+
brandId: number;
|
|
54
|
+
cacheId?: string;
|
|
55
|
+
linkText: string;
|
|
56
|
+
productReference: string;
|
|
57
|
+
categoryId: string;
|
|
58
|
+
clusterHighlights: Record<string, any>;
|
|
59
|
+
productClusters: Record<string, string>;
|
|
60
|
+
categories: string[];
|
|
61
|
+
categoriesIds: string[];
|
|
76
62
|
link: string;
|
|
77
|
-
wear: number;
|
|
78
63
|
description: string;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
the140: string;
|
|
114
|
-
}
|
|
115
|
-
export interface Collection {
|
|
116
|
-
id: string;
|
|
117
|
-
position: number;
|
|
118
|
-
}
|
|
119
|
-
export interface ExtraDatum {
|
|
120
|
-
value: string;
|
|
121
|
-
key: string;
|
|
122
|
-
}
|
|
123
|
-
export interface ExtraInfo {
|
|
124
|
-
sellerID: string;
|
|
125
|
-
}
|
|
126
|
-
export interface Image {
|
|
64
|
+
/**
|
|
65
|
+
* @description Product SKUs.
|
|
66
|
+
*/
|
|
67
|
+
items: Item[];
|
|
68
|
+
skuSpecifications?: SkuSpecification[];
|
|
69
|
+
priceRange: PriceRange;
|
|
70
|
+
specificationGroups: SpecificationGroup;
|
|
71
|
+
properties: Array<{
|
|
72
|
+
name: string;
|
|
73
|
+
values: string[];
|
|
74
|
+
}>;
|
|
75
|
+
selectedProperties: Array<{
|
|
76
|
+
key: string;
|
|
77
|
+
value: string;
|
|
78
|
+
}>;
|
|
79
|
+
}
|
|
80
|
+
interface Image {
|
|
81
|
+
imageId: string;
|
|
82
|
+
imageLabel: string | null;
|
|
83
|
+
imageTag: string;
|
|
84
|
+
imageUrl: string;
|
|
85
|
+
imageText: string;
|
|
86
|
+
}
|
|
87
|
+
interface Installment {
|
|
88
|
+
Value: number;
|
|
89
|
+
InterestRate: number;
|
|
90
|
+
TotalValuePlusInterestRate: number;
|
|
91
|
+
NumberOfInstallments: number;
|
|
92
|
+
PaymentSystemName: string;
|
|
93
|
+
PaymentSystemGroupName: string;
|
|
94
|
+
Name: string;
|
|
95
|
+
}
|
|
96
|
+
export interface Item {
|
|
97
|
+
itemId: string;
|
|
127
98
|
name: string;
|
|
128
|
-
value: string;
|
|
129
|
-
}
|
|
130
|
-
export interface Installment {
|
|
131
|
-
interest: boolean;
|
|
132
|
-
count: number;
|
|
133
|
-
paymentGroupName: string;
|
|
134
|
-
value: number;
|
|
135
|
-
paymentName: string;
|
|
136
|
-
valueText?: string;
|
|
137
|
-
}
|
|
138
|
-
export interface NumberAttribute {
|
|
139
|
-
labelKey: string;
|
|
140
|
-
value: number;
|
|
141
|
-
key: string;
|
|
142
|
-
}
|
|
143
|
-
export interface Sku {
|
|
144
|
-
images: Image[];
|
|
145
99
|
nameComplete: string;
|
|
146
100
|
complementName: string;
|
|
147
|
-
policies: Policy[];
|
|
148
|
-
videos: any[];
|
|
149
|
-
reference: string;
|
|
150
|
-
idWithSplit: string;
|
|
151
101
|
ean: string;
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
102
|
+
referenceId: Array<{
|
|
103
|
+
Key: string;
|
|
104
|
+
Value: string;
|
|
105
|
+
}>;
|
|
106
|
+
measurementUnit: string;
|
|
107
|
+
unitMultiplier: number;
|
|
108
|
+
modalType: any | null;
|
|
109
|
+
images: Image[];
|
|
110
|
+
Videos: string[];
|
|
111
|
+
variations: string[];
|
|
159
112
|
sellers: Seller[];
|
|
113
|
+
attachments: Array<{
|
|
114
|
+
id: number;
|
|
115
|
+
name: string;
|
|
116
|
+
required: boolean;
|
|
117
|
+
domainValues: string;
|
|
118
|
+
}>;
|
|
119
|
+
isKit: boolean;
|
|
120
|
+
kitItems?: Array<{
|
|
121
|
+
itemId: string;
|
|
122
|
+
amount: number;
|
|
123
|
+
}>;
|
|
124
|
+
}
|
|
125
|
+
export interface CommertialOffer {
|
|
126
|
+
DeliverySlaSamplesPerRegion: Record<string, {
|
|
127
|
+
DeliverySlaPerTypes: any[];
|
|
128
|
+
Region: any | null;
|
|
129
|
+
}>;
|
|
130
|
+
Installments: Installment[];
|
|
131
|
+
DiscountHighLight: any[];
|
|
132
|
+
GiftSkuIds: string[];
|
|
133
|
+
Teasers: Array<Record<string, unknown>>;
|
|
134
|
+
teasers?: Array<Record<string, unknown>>;
|
|
135
|
+
BuyTogether: any[];
|
|
136
|
+
ItemMetadataAttachment: any[];
|
|
137
|
+
Price: number;
|
|
138
|
+
ListPrice: number;
|
|
139
|
+
spotPrice?: number;
|
|
140
|
+
PriceWithoutDiscount: number;
|
|
141
|
+
RewardValue: number;
|
|
142
|
+
PriceValidUntil: string;
|
|
143
|
+
AvailableQuantity: number;
|
|
144
|
+
Tax: number;
|
|
145
|
+
DeliverySlaSamples: Array<{
|
|
146
|
+
DeliverySlaPerTypes: any[];
|
|
147
|
+
Region: any | null;
|
|
148
|
+
}>;
|
|
149
|
+
GetInfoErrorMessage: any | null;
|
|
150
|
+
CacheVersionUsedToCallCheckout: string;
|
|
160
151
|
}
|
|
161
152
|
export interface Seller {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
153
|
+
sellerId: string;
|
|
154
|
+
sellerName: string;
|
|
155
|
+
addToCartLink: string;
|
|
156
|
+
sellerDefault: boolean;
|
|
157
|
+
commertialOffer: CommertialOffer;
|
|
158
|
+
}
|
|
159
|
+
interface SkuSpecification {
|
|
160
|
+
field: SKUSpecificationField;
|
|
161
|
+
values: SKUSpecificationValue[];
|
|
170
162
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
163
|
+
interface SKUSpecificationValue {
|
|
164
|
+
name: string;
|
|
165
|
+
id?: string;
|
|
166
|
+
fieldId?: string;
|
|
167
|
+
originalName?: string;
|
|
174
168
|
}
|
|
175
|
-
|
|
176
|
-
image: string;
|
|
169
|
+
interface SKUSpecificationField {
|
|
177
170
|
name: string;
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
export interface TextAttribute {
|
|
182
|
-
joinedValue: string;
|
|
183
|
-
isSku: boolean;
|
|
184
|
-
joinedKey: string;
|
|
185
|
-
joinedKeyTranslations: JoinedTranslations;
|
|
186
|
-
isFilter: boolean;
|
|
187
|
-
labelValue: string;
|
|
188
|
-
id: string[];
|
|
189
|
-
labelKey: string;
|
|
190
|
-
value: string;
|
|
191
|
-
key: string;
|
|
192
|
-
joinedValueTranslations: JoinedTranslations;
|
|
193
|
-
valueID?: string;
|
|
194
|
-
}
|
|
195
|
-
export interface JoinedTranslations {
|
|
196
|
-
spanish: string;
|
|
197
|
-
english: string;
|
|
198
|
-
italian: string;
|
|
171
|
+
originalName?: string;
|
|
172
|
+
id?: string;
|
|
199
173
|
}
|
|
174
|
+
interface Price {
|
|
175
|
+
highPrice: number | null;
|
|
176
|
+
lowPrice: number | null;
|
|
177
|
+
}
|
|
178
|
+
interface PriceRange {
|
|
179
|
+
sellingPrice: Price;
|
|
180
|
+
listPrice: Price;
|
|
181
|
+
}
|
|
182
|
+
interface SpecificationGroup {
|
|
183
|
+
name: string;
|
|
184
|
+
originalName: string;
|
|
185
|
+
specifications: {
|
|
186
|
+
name: string;
|
|
187
|
+
originalName: string;
|
|
188
|
+
values: string[];
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Options, Context } from '../../index';
|
|
2
|
+
export declare type SearchEvent = {
|
|
3
|
+
type: 'search.query';
|
|
4
|
+
text: string;
|
|
5
|
+
misspelled: boolean;
|
|
6
|
+
match: number;
|
|
7
|
+
operator: 'and' | 'or';
|
|
8
|
+
session?: string;
|
|
9
|
+
anonymous?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const SP: ({ account }: Options, _: Context) => {
|
|
12
|
+
sendEvent: (options: SearchEvent) => Promise<any>;
|
|
13
|
+
};
|
|
@@ -22,31 +22,45 @@ export interface Context {
|
|
|
22
22
|
};
|
|
23
23
|
headers: Record<string, string>;
|
|
24
24
|
}
|
|
25
|
-
export declare type Resolver<R = unknown, A = unknown> = (root: R, args: A, ctx: Context, info: any) =>
|
|
25
|
+
export declare type Resolver<R = unknown, A = unknown, Return = any> = (root: R, args: A, ctx: Context, info: any) => Return;
|
|
26
26
|
export declare const getContextFactory: (options: Options) => (ctx: any) => Context;
|
|
27
27
|
export declare const getResolvers: (_: Options) => {
|
|
28
28
|
StoreCollection: Record<string, Resolver<import("./clients/commerce/types/Brand").Brand | import("./clients/commerce/types/Portal").CollectionPageType | (import("./clients/commerce/types/CategoryTree").CategoryTree & {
|
|
29
29
|
level: number;
|
|
30
|
-
}), unknown>>;
|
|
31
|
-
StoreAggregateOffer: Record<string,
|
|
30
|
+
}), unknown, any>>;
|
|
31
|
+
StoreAggregateOffer: Record<string, Resolver<{
|
|
32
|
+
items: import("./clients/search/types/ProductSearchResult").Item[];
|
|
32
33
|
product: import("./utils/enhanceSku").EnhancedSku;
|
|
33
|
-
}
|
|
34
|
-
|
|
34
|
+
}, unknown, any>> & {
|
|
35
|
+
offers: Resolver<{
|
|
36
|
+
items: import("./clients/search/types/ProductSearchResult").Item[];
|
|
37
|
+
product: import("./utils/enhanceSku").EnhancedSku;
|
|
38
|
+
}, any, (import("./clients/search/types/ProductSearchResult").Item & {
|
|
39
|
+
product: import("./utils/enhanceSku").EnhancedSku;
|
|
40
|
+
})[]>;
|
|
41
|
+
};
|
|
42
|
+
StoreProduct: Record<string, Resolver<import("./utils/enhanceSku").EnhancedSku, unknown, any>> & {
|
|
43
|
+
offers: Resolver<import("./utils/enhanceSku").EnhancedSku, any, {
|
|
44
|
+
items: import("./clients/search/types/ProductSearchResult").Item[];
|
|
45
|
+
product: import("./utils/enhanceSku").EnhancedSku;
|
|
46
|
+
}>;
|
|
47
|
+
isVariantOf: Resolver<import("./utils/enhanceSku").EnhancedSku, any, import("./utils/enhanceSku").EnhancedSku>;
|
|
48
|
+
};
|
|
35
49
|
StoreSeo: Record<string, Resolver<{
|
|
36
50
|
title?: string | undefined;
|
|
37
51
|
description?: string | undefined;
|
|
38
|
-
}, unknown>>;
|
|
39
|
-
StoreFacet: Record<string, Resolver<import("./clients/search/types/
|
|
40
|
-
StoreFacetValue: Record<string, Resolver<import("./clients/search/types/
|
|
41
|
-
StoreOffer: Record<string, Resolver<(import("./clients/
|
|
52
|
+
}, unknown, any>>;
|
|
53
|
+
StoreFacet: Record<string, Resolver<import("./clients/search/types/FacetSearchResult").Facet, unknown, any>>;
|
|
54
|
+
StoreFacetValue: Record<string, Resolver<import("./clients/search/types/FacetSearchResult").FacetValue, unknown, any>>;
|
|
55
|
+
StoreOffer: Record<string, Resolver<(import("./clients/search/types/ProductSearchResult").Item & {
|
|
42
56
|
product: import("./utils/enhanceSku").EnhancedSku;
|
|
43
57
|
}) | (import("./clients/commerce/types/OrderForm").OrderFormItem & {
|
|
44
58
|
product: Promise<import("./utils/enhanceSku").EnhancedSku>;
|
|
45
|
-
}), unknown>>;
|
|
46
|
-
StoreAggregateRating: Record<string, Resolver<unknown, unknown>>;
|
|
47
|
-
StoreReview: Record<string, Resolver<unknown, unknown>>;
|
|
48
|
-
StoreProductGroup: Record<string, Resolver<import("./
|
|
49
|
-
StoreSearchResult: Record<string, Resolver<Pick<import("./clients/search").SearchArgs, "hideUnavailableItems" | "query" | "page" | "count" | "sort" | "selectedFacets" | "fuzzy">, unknown>>;
|
|
59
|
+
}), unknown, any>>;
|
|
60
|
+
StoreAggregateRating: Record<string, Resolver<unknown, unknown, any>>;
|
|
61
|
+
StoreReview: Record<string, Resolver<unknown, unknown, any>>;
|
|
62
|
+
StoreProductGroup: Record<string, Resolver<import("./utils/enhanceSku").EnhancedSku, unknown, any>>;
|
|
63
|
+
StoreSearchResult: Record<string, Resolver<Pick<import("./clients/search").SearchArgs, "hideUnavailableItems" | "query" | "page" | "count" | "sort" | "selectedFacets" | "fuzzy">, unknown, any>>;
|
|
50
64
|
Query: {
|
|
51
65
|
product: (_: unknown, { locator }: import("../..").QueryProductArgs, ctx: Context) => Promise<import("./utils/enhanceSku").EnhancedSku>;
|
|
52
66
|
collection: (_: unknown, { slug }: import("../..").QueryCollectionArgs, ctx: Context) => Promise<import("./clients/commerce/types/Portal").CollectionPageType>;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import type { Item } from '../clients/search/types/ProductSearchResult';
|
|
2
|
+
import type { StoreProduct } from './product';
|
|
3
|
+
import type { PromiseType } from '../../../typings';
|
|
4
|
+
import type { Resolver } from '..';
|
|
1
5
|
import type { EnhancedSku } from '../utils/enhanceSku';
|
|
2
|
-
|
|
3
|
-
declare
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
declare type Root = PromiseType<ReturnType<typeof StoreProduct.offers>>;
|
|
7
|
+
export declare const StoreAggregateOffer: Record<string, Resolver<Root>> & {
|
|
8
|
+
offers: Resolver<Root, any, Array<Item & {
|
|
9
|
+
product: EnhancedSku;
|
|
10
|
+
}>>;
|
|
11
|
+
};
|
|
8
12
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Resolver } from '..';
|
|
2
|
-
import type {
|
|
3
|
-
declare type Root =
|
|
2
|
+
import type { Facet } from '../clients/search/types/FacetSearchResult';
|
|
3
|
+
declare type Root = Facet;
|
|
4
4
|
export declare const StoreFacet: Record<string, Resolver<Root>>;
|
|
5
5
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Resolver } from '..';
|
|
2
|
-
import type {
|
|
3
|
-
declare type Root =
|
|
2
|
+
import type { FacetValue } from '../clients/search/types/FacetSearchResult';
|
|
3
|
+
declare type Root = FacetValue;
|
|
4
4
|
export declare const StoreFacetValue: Record<string, Resolver<Root>>;
|
|
5
5
|
export {};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type { EnhancedSku } from '../utils/enhanceSku';
|
|
2
1
|
import type { Resolver } from '..';
|
|
3
|
-
import type {
|
|
2
|
+
import type { StoreAggregateOffer } from './aggregateOffer';
|
|
3
|
+
import type { ArrayElementType } from '../../../typings';
|
|
4
|
+
import type { EnhancedSku } from '../utils/enhanceSku';
|
|
4
5
|
import type { OrderFormItem } from '../clients/commerce/types/OrderForm';
|
|
5
|
-
declare type
|
|
6
|
-
product: EnhancedSku;
|
|
7
|
-
}) | (OrderFormItem & {
|
|
6
|
+
declare type OrderFormProduct = OrderFormItem & {
|
|
8
7
|
product: Promise<EnhancedSku>;
|
|
9
|
-
}
|
|
8
|
+
};
|
|
9
|
+
declare type SearchProduct = ArrayElementType<ReturnType<typeof StoreAggregateOffer.offers>>;
|
|
10
|
+
declare type Root = SearchProduct | OrderFormProduct;
|
|
10
11
|
export declare const StoreOffer: Record<string, Resolver<Root>>;
|
|
11
12
|
export {};
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import type { Resolver } from '..';
|
|
2
|
+
import type { PromiseType } from '../../../typings';
|
|
3
|
+
import type { Query } from './query';
|
|
4
|
+
import type { Item } from '../clients/search/types/ProductSearchResult';
|
|
2
5
|
import type { EnhancedSku } from '../utils/enhanceSku';
|
|
3
|
-
declare type Root =
|
|
4
|
-
export declare const StoreProduct: Record<string, Resolver<Root
|
|
6
|
+
declare type Root = PromiseType<ReturnType<typeof Query.product>>;
|
|
7
|
+
export declare const StoreProduct: Record<string, Resolver<Root>> & {
|
|
8
|
+
offers: Resolver<Root, any, {
|
|
9
|
+
items: Item[];
|
|
10
|
+
product: EnhancedSku;
|
|
11
|
+
}>;
|
|
12
|
+
isVariantOf: Resolver<Root, any, Root>;
|
|
13
|
+
};
|
|
5
14
|
export {};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import type { Product } from '../clients/search/types/ProductSearchResult';
|
|
2
1
|
import type { Resolver } from '..';
|
|
3
|
-
|
|
2
|
+
import type { PromiseType } from '../../../typings';
|
|
3
|
+
import type { StoreProduct } from './product';
|
|
4
|
+
declare type Root = PromiseType<ReturnType<typeof StoreProduct.isVariantOf>>;
|
|
5
|
+
export declare const StoreProductGroup: Record<string, Resolver<Root>>;
|
|
6
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Product,
|
|
2
|
-
export declare type EnhancedSku =
|
|
1
|
+
import type { Product, Item } from '../clients/search/types/ProductSearchResult';
|
|
2
|
+
export declare type EnhancedSku = Item & {
|
|
3
3
|
isVariantOf: Product;
|
|
4
4
|
};
|
|
5
|
-
export declare const enhanceSku: (
|
|
5
|
+
export declare const enhanceSku: (item: Item, product: Product) => EnhancedSku;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Item, Seller } from '../clients/search/types/ProductSearchResult';
|
|
2
|
+
export declare const inStock: (item: Item) => Seller | undefined;
|
|
3
|
+
export declare const getFirstSeller: (sellers: Seller[]) => Seller | undefined;
|
|
4
|
+
export declare const sortOfferByPrice: (items: Item[]) => Item[];
|
|
5
|
+
export declare const inStockOrderFormItem: (availability: string) => boolean;
|
package/dist/typings/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/api",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.33",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"graphql": "^15.6.0"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "bd144e2b299386767a92897c71d5b07223a5df23"
|
|
49
49
|
}
|