arky-sdk 0.9.17 → 0.9.19

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.
@@ -1,4 +1,4 @@
1
- import { O as OrderMoney, I as InventoryLevel } from './api-DJrUdQ1C.js';
1
+ import { O as OrderMoney, I as InventoryLevel } from './api-CuqZQQGv.js';
2
2
 
3
3
  type OrderTotal = Pick<OrderMoney, 'total' | 'currency'>;
4
4
  declare const SUPPORTED_STORE_CURRENCIES: readonly ["USD", "EUR", "GBP", "JPY", "CNY", "CHF", "AUD", "CAD", "HKD", "SGD", "NZD", "KRW", "SEK", "NOK", "DKK", "INR", "MXN", "BRL", "ZAR", "RUB", "TRY", "PLN", "THB", "IDR", "MYR", "PHP", "CZK", "ILS", "AED", "SAR", "HUF", "RON", "BGN", "HRK", "BAM", "RSD", "MKD", "ALL"];
@@ -1,4 +1,4 @@
1
- import { O as OrderMoney, I as InventoryLevel } from './api-DJrUdQ1C.cjs';
1
+ import { O as OrderMoney, I as InventoryLevel } from './api-CuqZQQGv.cjs';
2
2
 
3
3
  type OrderTotal = Pick<OrderMoney, 'total' | 'currency'>;
4
4
  declare const SUPPORTED_STORE_CURRENCIES: readonly ["USD", "EUR", "GBP", "JPY", "CNY", "CHF", "AUD", "CAD", "HKD", "SGD", "NZD", "KRW", "SEK", "NOK", "DKK", "INR", "MXN", "BRL", "ZAR", "RUB", "TRY", "PLN", "THB", "IDR", "MYR", "PHP", "CZK", "ILS", "AED", "SAR", "HUF", "RON", "BGN", "HRK", "BAM", "RSD", "MKD", "ALL"];
@@ -746,21 +746,6 @@ function createCartController(cartApi) {
746
746
  };
747
747
  }
748
748
 
749
- // src/utils/errors.ts
750
- var convertServerErrorToRequestError = (serverError, renameRules) => {
751
- const validationErrors = serverError?.validationErrors ?? [];
752
- return {
753
- ...serverError,
754
- validationErrors: validationErrors.map((validationError) => {
755
- const field = validationError.field;
756
- return {
757
- field,
758
- error: validationError.error || "GENERAL.VALIDATION_ERROR"
759
- };
760
- })
761
- };
762
- };
763
-
764
749
  // src/utils/queryParams.ts
765
750
  function buildQueryString(params) {
766
751
  const queryParts = Object.entries(params).flatMap(
@@ -804,6 +789,12 @@ function toServerError(value, statusCode) {
804
789
  validationErrors
805
790
  };
806
791
  }
792
+ function normalizeValidationErrors(validationErrors) {
793
+ return validationErrors.map((validationError) => ({
794
+ field: validationError.field,
795
+ error: validationError.error || "GENERAL.VALIDATION_ERROR"
796
+ }));
797
+ }
807
798
  function createHttpClient(cfg) {
808
799
  const { authStorage } = cfg;
809
800
  let refreshPromise = null;
@@ -934,11 +925,10 @@ function createHttpClient(cfg) {
934
925
  }
935
926
  if (!res.ok) {
936
927
  const serverErr = toServerError(data, res.status);
937
- const reqErr = convertServerErrorToRequestError(serverErr);
938
928
  const requestId = res.headers.get("x-request-id") || res.headers.get("request-id");
939
929
  const err = requestError("ApiError", serverErr.message, {
940
930
  statusCode: serverErr.statusCode,
941
- validationErrors: reqErr.validationErrors,
931
+ validationErrors: normalizeValidationErrors(serverErr.validationErrors),
942
932
  method,
943
933
  url: fullUrl,
944
934
  requestId: requestId || void 0
@@ -1127,11 +1117,8 @@ function getBlockLabel(block) {
1127
1117
  function formatBlockValue(block) {
1128
1118
  if (block?.value === null || block?.value === void 0) return "";
1129
1119
  if (block.type === "boolean") return block.value ? "Yes" : "No";
1130
- if (block.type === "number") {
1131
- const properties = isRecord2(block.properties) ? block.properties : {};
1132
- if (properties.variant === "DATE" || properties.variant === "DATE_TIME") {
1133
- return new Date(Number(block.value)).toLocaleDateString();
1134
- }
1120
+ if (block.type === "date") {
1121
+ return new Date(Number(block.value) * 1e3).toLocaleDateString();
1135
1122
  }
1136
1123
  if (block.type === "media" && isRecord2(block.value)) {
1137
1124
  const label = block.value.name ?? block.value.title ?? block.value.id;