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.
- package/dist/{admin-yoFJKZB8.d.ts → admin-CTtJoarO.d.ts} +3 -3
- package/dist/{admin-CBgRGUCX.d.cts → admin-DB_GYW2b.d.cts} +3 -3
- package/dist/admin.cjs +9 -36
- package/dist/admin.cjs.map +1 -1
- package/dist/admin.d.cts +3 -3
- package/dist/admin.d.ts +3 -3
- package/dist/admin.js +9 -36
- package/dist/admin.js.map +1 -1
- package/dist/{api-CuqZQQGv.d.cts → api-C_2AMzmc.d.cts} +0 -4
- package/dist/{api-CuqZQQGv.d.ts → api-C_2AMzmc.d.ts} +0 -4
- package/dist/index.cjs +10 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +10 -37
- package/dist/index.js.map +1 -1
- package/dist/{inventory-DNX8Vg-N.d.ts → inventory-DdgZ5MI_.d.ts} +1 -1
- package/dist/{inventory-DrVRUkE2.d.cts → inventory-DgPpeRWU.d.cts} +1 -1
- package/dist/storefront.cjs +9 -22
- package/dist/storefront.cjs.map +1 -1
- package/dist/storefront.d.cts +5 -5
- package/dist/storefront.d.ts +5 -5
- package/dist/storefront.js +9 -22
- package/dist/storefront.js.map +1 -1
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils.d.cts +2 -2
- package/dist/utils.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as OrderMoney, I as InventoryLevel } from './api-
|
|
1
|
+
import { O as OrderMoney, I as InventoryLevel } from './api-C_2AMzmc.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-
|
|
1
|
+
import { O as OrderMoney, I as InventoryLevel } from './api-C_2AMzmc.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"];
|
package/dist/storefront.cjs
CHANGED
|
@@ -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:
|
|
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 === "
|
|
1131
|
-
|
|
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;
|