arky-sdk 0.3.138 → 0.3.140

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 CHANGED
@@ -944,9 +944,26 @@ var createEshopApi = (apiConfig) => {
944
944
  },
945
945
  // ===== PAYMENTS =====
946
946
  async getQuote(params, options) {
947
+ let blocks = params.blocks || [];
948
+ if (params.location && !blocks.some((b) => b.type === "ADDRESS")) {
949
+ const addressBlock = {
950
+ type: "ADDRESS",
951
+ id: crypto.randomUUID(),
952
+ key: "shipping_address",
953
+ properties: {
954
+ addressType: "SHIPPING"
955
+ },
956
+ value: [params.location]
957
+ };
958
+ blocks = [...blocks, addressBlock];
959
+ }
947
960
  const payload = {
948
961
  market: apiConfig.market,
949
- ...params
962
+ items: params.items,
963
+ blocks,
964
+ paymentMethodId: params.paymentMethodId,
965
+ shippingMethodId: params.shippingMethodId,
966
+ promoCode: params.promoCode
950
967
  };
951
968
  return apiConfig.httpClient.post(
952
969
  `/v1/businesses/${apiConfig.businessId}/orders/quote`,