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/{admin-CBgRGUCX.d.cts → admin-CgER0AZn.d.cts} +1 -1
- package/dist/{admin-yoFJKZB8.d.ts → admin-CqasPNLl.d.ts} +1 -1
- package/dist/admin.cjs +9 -22
- package/dist/admin.cjs.map +1 -1
- package/dist/admin.d.cts +1 -1
- package/dist/admin.d.ts +1 -1
- package/dist/admin.js +9 -22
- package/dist/admin.js.map +1 -1
- package/dist/index.cjs +10 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -23
- package/dist/index.js.map +1 -1
- package/dist/storefront.cjs +9 -22
- package/dist/storefront.cjs.map +1 -1
- package/dist/storefront.d.cts +2 -2
- package/dist/storefront.d.ts +2 -2
- package/dist/storefront.js +9 -22
- package/dist/storefront.js.map +1 -1
- package/package.json +1 -1
|
@@ -690,7 +690,7 @@ declare function fetchSvgContent(mediaObject: unknown): Promise<string | null>;
|
|
|
690
690
|
declare function getSvgContentForAstro(mediaObject: unknown): Promise<string>;
|
|
691
691
|
declare function injectSvgIntoElement(mediaObject: unknown, targetElement: HTMLElement, className?: string): Promise<void>;
|
|
692
692
|
|
|
693
|
-
declare const SDK_VERSION = "0.9.
|
|
693
|
+
declare const SDK_VERSION = "0.9.19";
|
|
694
694
|
declare const SUPPORTED_FRAMEWORKS: readonly ["astro", "react", "vue", "svelte", "vanilla"];
|
|
695
695
|
|
|
696
696
|
interface ApiConfig {
|
|
@@ -690,7 +690,7 @@ declare function fetchSvgContent(mediaObject: unknown): Promise<string | null>;
|
|
|
690
690
|
declare function getSvgContentForAstro(mediaObject: unknown): Promise<string>;
|
|
691
691
|
declare function injectSvgIntoElement(mediaObject: unknown, targetElement: HTMLElement, className?: string): Promise<void>;
|
|
692
692
|
|
|
693
|
-
declare const SDK_VERSION = "0.9.
|
|
693
|
+
declare const SDK_VERSION = "0.9.19";
|
|
694
694
|
declare const SUPPORTED_FRAMEWORKS: readonly ["astro", "react", "vue", "svelte", "vanilla"];
|
|
695
695
|
|
|
696
696
|
interface ApiConfig {
|
package/dist/admin.cjs
CHANGED
|
@@ -1,20 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// src/utils/errors.ts
|
|
4
|
-
var convertServerErrorToRequestError = (serverError, renameRules) => {
|
|
5
|
-
const validationErrors = serverError?.validationErrors ?? [];
|
|
6
|
-
return {
|
|
7
|
-
...serverError,
|
|
8
|
-
validationErrors: validationErrors.map((validationError) => {
|
|
9
|
-
const field = validationError.field;
|
|
10
|
-
return {
|
|
11
|
-
field,
|
|
12
|
-
error: validationError.error || "GENERAL.VALIDATION_ERROR"
|
|
13
|
-
};
|
|
14
|
-
})
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
|
|
18
3
|
// src/utils/queryParams.ts
|
|
19
4
|
function buildQueryString(params) {
|
|
20
5
|
const queryParts = Object.entries(params).flatMap(
|
|
@@ -58,6 +43,12 @@ function toServerError(value, statusCode) {
|
|
|
58
43
|
validationErrors
|
|
59
44
|
};
|
|
60
45
|
}
|
|
46
|
+
function normalizeValidationErrors(validationErrors) {
|
|
47
|
+
return validationErrors.map((validationError) => ({
|
|
48
|
+
field: validationError.field,
|
|
49
|
+
error: validationError.error || "GENERAL.VALIDATION_ERROR"
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
61
52
|
function createHttpClient(cfg) {
|
|
62
53
|
const { authStorage } = cfg;
|
|
63
54
|
let refreshPromise = null;
|
|
@@ -188,11 +179,10 @@ function createHttpClient(cfg) {
|
|
|
188
179
|
}
|
|
189
180
|
if (!res.ok) {
|
|
190
181
|
const serverErr = toServerError(data, res.status);
|
|
191
|
-
const reqErr = convertServerErrorToRequestError(serverErr);
|
|
192
182
|
const requestId = res.headers.get("x-request-id") || res.headers.get("request-id");
|
|
193
183
|
const err = requestError("ApiError", serverErr.message, {
|
|
194
184
|
statusCode: serverErr.statusCode,
|
|
195
|
-
validationErrors:
|
|
185
|
+
validationErrors: normalizeValidationErrors(serverErr.validationErrors),
|
|
196
186
|
method,
|
|
197
187
|
url: fullUrl,
|
|
198
188
|
requestId: requestId || void 0
|
|
@@ -2977,11 +2967,8 @@ function getBlockLabel(block) {
|
|
|
2977
2967
|
function formatBlockValue(block) {
|
|
2978
2968
|
if (block?.value === null || block?.value === void 0) return "";
|
|
2979
2969
|
if (block.type === "boolean") return block.value ? "Yes" : "No";
|
|
2980
|
-
if (block.type === "
|
|
2981
|
-
|
|
2982
|
-
if (properties.variant === "DATE" || properties.variant === "DATE_TIME") {
|
|
2983
|
-
return new Date(Number(block.value)).toLocaleDateString();
|
|
2984
|
-
}
|
|
2970
|
+
if (block.type === "date") {
|
|
2971
|
+
return new Date(Number(block.value) * 1e3).toLocaleDateString();
|
|
2985
2972
|
}
|
|
2986
2973
|
if (block.type === "media" && isRecord2(block.value)) {
|
|
2987
2974
|
const label = block.value.name ?? block.value.title ?? block.value.id;
|