@faststore/api 2.0.44-alpha.0 → 2.0.48-alpha.0
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 +18 -0
- package/dist/__generated__/schema.d.ts +3 -1
- package/dist/api.cjs.development.js +12 -8
- 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 +12 -8
- package/dist/api.esm.js.map +1 -1
- package/dist/platforms/vtex/clients/commerce/index.d.ts +2 -1
- package/dist/platforms/vtex/clients/index.d.ts +2 -1
- package/package.json +4 -4
- package/src/__generated__/schema.ts +3 -1
- package/src/platforms/vtex/clients/commerce/index.ts +6 -1
- package/src/platforms/vtex/resolvers/validateCart.ts +2 -1
- package/src/typeDefs/cart.graphql +1 -1
- package/src/typeDefs/order.graphql +4 -0
|
@@ -44,11 +44,12 @@ export declare const VtexCommerce: ({ account, environment }: Options, ctx: Cont
|
|
|
44
44
|
refreshOutdatedData?: boolean | undefined;
|
|
45
45
|
channel?: Required<Channel> | undefined;
|
|
46
46
|
}) => Promise<OrderForm>;
|
|
47
|
-
updateOrderFormItems: ({ id, orderItems, allowOutdatedData, salesChannel, }: {
|
|
47
|
+
updateOrderFormItems: ({ id, orderItems, allowOutdatedData, salesChannel, shouldSplitItem, }: {
|
|
48
48
|
id: string;
|
|
49
49
|
orderItems: OrderFormInputItem[];
|
|
50
50
|
allowOutdatedData?: "paymentData" | undefined;
|
|
51
51
|
salesChannel?: string | undefined;
|
|
52
|
+
shouldSplitItem?: boolean | null | undefined;
|
|
52
53
|
}) => Promise<OrderForm>;
|
|
53
54
|
setCustomData: ({ id, appId, key, value, }: {
|
|
54
55
|
id: string;
|
|
@@ -38,11 +38,12 @@ export declare const getClients: (options: Options, ctx: Context) => {
|
|
|
38
38
|
refreshOutdatedData?: boolean | undefined;
|
|
39
39
|
channel?: Required<import("../utils/channel").Channel> | undefined;
|
|
40
40
|
}) => Promise<import("./commerce/types/OrderForm").OrderForm>;
|
|
41
|
-
updateOrderFormItems: ({ id, orderItems, allowOutdatedData, salesChannel, }: {
|
|
41
|
+
updateOrderFormItems: ({ id, orderItems, allowOutdatedData, salesChannel, shouldSplitItem, }: {
|
|
42
42
|
id: string;
|
|
43
43
|
orderItems: import("./commerce/types/OrderForm").OrderFormInputItem[];
|
|
44
44
|
allowOutdatedData?: "paymentData" | undefined;
|
|
45
45
|
salesChannel?: string | undefined;
|
|
46
|
+
shouldSplitItem?: boolean | null | undefined;
|
|
46
47
|
}) => Promise<import("./commerce/types/OrderForm").OrderForm>;
|
|
47
48
|
setCustomData: ({ id, appId, key, value, }: {
|
|
48
49
|
id: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/api",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.48-alpha.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"p-limit": "^3.1.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@faststore/eslint-config": "^2.0.
|
|
34
|
-
"@faststore/shared": "^2.0.
|
|
33
|
+
"@faststore/eslint-config": "^2.0.48-alpha.0",
|
|
34
|
+
"@faststore/shared": "^2.0.48-alpha.0",
|
|
35
35
|
"@graphql-codegen/cli": "2.2.0",
|
|
36
36
|
"@graphql-codegen/typescript": "2.2.2",
|
|
37
37
|
"concurrently": "^6.2.1",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"graphql": "^15.6.0"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "13071d1410c4d42df70946ba27631549d2544d85"
|
|
52
52
|
}
|
|
@@ -133,7 +133,7 @@ export type IShippingItem = {
|
|
|
133
133
|
|
|
134
134
|
/** Shopping cart input. */
|
|
135
135
|
export type IStoreCart = {
|
|
136
|
-
/** Order information, including `orderNumber` and `
|
|
136
|
+
/** Order information, including `orderNumber`, `acceptedOffer` and `shouldSplitItem`. */
|
|
137
137
|
order: IStoreOrder;
|
|
138
138
|
};
|
|
139
139
|
|
|
@@ -172,6 +172,8 @@ export type IStoreOrder = {
|
|
|
172
172
|
acceptedOffer: Array<IStoreOffer>;
|
|
173
173
|
/** ID of the order in [VTEX order management](https://help.vtex.com/en/tutorial/license-manager-resources-oms--60QcBsvWeum02cFi3GjBzg#). */
|
|
174
174
|
orderNumber: Scalars['String'];
|
|
175
|
+
/** Indicates whether or not items with attachments should be split. */
|
|
176
|
+
shouldSplitItem?: Maybe<Scalars['Boolean']>;
|
|
175
177
|
};
|
|
176
178
|
|
|
177
179
|
/** Organization input. */
|
|
@@ -122,11 +122,13 @@ export const VtexCommerce = (
|
|
|
122
122
|
orderItems,
|
|
123
123
|
allowOutdatedData = 'paymentData',
|
|
124
124
|
salesChannel = ctx.storage.channel.salesChannel,
|
|
125
|
+
shouldSplitItem = true,
|
|
125
126
|
}: {
|
|
126
127
|
id: string
|
|
127
128
|
orderItems: OrderFormInputItem[]
|
|
128
129
|
allowOutdatedData?: 'paymentData'
|
|
129
130
|
salesChannel?: string
|
|
131
|
+
shouldSplitItem?: boolean | null
|
|
130
132
|
}): Promise<OrderForm> => {
|
|
131
133
|
const params = new URLSearchParams({
|
|
132
134
|
allowOutdatedData,
|
|
@@ -137,7 +139,10 @@ export const VtexCommerce = (
|
|
|
137
139
|
`${base}/api/checkout/pub/orderForm/${id}/items?${params}`,
|
|
138
140
|
{
|
|
139
141
|
...BASE_INIT,
|
|
140
|
-
body: JSON.stringify({
|
|
142
|
+
body: JSON.stringify({
|
|
143
|
+
orderItems,
|
|
144
|
+
noSplitItem: !shouldSplitItem,
|
|
145
|
+
}),
|
|
141
146
|
method: 'PATCH',
|
|
142
147
|
}
|
|
143
148
|
)
|
|
@@ -249,7 +249,7 @@ export const validateCart = async (
|
|
|
249
249
|
ctx: Context,
|
|
250
250
|
) => {
|
|
251
251
|
const { enableOrderFormSync } = ctx.storage.flags
|
|
252
|
-
const { orderNumber, acceptedOffer } = order
|
|
252
|
+
const { orderNumber, acceptedOffer, shouldSplitItem } = order
|
|
253
253
|
const {
|
|
254
254
|
clients: { commerce },
|
|
255
255
|
loaders: { skuLoader },
|
|
@@ -336,6 +336,7 @@ export const validateCart = async (
|
|
|
336
336
|
.updateOrderFormItems({
|
|
337
337
|
id: orderForm.orderFormId,
|
|
338
338
|
orderItems: changes,
|
|
339
|
+
shouldSplitItem,
|
|
339
340
|
})
|
|
340
341
|
// update orderForm etag so we know last time we touched this orderForm
|
|
341
342
|
.then((form) =>
|