arky-sdk 0.9.18 → 0.9.20

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.
@@ -3914,11 +3914,7 @@ interface GetFormSubmissionsParams {
3914
3914
  }
3915
3915
  interface FindActionsParams {
3916
3916
  store_id?: string;
3917
- query?: string | number;
3918
3917
  contact_id?: string;
3919
- types?: string[];
3920
- from?: number;
3921
- to?: number;
3922
3918
  limit?: number;
3923
3919
  cursor?: string;
3924
3920
  }
@@ -3914,11 +3914,7 @@ interface GetFormSubmissionsParams {
3914
3914
  }
3915
3915
  interface FindActionsParams {
3916
3916
  store_id?: string;
3917
- query?: string | number;
3918
3917
  contact_id?: string;
3919
- types?: string[];
3920
- from?: number;
3921
- to?: number;
3922
3918
  limit?: number;
3923
3919
  cursor?: string;
3924
3920
  }
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
@@ -2044,11 +2034,7 @@ var createActionAdminApi = (apiConfig) => ({
2044
2034
  async find(params, options) {
2045
2035
  const store_id = params.store_id || apiConfig.storeId;
2046
2036
  const queryParams = {};
2047
- if (params.query) queryParams.query = params.query;
2048
2037
  if (params.contact_id) queryParams.contact_id = params.contact_id;
2049
- if (params.types && params.types.length > 0) queryParams.types = params.types;
2050
- if (params.from !== void 0) queryParams.from = params.from;
2051
- if (params.to !== void 0) queryParams.to = params.to;
2052
2038
  if (params.limit !== void 0) queryParams.limit = params.limit;
2053
2039
  if (params.cursor) queryParams.cursor = params.cursor;
2054
2040
  return apiConfig.httpClient.get(
@@ -2094,16 +2080,6 @@ var createContactApi = (apiConfig) => {
2094
2080
  }
2095
2081
  );
2096
2082
  },
2097
- async findActions(params, options) {
2098
- const { store_id, ...queryParams } = params || {};
2099
- return apiConfig.httpClient.get(
2100
- `/v1/stores/${store_id || apiConfig.storeId}/actions`,
2101
- {
2102
- ...options,
2103
- params: Object.keys(queryParams).length > 0 ? queryParams : void 0
2104
- }
2105
- );
2106
- },
2107
2083
  async update(params, options) {
2108
2084
  const { id, store_id, ...body } = params;
2109
2085
  return apiConfig.httpClient.put(
@@ -3775,11 +3751,8 @@ function getBlockLabel(block) {
3775
3751
  function formatBlockValue(block) {
3776
3752
  if (block?.value === null || block?.value === void 0) return "";
3777
3753
  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
- }
3754
+ if (block.type === "date") {
3755
+ return new Date(Number(block.value) * 1e3).toLocaleDateString();
3783
3756
  }
3784
3757
  if (block.type === "media" && isRecord2(block.value)) {
3785
3758
  const label = block.value.name ?? block.value.title ?? block.value.id;
@@ -4143,7 +4116,7 @@ function getFirstAvailableFCId(variant, quantity = 1) {
4143
4116
  }
4144
4117
 
4145
4118
  // src/index.ts
4146
- var SDK_VERSION = "0.9.18";
4119
+ var SDK_VERSION = "0.9.20";
4147
4120
  var SUPPORTED_FRAMEWORKS = [
4148
4121
  "astro",
4149
4122
  "react",