arky-sdk 0.3.139 → 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 +19 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -948,6 +948,7 @@ var createEshopApi = (apiConfig) => {
|
|
|
948
948
|
if (params.location && !blocks.some((b) => b.type === "ADDRESS")) {
|
|
949
949
|
const addressBlock = {
|
|
950
950
|
type: "ADDRESS",
|
|
951
|
+
id: crypto.randomUUID(),
|
|
951
952
|
key: "shipping_address",
|
|
952
953
|
properties: {
|
|
953
954
|
addressType: "SHIPPING"
|
|
@@ -971,10 +972,27 @@ var createEshopApi = (apiConfig) => {
|
|
|
971
972
|
);
|
|
972
973
|
},
|
|
973
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
|
+
}
|
|
974
988
|
const payload = {
|
|
975
989
|
businessId: apiConfig.businessId,
|
|
976
990
|
market: apiConfig.market,
|
|
977
|
-
|
|
991
|
+
items: params.items,
|
|
992
|
+
blocks,
|
|
993
|
+
paymentMethodId: params.paymentMethodId,
|
|
994
|
+
shippingMethodId: params.shippingMethodId,
|
|
995
|
+
promoCodeId: params.promoCodeId
|
|
978
996
|
};
|
|
979
997
|
return apiConfig.httpClient.post(
|
|
980
998
|
`/v1/businesses/${apiConfig.businessId}/orders/checkout`,
|