@faststore/api 1.12.41 → 1.12.42
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 +9 -1
- 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 +9 -1
- package/dist/api.esm.js.map +1 -1
- package/dist/platforms/vtex/clients/commerce/index.d.ts +2 -1
- package/dist/platforms/vtex/clients/commerce/types/ShippingData.d.ts +28 -0
- package/dist/platforms/vtex/clients/index.d.ts +1 -1
- package/package.json +2 -2
- package/src/platforms/vtex/clients/commerce/index.ts +10 -3
- package/src/platforms/vtex/clients/commerce/types/ShippingData.ts +31 -0
|
@@ -12,6 +12,7 @@ import type { Channel } from '../../utils/channel';
|
|
|
12
12
|
import type { SalesChannel } from './types/SalesChannel';
|
|
13
13
|
import { MasterDataResponse } from './types/Newsletter';
|
|
14
14
|
import type { Address, AddressInput } from './types/Address';
|
|
15
|
+
import { ShippingDataBody } from './types/ShippingData';
|
|
15
16
|
declare type ValueOf<T> = T extends Record<string, infer K> ? K : never;
|
|
16
17
|
export declare const VtexCommerce: ({ account, environment }: Options, ctx: Context) => {
|
|
17
18
|
catalog: {
|
|
@@ -37,7 +38,7 @@ export declare const VtexCommerce: ({ account, environment }: Options, ctx: Cont
|
|
|
37
38
|
simulation: (args: SimulationArgs, { salesChannel }?: SimulationOptions) => Promise<Simulation>;
|
|
38
39
|
shippingData: ({ id, body, }: {
|
|
39
40
|
id: string;
|
|
40
|
-
body:
|
|
41
|
+
body: ShippingDataBody;
|
|
41
42
|
}) => Promise<OrderForm>;
|
|
42
43
|
orderForm: ({ id, refreshOutdatedData, channel, }: {
|
|
43
44
|
id: string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface ShippingDataBody {
|
|
2
|
+
clearAddressIfPostalCodeNotFound?: boolean;
|
|
3
|
+
selectedAddresses?: SelectedAddress[];
|
|
4
|
+
logisticsInfo?: LogisticsInfo[];
|
|
5
|
+
}
|
|
6
|
+
export interface SelectedAddress {
|
|
7
|
+
addressType?: string;
|
|
8
|
+
receiverName?: string;
|
|
9
|
+
postalCode?: string | null;
|
|
10
|
+
city?: string;
|
|
11
|
+
state?: string;
|
|
12
|
+
country?: string;
|
|
13
|
+
street?: string;
|
|
14
|
+
number?: string;
|
|
15
|
+
neighborhood?: string;
|
|
16
|
+
complement?: string;
|
|
17
|
+
reference?: string;
|
|
18
|
+
geoCoordinates?: GeoCoordinates | null | [];
|
|
19
|
+
}
|
|
20
|
+
export interface GeoCoordinates {
|
|
21
|
+
latitude: GLfloat;
|
|
22
|
+
longitude: GLfloat;
|
|
23
|
+
}
|
|
24
|
+
export interface LogisticsInfo {
|
|
25
|
+
itemIndex?: number;
|
|
26
|
+
selectedDeliveryChannel?: string;
|
|
27
|
+
selectedSla?: string;
|
|
28
|
+
}
|
|
@@ -31,7 +31,7 @@ export declare const getClients: (options: Options, ctx: Context) => {
|
|
|
31
31
|
simulation: (args: import("./commerce/types/Simulation").SimulationArgs, { salesChannel }?: import("./commerce/types/Simulation").SimulationOptions) => Promise<import("./commerce/types/Simulation").Simulation>;
|
|
32
32
|
shippingData: ({ id, body, }: {
|
|
33
33
|
id: string;
|
|
34
|
-
body:
|
|
34
|
+
body: import("./commerce/types/ShippingData").ShippingDataBody;
|
|
35
35
|
}) => Promise<import("./commerce/types/OrderForm").OrderForm>;
|
|
36
36
|
orderForm: ({ id, refreshOutdatedData, channel, }: {
|
|
37
37
|
id: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/api",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.42",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"graphql": "^15.6.0"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "65e4e781d2b4864373e4b50b37511a095c674382"
|
|
50
50
|
}
|
|
@@ -19,6 +19,7 @@ import { getCookie } from '../../utils/getCookies'
|
|
|
19
19
|
import type { SalesChannel } from './types/SalesChannel'
|
|
20
20
|
import { MasterDataResponse } from './types/Newsletter'
|
|
21
21
|
import type { Address, AddressInput } from './types/Address'
|
|
22
|
+
import { ShippingDataBody } from './types/ShippingData'
|
|
22
23
|
|
|
23
24
|
type ValueOf<T> = T extends Record<string, infer K> ? K : never
|
|
24
25
|
|
|
@@ -94,8 +95,15 @@ export const VtexCommerce = (
|
|
|
94
95
|
body,
|
|
95
96
|
}: {
|
|
96
97
|
id: string
|
|
97
|
-
body:
|
|
98
|
+
body: ShippingDataBody
|
|
98
99
|
}): Promise<OrderForm> => {
|
|
100
|
+
if (body.selectedAddresses) {
|
|
101
|
+
body.selectedAddresses.forEach((address) => {
|
|
102
|
+
if (address.geoCoordinates === null) {
|
|
103
|
+
address.geoCoordinates = [];
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
99
107
|
return fetchAPI(
|
|
100
108
|
`${base}/api/checkout/pub/orderForm/${id}/attachments/shippingData`,
|
|
101
109
|
{
|
|
@@ -180,8 +188,7 @@ export const VtexCommerce = (
|
|
|
180
188
|
salesChannel,
|
|
181
189
|
}: RegionInput): Promise<Region> => {
|
|
182
190
|
return fetchAPI(
|
|
183
|
-
`${base}/api/checkout/pub/regions/?postalCode=${postalCode}&country=${country}&sc=${
|
|
184
|
-
salesChannel ?? ''
|
|
191
|
+
`${base}/api/checkout/pub/regions/?postalCode=${postalCode}&country=${country}&sc=${salesChannel ?? ''
|
|
185
192
|
}`
|
|
186
193
|
)
|
|
187
194
|
},
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface ShippingDataBody {
|
|
2
|
+
clearAddressIfPostalCodeNotFound?: boolean;
|
|
3
|
+
selectedAddresses?: SelectedAddress[];
|
|
4
|
+
logisticsInfo?: LogisticsInfo[];
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface SelectedAddress {
|
|
8
|
+
addressType?: string;
|
|
9
|
+
receiverName?: string;
|
|
10
|
+
postalCode?: string | null;
|
|
11
|
+
city?: string;
|
|
12
|
+
state?: string;
|
|
13
|
+
country?: string;
|
|
14
|
+
street?: string;
|
|
15
|
+
number?: string;
|
|
16
|
+
neighborhood?: string;
|
|
17
|
+
complement?: string;
|
|
18
|
+
reference?: string;
|
|
19
|
+
geoCoordinates?: GeoCoordinates | null | [];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface GeoCoordinates {
|
|
23
|
+
latitude: GLfloat;
|
|
24
|
+
longitude: GLfloat;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface LogisticsInfo {
|
|
28
|
+
itemIndex?: number;
|
|
29
|
+
selectedDeliveryChannel?: string;
|
|
30
|
+
selectedSla?: string;
|
|
31
|
+
}
|