@faststore/api 2.1.98 → 2.1.102
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/dist/api.cjs.development.js +62 -119
- 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 +62 -119
- package/dist/api.esm.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/platforms/vtex/clients/commerce/types/OrderForm.d.ts +17 -17
- package/dist/platforms/vtex/clients/fetch.d.ts +1 -1
- package/dist/platforms/vtex/index.d.ts +2 -3
- package/dist/platforms/vtex/resolvers/mutation.d.ts +2 -2
- package/dist/platforms/vtex/resolvers/validateCart.d.ts +2 -2
- package/package.json +4 -4
- package/src/platforms/vtex/clients/commerce/index.ts +42 -40
- package/src/platforms/vtex/clients/commerce/types/OrderForm.ts +17 -17
- package/src/platforms/vtex/clients/fetch.ts +1 -9
- package/src/platforms/vtex/index.ts +10 -11
- package/src/platforms/vtex/resolvers/validateCart.ts +0 -2
- package/src/platforms/vtex/utils/shouldUpdateShippingData.ts +49 -102
- package/dist/utils/get-cookie-by-name.d.ts +0 -1
- package/src/utils/get-cookie-by-name.ts +0 -6
package/dist/index.d.ts
CHANGED
|
@@ -184,7 +184,7 @@ export declare const getResolvers: (options: Options) => {
|
|
|
184
184
|
parentAssemblyBinding: import("./__generated__/schema").Maybe<string>;
|
|
185
185
|
productCategoryIds: string;
|
|
186
186
|
priceTags: string[];
|
|
187
|
-
manualPrice: number;
|
|
187
|
+
manualPrice: number | null;
|
|
188
188
|
measurementUnit: string;
|
|
189
189
|
additionalInfo: {
|
|
190
190
|
brandName: string;
|
|
@@ -199,7 +199,7 @@ export declare const getResolvers: (options: Options) => {
|
|
|
199
199
|
sellerChain: string[];
|
|
200
200
|
availability: string;
|
|
201
201
|
unitMultiplier: number;
|
|
202
|
-
skuSpecifications
|
|
202
|
+
skuSpecifications?: import("./platforms/vtex/clients/commerce/types/OrderForm").SKUSpecification[] | null | undefined;
|
|
203
203
|
priceDefinition: {
|
|
204
204
|
calculatedSellingPrice: number;
|
|
205
205
|
sellingPrices: import("./platforms/vtex/clients/commerce/types/OrderForm").SellingPrice[];
|
|
@@ -31,7 +31,7 @@ export interface OrderFormItem {
|
|
|
31
31
|
parentAssemblyBinding: string | null;
|
|
32
32
|
productCategoryIds: string;
|
|
33
33
|
priceTags: string[];
|
|
34
|
-
manualPrice: number;
|
|
34
|
+
manualPrice: number | null;
|
|
35
35
|
measurementUnit: string;
|
|
36
36
|
additionalInfo: {
|
|
37
37
|
brandName: string;
|
|
@@ -46,7 +46,7 @@ export interface OrderFormItem {
|
|
|
46
46
|
sellerChain: string[];
|
|
47
47
|
availability: string;
|
|
48
48
|
unitMultiplier: number;
|
|
49
|
-
skuSpecifications
|
|
49
|
+
skuSpecifications?: SKUSpecification[] | null;
|
|
50
50
|
priceDefinition: {
|
|
51
51
|
calculatedSellingPrice: number;
|
|
52
52
|
sellingPrices: SellingPrice[];
|
|
@@ -127,7 +127,7 @@ export interface OrderForm {
|
|
|
127
127
|
currencyGroupSize: number;
|
|
128
128
|
startsWithCurrencySymbol: boolean;
|
|
129
129
|
};
|
|
130
|
-
currencyLocale:
|
|
130
|
+
currencyLocale: number;
|
|
131
131
|
currencySymbol: string;
|
|
132
132
|
saveUserData: boolean;
|
|
133
133
|
timeZone: string;
|
|
@@ -138,7 +138,7 @@ export interface OrderForm {
|
|
|
138
138
|
customData: OrderFormCustomData | null;
|
|
139
139
|
itemMetadata: {
|
|
140
140
|
items: MetadataItem[];
|
|
141
|
-
};
|
|
141
|
+
} | null;
|
|
142
142
|
hooksData: any | null;
|
|
143
143
|
ratesAndBenefitsData: {
|
|
144
144
|
rateAndBenefitsIdentifiers: any[];
|
|
@@ -217,21 +217,21 @@ export interface PaymentData {
|
|
|
217
217
|
availableTokens: any[];
|
|
218
218
|
}
|
|
219
219
|
export interface ClientProfileData {
|
|
220
|
-
email: string;
|
|
221
|
-
firstName: string;
|
|
222
|
-
lastName: string;
|
|
223
|
-
document: string;
|
|
224
|
-
documentType: string;
|
|
225
|
-
phone: string;
|
|
226
|
-
corporateName: string;
|
|
227
|
-
tradeName: string;
|
|
228
|
-
corporateDocument: string;
|
|
229
|
-
stateInscription: string;
|
|
230
|
-
corporatePhone: string;
|
|
220
|
+
email: string | null;
|
|
221
|
+
firstName: string | null;
|
|
222
|
+
lastName: string | null;
|
|
223
|
+
document: string | null;
|
|
224
|
+
documentType: string | null;
|
|
225
|
+
phone: string | null;
|
|
226
|
+
corporateName: string | null;
|
|
227
|
+
tradeName: string | null;
|
|
228
|
+
corporateDocument: string | null;
|
|
229
|
+
stateInscription: string | null;
|
|
230
|
+
corporatePhone: string | null;
|
|
231
231
|
isCorporate: boolean;
|
|
232
232
|
profileCompleteOnLoading: boolean;
|
|
233
233
|
profileErrorOnLoading: boolean;
|
|
234
|
-
customerClass: string;
|
|
234
|
+
customerClass: string | null;
|
|
235
235
|
}
|
|
236
236
|
export interface ShippingData {
|
|
237
237
|
address: CheckoutAddress | null;
|
|
@@ -295,7 +295,7 @@ export interface AvailableDeliveryWindows {
|
|
|
295
295
|
startDateUtc: string;
|
|
296
296
|
endDateUtc: string;
|
|
297
297
|
price: number;
|
|
298
|
-
|
|
298
|
+
lisPrice?: number;
|
|
299
299
|
tax: number;
|
|
300
300
|
}
|
|
301
301
|
export interface DeliveryId {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const fetchAPI: (info: RequestInfo, init?: RequestInit | undefined
|
|
1
|
+
export declare const fetchAPI: (info: RequestInfo, init?: RequestInit | undefined) => Promise<any>;
|
|
@@ -29,7 +29,6 @@ export interface Context {
|
|
|
29
29
|
locale: string;
|
|
30
30
|
flags: FeatureFlags;
|
|
31
31
|
searchArgs?: Omit<SearchArgs, 'type'>;
|
|
32
|
-
cookies?: string | null;
|
|
33
32
|
};
|
|
34
33
|
headers: Record<string, string>;
|
|
35
34
|
}
|
|
@@ -213,7 +212,7 @@ export declare const getResolvers: (_: Options) => {
|
|
|
213
212
|
parentAssemblyBinding: string | null;
|
|
214
213
|
productCategoryIds: string;
|
|
215
214
|
priceTags: string[];
|
|
216
|
-
manualPrice: number;
|
|
215
|
+
manualPrice: number | null;
|
|
217
216
|
measurementUnit: string;
|
|
218
217
|
additionalInfo: {
|
|
219
218
|
brandName: string;
|
|
@@ -228,7 +227,7 @@ export declare const getResolvers: (_: Options) => {
|
|
|
228
227
|
sellerChain: string[];
|
|
229
228
|
availability: string;
|
|
230
229
|
unitMultiplier: number;
|
|
231
|
-
skuSpecifications
|
|
230
|
+
skuSpecifications?: import("./clients/commerce/types/OrderForm").SKUSpecification[] | null | undefined;
|
|
232
231
|
priceDefinition: {
|
|
233
232
|
calculatedSellingPrice: number;
|
|
234
233
|
sellingPrices: import("./clients/commerce/types/OrderForm").SellingPrice[];
|
|
@@ -25,7 +25,7 @@ export declare const Mutation: {
|
|
|
25
25
|
parentAssemblyBinding: string | null;
|
|
26
26
|
productCategoryIds: string;
|
|
27
27
|
priceTags: string[];
|
|
28
|
-
manualPrice: number;
|
|
28
|
+
manualPrice: number | null;
|
|
29
29
|
measurementUnit: string;
|
|
30
30
|
additionalInfo: {
|
|
31
31
|
brandName: string;
|
|
@@ -40,7 +40,7 @@ export declare const Mutation: {
|
|
|
40
40
|
sellerChain: string[];
|
|
41
41
|
availability: string;
|
|
42
42
|
unitMultiplier: number;
|
|
43
|
-
skuSpecifications
|
|
43
|
+
skuSpecifications?: import("../clients/commerce/types/OrderForm").SKUSpecification[] | null | undefined;
|
|
44
44
|
priceDefinition: {
|
|
45
45
|
calculatedSellingPrice: number;
|
|
46
46
|
sellingPrices: import("../clients/commerce/types/OrderForm").SellingPrice[];
|
|
@@ -39,7 +39,7 @@ export declare const validateCart: (_: unknown, { cart: { order }, session }: Mu
|
|
|
39
39
|
parentAssemblyBinding: string | null;
|
|
40
40
|
productCategoryIds: string;
|
|
41
41
|
priceTags: string[];
|
|
42
|
-
manualPrice: number;
|
|
42
|
+
manualPrice: number | null;
|
|
43
43
|
measurementUnit: string;
|
|
44
44
|
additionalInfo: {
|
|
45
45
|
brandName: string;
|
|
@@ -54,7 +54,7 @@ export declare const validateCart: (_: unknown, { cart: { order }, session }: Mu
|
|
|
54
54
|
sellerChain: string[];
|
|
55
55
|
availability: string;
|
|
56
56
|
unitMultiplier: number;
|
|
57
|
-
skuSpecifications
|
|
57
|
+
skuSpecifications?: import("../clients/commerce/types/OrderForm").SKUSpecification[] | null | undefined;
|
|
58
58
|
priceDefinition: {
|
|
59
59
|
calculatedSellingPrice: number;
|
|
60
60
|
sellingPrices: import("../clients/commerce/types/OrderForm").SellingPrice[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/api",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.102",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@envelop/core": "^2.6.0",
|
|
39
|
-
"@faststore/eslint-config": "^2.1.
|
|
40
|
-
"@faststore/shared": "^2.1.
|
|
39
|
+
"@faststore/eslint-config": "^2.1.102",
|
|
40
|
+
"@faststore/shared": "^2.1.102",
|
|
41
41
|
"@graphql-codegen/cli": "2.2.0",
|
|
42
42
|
"@graphql-codegen/typescript": "2.2.2",
|
|
43
43
|
"@types/express": "^4.17.16",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"@envelop/core": "^1 || ^2",
|
|
57
57
|
"graphql": "^15.6.0"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "28bca332210f360f8d50888da020db73199851e6"
|
|
60
60
|
}
|
|
@@ -19,7 +19,6 @@ import type { SalesChannel } from './types/SalesChannel'
|
|
|
19
19
|
import { MasterDataResponse } from './types/Newsletter'
|
|
20
20
|
import type { Address, AddressInput } from './types/Address'
|
|
21
21
|
import { DeliveryMode, SelectedAddress } from './types/ShippingData'
|
|
22
|
-
import getCookieByName from '../../../../utils/get-cookie-by-name'
|
|
23
22
|
|
|
24
23
|
type ValueOf<T> = T extends Record<string, infer K> ? K : never
|
|
25
24
|
|
|
@@ -30,18 +29,6 @@ const BASE_INIT = {
|
|
|
30
29
|
},
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
const setCheckoutOrderFormOwnershipCookie = (
|
|
34
|
-
headers: Headers,
|
|
35
|
-
ctx: Context
|
|
36
|
-
) => {
|
|
37
|
-
if (headers) {
|
|
38
|
-
ctx.storage.cookies = `CheckoutOrderFormOwnership=${getCookieByName(
|
|
39
|
-
'CheckoutOrderFormOwnership',
|
|
40
|
-
headers.get('set-cookie') ?? ''
|
|
41
|
-
)}`
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
32
|
export const VtexCommerce = (
|
|
46
33
|
{ account, environment, incrementAddress }: Options,
|
|
47
34
|
ctx: Context
|
|
@@ -134,7 +121,6 @@ export const VtexCommerce = (
|
|
|
134
121
|
selectedAddresses: selectedAddresses,
|
|
135
122
|
clearAddressIfPostalCodeNotFound: incrementAddress,
|
|
136
123
|
}
|
|
137
|
-
|
|
138
124
|
return fetchAPI(
|
|
139
125
|
`${base}/api/checkout/pub/orderForm/${id}/attachments/shippingData`,
|
|
140
126
|
{
|
|
@@ -144,8 +130,7 @@ export const VtexCommerce = (
|
|
|
144
130
|
'content-type': 'application/json',
|
|
145
131
|
cookie: ctx.headers.cookie,
|
|
146
132
|
},
|
|
147
|
-
}
|
|
148
|
-
(headers) => setCheckoutOrderFormOwnershipCookie(headers, ctx)
|
|
133
|
+
}
|
|
149
134
|
)
|
|
150
135
|
},
|
|
151
136
|
|
|
@@ -163,11 +148,19 @@ export const VtexCommerce = (
|
|
|
163
148
|
refreshOutdatedData: refreshOutdatedData.toString(),
|
|
164
149
|
sc: salesChannel,
|
|
165
150
|
})
|
|
151
|
+
const requestInit: RequestInit = ctx.headers
|
|
152
|
+
? {
|
|
153
|
+
...BASE_INIT,
|
|
154
|
+
headers: {
|
|
155
|
+
'content-type': 'application/json',
|
|
156
|
+
cookie: ctx.headers.cookie,
|
|
157
|
+
},
|
|
158
|
+
}
|
|
159
|
+
: BASE_INIT
|
|
166
160
|
|
|
167
161
|
return fetchAPI(
|
|
168
162
|
`${base}/api/checkout/pub/orderForm/${id}?${params.toString()}`,
|
|
169
|
-
|
|
170
|
-
(headers) => setCheckoutOrderFormOwnershipCookie(headers, ctx)
|
|
163
|
+
requestInit
|
|
171
164
|
)
|
|
172
165
|
},
|
|
173
166
|
updateOrderFormItems: ({
|
|
@@ -188,17 +181,31 @@ export const VtexCommerce = (
|
|
|
188
181
|
sc: salesChannel,
|
|
189
182
|
})
|
|
190
183
|
|
|
184
|
+
const items = JSON.stringify({
|
|
185
|
+
orderItems,
|
|
186
|
+
noSplitItem: !shouldSplitItem,
|
|
187
|
+
})
|
|
188
|
+
|
|
189
|
+
const requestInit: RequestInit = ctx.headers
|
|
190
|
+
? {
|
|
191
|
+
headers: {
|
|
192
|
+
'content-type': 'application/json',
|
|
193
|
+
cookie: ctx.headers.cookie,
|
|
194
|
+
},
|
|
195
|
+
body: items,
|
|
196
|
+
method: 'PATCH',
|
|
197
|
+
}
|
|
198
|
+
: {
|
|
199
|
+
headers: {
|
|
200
|
+
'content-type': 'application/json',
|
|
201
|
+
},
|
|
202
|
+
body: items,
|
|
203
|
+
method: 'PATCH',
|
|
204
|
+
}
|
|
205
|
+
|
|
191
206
|
return fetchAPI(
|
|
192
207
|
`${base}/api/checkout/pub/orderForm/${id}/items?${params}`,
|
|
193
|
-
|
|
194
|
-
...BASE_INIT,
|
|
195
|
-
body: JSON.stringify({
|
|
196
|
-
orderItems,
|
|
197
|
-
noSplitItem: !shouldSplitItem,
|
|
198
|
-
}),
|
|
199
|
-
method: 'PATCH',
|
|
200
|
-
},
|
|
201
|
-
(headers) => setCheckoutOrderFormOwnershipCookie(headers, ctx)
|
|
208
|
+
requestInit
|
|
202
209
|
)
|
|
203
210
|
},
|
|
204
211
|
setCustomData: ({
|
|
@@ -218,8 +225,7 @@ export const VtexCommerce = (
|
|
|
218
225
|
...BASE_INIT,
|
|
219
226
|
body: JSON.stringify({ value }),
|
|
220
227
|
method: 'PUT',
|
|
221
|
-
}
|
|
222
|
-
(headers) => setCheckoutOrderFormOwnershipCookie(headers, ctx)
|
|
228
|
+
}
|
|
223
229
|
)
|
|
224
230
|
},
|
|
225
231
|
region: async ({
|
|
@@ -259,18 +265,14 @@ export const VtexCommerce = (
|
|
|
259
265
|
'items',
|
|
260
266
|
'profile.id,profile.email,profile.firstName,profile.lastName,store.channel,store.countryCode,store.cultureInfo,store.currencyCode,store.currencySymbol'
|
|
261
267
|
)
|
|
262
|
-
return fetchAPI(
|
|
263
|
-
|
|
264
|
-
{
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
'content-type': 'application/json',
|
|
268
|
-
cookie: ctx.headers.cookie,
|
|
269
|
-
},
|
|
270
|
-
body: '{}',
|
|
268
|
+
return fetchAPI(`${base}/api/sessions?${params.toString()}`, {
|
|
269
|
+
method: 'POST',
|
|
270
|
+
headers: {
|
|
271
|
+
'content-type': 'application/json',
|
|
272
|
+
cookie: ctx.headers.cookie,
|
|
271
273
|
},
|
|
272
|
-
|
|
273
|
-
)
|
|
274
|
+
body: '{}',
|
|
275
|
+
})
|
|
274
276
|
},
|
|
275
277
|
subscribeToNewsletter: (data: {
|
|
276
278
|
name: string
|
|
@@ -33,7 +33,7 @@ export interface OrderFormItem {
|
|
|
33
33
|
parentAssemblyBinding: string | null
|
|
34
34
|
productCategoryIds: string
|
|
35
35
|
priceTags: string[]
|
|
36
|
-
manualPrice: number
|
|
36
|
+
manualPrice: number | null
|
|
37
37
|
measurementUnit: string
|
|
38
38
|
additionalInfo: {
|
|
39
39
|
brandName: string
|
|
@@ -48,7 +48,7 @@ export interface OrderFormItem {
|
|
|
48
48
|
sellerChain: string[]
|
|
49
49
|
availability: string
|
|
50
50
|
unitMultiplier: number
|
|
51
|
-
skuSpecifications
|
|
51
|
+
skuSpecifications?: SKUSpecification[] | null
|
|
52
52
|
priceDefinition: {
|
|
53
53
|
calculatedSellingPrice: number
|
|
54
54
|
sellingPrices: SellingPrice[]
|
|
@@ -135,7 +135,7 @@ export interface OrderForm {
|
|
|
135
135
|
currencyGroupSize: number
|
|
136
136
|
startsWithCurrencySymbol: boolean
|
|
137
137
|
}
|
|
138
|
-
currencyLocale:
|
|
138
|
+
currencyLocale: number
|
|
139
139
|
currencySymbol: string
|
|
140
140
|
saveUserData: boolean
|
|
141
141
|
timeZone: string
|
|
@@ -146,7 +146,7 @@ export interface OrderForm {
|
|
|
146
146
|
customData: OrderFormCustomData | null
|
|
147
147
|
itemMetadata: {
|
|
148
148
|
items: MetadataItem[]
|
|
149
|
-
}
|
|
149
|
+
} | null
|
|
150
150
|
hooksData: any | null
|
|
151
151
|
ratesAndBenefitsData: {
|
|
152
152
|
rateAndBenefitsIdentifiers: any[]
|
|
@@ -229,21 +229,21 @@ export interface PaymentData {
|
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
export interface ClientProfileData {
|
|
232
|
-
email: string
|
|
233
|
-
firstName: string
|
|
234
|
-
lastName: string
|
|
235
|
-
document: string
|
|
236
|
-
documentType: string
|
|
237
|
-
phone: string
|
|
238
|
-
corporateName: string
|
|
239
|
-
tradeName: string
|
|
240
|
-
corporateDocument: string
|
|
241
|
-
stateInscription: string
|
|
242
|
-
corporatePhone: string
|
|
232
|
+
email: string | null
|
|
233
|
+
firstName: string | null
|
|
234
|
+
lastName: string | null
|
|
235
|
+
document: string | null
|
|
236
|
+
documentType: string | null
|
|
237
|
+
phone: string | null
|
|
238
|
+
corporateName: string | null
|
|
239
|
+
tradeName: string | null
|
|
240
|
+
corporateDocument: string | null
|
|
241
|
+
stateInscription: string | null
|
|
242
|
+
corporatePhone: string | null
|
|
243
243
|
isCorporate: boolean
|
|
244
244
|
profileCompleteOnLoading: boolean
|
|
245
245
|
profileErrorOnLoading: boolean
|
|
246
|
-
customerClass: string
|
|
246
|
+
customerClass: string | null
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
export interface ShippingData {
|
|
@@ -314,7 +314,7 @@ export interface AvailableDeliveryWindows {
|
|
|
314
314
|
startDateUtc: string,
|
|
315
315
|
endDateUtc: string,
|
|
316
316
|
price: number,
|
|
317
|
-
|
|
317
|
+
lisPrice?: number,
|
|
318
318
|
tax: number,
|
|
319
319
|
}
|
|
320
320
|
|
|
@@ -3,11 +3,7 @@ import packageJson from '../../../../package.json'
|
|
|
3
3
|
|
|
4
4
|
const USER_AGENT = `${packageJson.name}@${packageJson.version}`
|
|
5
5
|
|
|
6
|
-
export const fetchAPI = async (
|
|
7
|
-
info: RequestInfo,
|
|
8
|
-
init?: RequestInit,
|
|
9
|
-
getHeaders?: (headers: Headers) => void
|
|
10
|
-
) => {
|
|
6
|
+
export const fetchAPI = async (info: RequestInfo, init?: RequestInit) => {
|
|
11
7
|
const response = await fetch(info, {
|
|
12
8
|
...init,
|
|
13
9
|
headers: {
|
|
@@ -17,10 +13,6 @@ export const fetchAPI = async (
|
|
|
17
13
|
})
|
|
18
14
|
|
|
19
15
|
if (response.ok) {
|
|
20
|
-
if (getHeaders) {
|
|
21
|
-
getHeaders(response.headers)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
16
|
return response.status !== 204 ? response.json() : undefined
|
|
25
17
|
}
|
|
26
18
|
|
|
@@ -57,7 +57,6 @@ export interface Context {
|
|
|
57
57
|
locale: string
|
|
58
58
|
flags: FeatureFlags
|
|
59
59
|
searchArgs?: Omit<SearchArgs, 'type'>
|
|
60
|
-
cookies?: string | null
|
|
61
60
|
}
|
|
62
61
|
headers: Record<string, string>
|
|
63
62
|
}
|
|
@@ -93,16 +92,16 @@ const Resolvers = {
|
|
|
93
92
|
|
|
94
93
|
export const getContextFactory =
|
|
95
94
|
(options: Options) =>
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
95
|
+
(ctx: any): Context => {
|
|
96
|
+
ctx.storage = {
|
|
97
|
+
channel: ChannelMarshal.parse(options.channel),
|
|
98
|
+
flags: options.flags ?? {},
|
|
99
|
+
locale: options.locale,
|
|
100
|
+
}
|
|
101
|
+
ctx.clients = getClients(options, ctx)
|
|
102
|
+
ctx.loaders = getLoaders(options, ctx)
|
|
104
103
|
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
return ctx
|
|
105
|
+
}
|
|
107
106
|
|
|
108
107
|
export const getResolvers = (_: Options) => Resolvers
|
|
@@ -372,7 +372,6 @@ export const validateCart = async (
|
|
|
372
372
|
if (changes.length === 0) {
|
|
373
373
|
return null
|
|
374
374
|
}
|
|
375
|
-
|
|
376
375
|
// Step4: Apply delta changes to order form
|
|
377
376
|
const updatedOrderForm = await commerce.checkout
|
|
378
377
|
// update orderForm items
|
|
@@ -391,7 +390,6 @@ export const validateCart = async (
|
|
|
391
390
|
if (equals(order, updatedOrderForm)) {
|
|
392
391
|
return null
|
|
393
392
|
}
|
|
394
|
-
|
|
395
393
|
// Step6: There were changes, convert orderForm to StoreCart
|
|
396
394
|
return orderFormToCart(updatedOrderForm, skuLoader)
|
|
397
395
|
}
|