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.
- package/dist/{admin-DVFAgnHm.d.ts → admin-CgER0AZn.d.cts} +3 -4
- package/dist/{admin-6xpHuyKc.d.cts → admin-CqasPNLl.d.ts} +3 -4
- package/dist/admin.cjs +9 -31
- 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 -31
- package/dist/admin.js.map +1 -1
- package/dist/{api-DJrUdQ1C.d.cts → api-CuqZQQGv.d.cts} +1 -7
- package/dist/{api-DJrUdQ1C.d.ts → api-CuqZQQGv.d.ts} +1 -7
- package/dist/index.cjs +10 -32
- 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 -32
- package/dist/index.js.map +1 -1
- package/dist/{inventory-GpWTZ2oe.d.ts → inventory-DNX8Vg-N.d.ts} +1 -1
- package/dist/{inventory-DOwNF3D-.d.cts → inventory-DrVRUkE2.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.cjs.map +1 -1
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.d.cts +2 -2
- package/dist/utils.d.ts +2 -2
- package/package.json +1 -1
package/dist/admin.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { a3 as AdminSession, a0 as ApiConfig, A as AuthStateListener, a6 as CreateAdminConfig, a7 as createAdmin } from './admin-
|
|
2
|
-
export { am as AuthStorage, al as HttpClientConfig } from './api-
|
|
3
|
-
import './inventory-
|
|
1
|
+
export { a3 as AdminSession, a0 as ApiConfig, A as AuthStateListener, a6 as CreateAdminConfig, a7 as createAdmin } from './admin-CgER0AZn.cjs';
|
|
2
|
+
export { am as AuthStorage, al as HttpClientConfig } from './api-CuqZQQGv.cjs';
|
|
3
|
+
import './inventory-DrVRUkE2.cjs';
|
package/dist/admin.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { a3 as AdminSession, a0 as ApiConfig, A as AuthStateListener, a6 as CreateAdminConfig, a7 as createAdmin } from './admin-
|
|
2
|
-
export { am as AuthStorage, al as HttpClientConfig } from './api-
|
|
3
|
-
import './inventory-
|
|
1
|
+
export { a3 as AdminSession, a0 as ApiConfig, A as AuthStateListener, a6 as CreateAdminConfig, a7 as createAdmin } from './admin-CqasPNLl.js';
|
|
2
|
+
export { am as AuthStorage, al as HttpClientConfig } from './api-CuqZQQGv.js';
|
|
3
|
+
import './inventory-DNX8Vg-N.js';
|
package/dist/admin.js
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
// src/utils/errors.ts
|
|
2
|
-
var convertServerErrorToRequestError = (serverError, renameRules) => {
|
|
3
|
-
const validationErrors = serverError?.validationErrors ?? [];
|
|
4
|
-
return {
|
|
5
|
-
...serverError,
|
|
6
|
-
validationErrors: validationErrors.map((validationError) => {
|
|
7
|
-
const field = validationError.field;
|
|
8
|
-
return {
|
|
9
|
-
field,
|
|
10
|
-
error: validationError.error || "GENERAL.VALIDATION_ERROR"
|
|
11
|
-
};
|
|
12
|
-
})
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
|
|
16
1
|
// src/utils/queryParams.ts
|
|
17
2
|
function buildQueryString(params) {
|
|
18
3
|
const queryParts = Object.entries(params).flatMap(
|
|
@@ -56,6 +41,12 @@ function toServerError(value, statusCode) {
|
|
|
56
41
|
validationErrors
|
|
57
42
|
};
|
|
58
43
|
}
|
|
44
|
+
function normalizeValidationErrors(validationErrors) {
|
|
45
|
+
return validationErrors.map((validationError) => ({
|
|
46
|
+
field: validationError.field,
|
|
47
|
+
error: validationError.error || "GENERAL.VALIDATION_ERROR"
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
59
50
|
function createHttpClient(cfg) {
|
|
60
51
|
const { authStorage } = cfg;
|
|
61
52
|
let refreshPromise = null;
|
|
@@ -186,11 +177,10 @@ function createHttpClient(cfg) {
|
|
|
186
177
|
}
|
|
187
178
|
if (!res.ok) {
|
|
188
179
|
const serverErr = toServerError(data, res.status);
|
|
189
|
-
const reqErr = convertServerErrorToRequestError(serverErr);
|
|
190
180
|
const requestId = res.headers.get("x-request-id") || res.headers.get("request-id");
|
|
191
181
|
const err = requestError("ApiError", serverErr.message, {
|
|
192
182
|
statusCode: serverErr.statusCode,
|
|
193
|
-
validationErrors:
|
|
183
|
+
validationErrors: normalizeValidationErrors(serverErr.validationErrors),
|
|
194
184
|
method,
|
|
195
185
|
url: fullUrl,
|
|
196
186
|
requestId: requestId || void 0
|
|
@@ -1104,14 +1094,6 @@ var createEshopApi = (apiConfig) => {
|
|
|
1104
1094
|
}
|
|
1105
1095
|
return response;
|
|
1106
1096
|
},
|
|
1107
|
-
async retryRefund(params, options) {
|
|
1108
|
-
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1109
|
-
return apiConfig.httpClient.post(
|
|
1110
|
-
`/v1/stores/${target_store_id}/orders/${params.order_id}/refunds/${params.refund_id}/retry`,
|
|
1111
|
-
{},
|
|
1112
|
-
options
|
|
1113
|
-
);
|
|
1114
|
-
},
|
|
1115
1097
|
async getPayment(params, options) {
|
|
1116
1098
|
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1117
1099
|
return apiConfig.httpClient.get(
|
|
@@ -2983,11 +2965,8 @@ function getBlockLabel(block) {
|
|
|
2983
2965
|
function formatBlockValue(block) {
|
|
2984
2966
|
if (block?.value === null || block?.value === void 0) return "";
|
|
2985
2967
|
if (block.type === "boolean") return block.value ? "Yes" : "No";
|
|
2986
|
-
if (block.type === "
|
|
2987
|
-
|
|
2988
|
-
if (properties.variant === "DATE" || properties.variant === "DATE_TIME") {
|
|
2989
|
-
return new Date(Number(block.value)).toLocaleDateString();
|
|
2990
|
-
}
|
|
2968
|
+
if (block.type === "date") {
|
|
2969
|
+
return new Date(Number(block.value) * 1e3).toLocaleDateString();
|
|
2991
2970
|
}
|
|
2992
2971
|
if (block.type === "media" && isRecord2(block.value)) {
|
|
2993
2972
|
const label = block.value.name ?? block.value.title ?? block.value.id;
|
|
@@ -3690,7 +3669,6 @@ function createAdmin(config) {
|
|
|
3690
3669
|
createRefund: eshopApi.createRefund,
|
|
3691
3670
|
getRefund: eshopApi.getRefund,
|
|
3692
3671
|
getRefunds: eshopApi.getRefunds,
|
|
3693
|
-
retryRefund: eshopApi.retryRefund,
|
|
3694
3672
|
getPayment: eshopApi.getPayment,
|
|
3695
3673
|
retryPaymentTransaction: eshopApi.retryPaymentTransaction,
|
|
3696
3674
|
getPaymentTransactions: eshopApi.getPaymentTransactions,
|