arky-sdk 0.9.18 → 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.
package/dist/index.cjs CHANGED
@@ -751,21 +751,6 @@ function createCartController(cartApi) {
751
751
  };
752
752
  }
753
753
 
754
- // src/utils/errors.ts
755
- var convertServerErrorToRequestError = (serverError, renameRules) => {
756
- const validationErrors = serverError?.validationErrors ?? [];
757
- return {
758
- ...serverError,
759
- validationErrors: validationErrors.map((validationError) => {
760
- const field = validationError.field;
761
- return {
762
- field,
763
- error: validationError.error || "GENERAL.VALIDATION_ERROR"
764
- };
765
- })
766
- };
767
- };
768
-
769
754
  // src/utils/queryParams.ts
770
755
  function buildQueryString(params) {
771
756
  const queryParts = Object.entries(params).flatMap(
@@ -809,6 +794,12 @@ function toServerError(value, statusCode) {
809
794
  validationErrors
810
795
  };
811
796
  }
797
+ function normalizeValidationErrors(validationErrors) {
798
+ return validationErrors.map((validationError) => ({
799
+ field: validationError.field,
800
+ error: validationError.error || "GENERAL.VALIDATION_ERROR"
801
+ }));
802
+ }
812
803
  function createHttpClient(cfg) {
813
804
  const { authStorage } = cfg;
814
805
  let refreshPromise = null;
@@ -939,11 +930,10 @@ function createHttpClient(cfg) {
939
930
  }
940
931
  if (!res.ok) {
941
932
  const serverErr = toServerError(data, res.status);
942
- const reqErr = convertServerErrorToRequestError(serverErr);
943
933
  const requestId = res.headers.get("x-request-id") || res.headers.get("request-id");
944
934
  const err = requestError("ApiError", serverErr.message, {
945
935
  statusCode: serverErr.statusCode,
946
- validationErrors: reqErr.validationErrors,
936
+ validationErrors: normalizeValidationErrors(serverErr.validationErrors),
947
937
  method,
948
938
  url: fullUrl,
949
939
  requestId: requestId || void 0
@@ -3775,11 +3765,8 @@ function getBlockLabel(block) {
3775
3765
  function formatBlockValue(block) {
3776
3766
  if (block?.value === null || block?.value === void 0) return "";
3777
3767
  if (block.type === "boolean") return block.value ? "Yes" : "No";
3778
- if (block.type === "number") {
3779
- const properties = isRecord2(block.properties) ? block.properties : {};
3780
- if (properties.variant === "DATE" || properties.variant === "DATE_TIME") {
3781
- return new Date(Number(block.value)).toLocaleDateString();
3782
- }
3768
+ if (block.type === "date") {
3769
+ return new Date(Number(block.value) * 1e3).toLocaleDateString();
3783
3770
  }
3784
3771
  if (block.type === "media" && isRecord2(block.value)) {
3785
3772
  const label = block.value.name ?? block.value.title ?? block.value.id;
@@ -4143,7 +4130,7 @@ function getFirstAvailableFCId(variant, quantity = 1) {
4143
4130
  }
4144
4131
 
4145
4132
  // src/index.ts
4146
- var SDK_VERSION = "0.9.18";
4133
+ var SDK_VERSION = "0.9.19";
4147
4134
  var SUPPORTED_FRAMEWORKS = [
4148
4135
  "astro",
4149
4136
  "react",