arky-sdk 0.3.140 → 0.3.141
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/index.cjs +18 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -972,10 +972,27 @@ var createEshopApi = (apiConfig) => {
|
|
|
972
972
|
);
|
|
973
973
|
},
|
|
974
974
|
async checkout(params, options) {
|
|
975
|
+
let blocks = params.blocks || [];
|
|
976
|
+
if (params.address && !blocks.some((b) => b.type === "ADDRESS")) {
|
|
977
|
+
const addressBlock = {
|
|
978
|
+
type: "ADDRESS",
|
|
979
|
+
id: crypto.randomUUID(),
|
|
980
|
+
key: "shipping_address",
|
|
981
|
+
properties: {
|
|
982
|
+
addressType: "SHIPPING"
|
|
983
|
+
},
|
|
984
|
+
value: [params.address]
|
|
985
|
+
};
|
|
986
|
+
blocks = [...blocks, addressBlock];
|
|
987
|
+
}
|
|
975
988
|
const payload = {
|
|
976
989
|
businessId: apiConfig.businessId,
|
|
977
990
|
market: apiConfig.market,
|
|
978
|
-
|
|
991
|
+
items: params.items,
|
|
992
|
+
blocks,
|
|
993
|
+
paymentMethodId: params.paymentMethodId,
|
|
994
|
+
shippingMethodId: params.shippingMethodId,
|
|
995
|
+
promoCodeId: params.promoCodeId
|
|
979
996
|
};
|
|
980
997
|
return apiConfig.httpClient.post(
|
|
981
998
|
`/v1/businesses/${apiConfig.businessId}/orders/checkout`,
|