@ecomiq/core 0.1.3 → 0.1.6
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/api.cjs +19 -5
- package/dist/api.cjs.map +1 -1
- package/dist/api.js +19 -5
- package/dist/api.js.map +1 -1
- package/dist/client-4ZTG2RZ3.d.ts +195 -0
- package/dist/client-BpX4yR6S.d.cts +195 -0
- package/dist/client.cjs +331 -12
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +13 -84
- package/dist/client.d.ts +13 -84
- package/dist/client.js +331 -12
- package/dist/client.js.map +1 -1
- package/dist/index.cjs +484 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +327 -324
- package/dist/index.d.ts +327 -324
- package/dist/index.js +451 -13
- package/dist/index.js.map +1 -1
- package/dist/models/collections.d.cts +4 -4
- package/dist/models/collections.d.ts +4 -4
- package/dist/models/customer-address.cjs +41 -0
- package/dist/models/customer-address.cjs.map +1 -0
- package/dist/models/customer-address.d.cts +160 -0
- package/dist/models/customer-address.d.ts +160 -0
- package/dist/models/customer-address.js +36 -0
- package/dist/models/customer-address.js.map +1 -0
- package/dist/models/customer-order.cjs +161 -0
- package/dist/models/customer-order.cjs.map +1 -0
- package/dist/models/customer-order.d.cts +896 -0
- package/dist/models/customer-order.d.ts +896 -0
- package/dist/models/customer-order.js +149 -0
- package/dist/models/customer-order.js.map +1 -0
- package/dist/models/customer-profile.cjs +126 -0
- package/dist/models/customer-profile.cjs.map +1 -0
- package/dist/models/customer-profile.d.cts +178 -0
- package/dist/models/customer-profile.d.ts +178 -0
- package/dist/models/customer-profile.js +118 -0
- package/dist/models/customer-profile.js.map +1 -0
- package/dist/models/geo.d.cts +14 -14
- package/dist/models/geo.d.ts +14 -14
- package/dist/models/products.d.cts +130 -130
- package/dist/models/products.d.ts +130 -130
- package/dist/models/search.d.cts +4 -4
- package/dist/models/search.d.ts +4 -4
- package/dist/models/settings.cjs +13 -6
- package/dist/models/settings.cjs.map +1 -1
- package/dist/models/settings.d.cts +844 -841
- package/dist/models/settings.d.ts +844 -841
- package/dist/models/settings.js +12 -7
- package/dist/models/settings.js.map +1 -1
- package/dist/models/storefront-cart.d.cts +80 -80
- package/dist/models/storefront-cart.d.ts +80 -80
- package/dist/models/storefront-checkout.d.cts +400 -400
- package/dist/models/storefront-checkout.d.ts +400 -400
- package/dist/models/storefront-reviews.d.cts +8 -8
- package/dist/models/storefront-reviews.d.ts +8 -8
- package/package.json +16 -1
package/dist/client.cjs
CHANGED
|
@@ -20,6 +20,7 @@ var ApiError = class extends Error {
|
|
|
20
20
|
function resolveApiBaseUrl(baseUrl = DEFAULT_API_BASE_URL, version = DEFAULT_API_VERSION) {
|
|
21
21
|
const root = baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`;
|
|
22
22
|
const segment = version.replace(/^\/+|\/+$/g, "");
|
|
23
|
+
if (!segment) return root;
|
|
23
24
|
return new URL(`${segment}/`, root).toString();
|
|
24
25
|
}
|
|
25
26
|
function createApi(options = {}) {
|
|
@@ -62,17 +63,30 @@ function createApi(options = {}) {
|
|
|
62
63
|
clearTimeout(timeout);
|
|
63
64
|
}
|
|
64
65
|
if (!response.ok) {
|
|
65
|
-
const
|
|
66
|
-
let body =
|
|
67
|
-
if (
|
|
66
|
+
const bodyText2 = await response.text().catch(() => void 0);
|
|
67
|
+
let body = bodyText2;
|
|
68
|
+
if (bodyText2) {
|
|
68
69
|
try {
|
|
69
|
-
body = JSON.parse(
|
|
70
|
+
body = JSON.parse(bodyText2);
|
|
70
71
|
} catch {
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
throw new ApiError(`${method} ${url} \u2192 ${response.status}`, response.status, url.toString(), body);
|
|
74
75
|
}
|
|
75
|
-
const
|
|
76
|
+
const bodyText = await response.text();
|
|
77
|
+
let json = null;
|
|
78
|
+
if (bodyText.trim()) {
|
|
79
|
+
try {
|
|
80
|
+
json = JSON.parse(bodyText);
|
|
81
|
+
} catch {
|
|
82
|
+
throw new ApiError(
|
|
83
|
+
`Respuesta no JSON de ${url}`,
|
|
84
|
+
response.status,
|
|
85
|
+
url.toString(),
|
|
86
|
+
bodyText
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
76
90
|
const parsed = schema.safeParse(json);
|
|
77
91
|
if (!parsed.success) {
|
|
78
92
|
throw new ApiError(
|
|
@@ -289,6 +303,11 @@ var JsonElementSchema = zod.z.lazy(
|
|
|
289
303
|
var DateTimeOffsetSchema = zod.z.string().datetime({ offset: true });
|
|
290
304
|
var NullableDateTimeOffsetSchema = DateTimeOffsetSchema.nullable();
|
|
291
305
|
var NullableUuidSchema = zod.z.string().uuid().nullable();
|
|
306
|
+
var EntityIdSchema = zod.z.union([
|
|
307
|
+
zod.z.string().uuid(),
|
|
308
|
+
zod.z.string().regex(/^\d+$/, "Expected numeric id")
|
|
309
|
+
]);
|
|
310
|
+
var NullableEntityIdSchema = EntityIdSchema.nullable();
|
|
292
311
|
var StoreTypeSchema = zod.z.enum([
|
|
293
312
|
"b2C",
|
|
294
313
|
"marketplace",
|
|
@@ -351,9 +370,9 @@ var StoreCheckoutSettingsSchema = zod.z.object({
|
|
|
351
370
|
ordersAndPayments: StoreCheckoutOrdersAndPaymentsSettingsSchema
|
|
352
371
|
}).strict();
|
|
353
372
|
var StorefrontStoreShape = {
|
|
354
|
-
id:
|
|
355
|
-
tenantId:
|
|
356
|
-
sellerId:
|
|
373
|
+
id: EntityIdSchema,
|
|
374
|
+
tenantId: EntityIdSchema,
|
|
375
|
+
sellerId: NullableEntityIdSchema,
|
|
357
376
|
type: StoreTypeSchema,
|
|
358
377
|
isActive: zod.z.boolean(),
|
|
359
378
|
name: zod.z.string(),
|
|
@@ -434,13 +453,13 @@ var CmsMenuDtoSchema = zod.z.object({
|
|
|
434
453
|
items: zod.z.array(CmsMenuItemSchema)
|
|
435
454
|
}).strict();
|
|
436
455
|
var CmsBlockDtoSchema = zod.z.object({
|
|
437
|
-
id:
|
|
456
|
+
id: EntityIdSchema,
|
|
438
457
|
type: zod.z.string(),
|
|
439
458
|
order: zod.z.number().int(),
|
|
440
459
|
settings: JsonElementSchema
|
|
441
460
|
}).strict();
|
|
442
461
|
var CmsSectionDtoSchema = zod.z.object({
|
|
443
|
-
id:
|
|
462
|
+
id: EntityIdSchema,
|
|
444
463
|
type: zod.z.string(),
|
|
445
464
|
order: zod.z.number().int(),
|
|
446
465
|
settings: JsonElementSchema,
|
|
@@ -449,7 +468,7 @@ var CmsSectionDtoSchema = zod.z.object({
|
|
|
449
468
|
var CmsContentChannelSchema = zod.z.enum(["storefront", "pos"]);
|
|
450
469
|
var CmsPageStatusSchema = zod.z.enum(["draft", "published", "archived"]);
|
|
451
470
|
var CmsPageDetailsDtoSchema = zod.z.object({
|
|
452
|
-
id:
|
|
471
|
+
id: EntityIdSchema,
|
|
453
472
|
name: zod.z.string(),
|
|
454
473
|
slug: zod.z.string(),
|
|
455
474
|
channel: CmsContentChannelSchema,
|
|
@@ -1154,6 +1173,266 @@ async function getDistricts(api, params) {
|
|
|
1154
1173
|
}
|
|
1155
1174
|
});
|
|
1156
1175
|
}
|
|
1176
|
+
var CustomerAddressUpsertInputSchema = zod.z.object({
|
|
1177
|
+
addressKey: zod.z.string().trim().min(1),
|
|
1178
|
+
countryIsoCode: zod.z.string().trim().length(2),
|
|
1179
|
+
addressLine: zod.z.string().trim().min(1),
|
|
1180
|
+
addressNumber: zod.z.string().trim().min(1),
|
|
1181
|
+
department: zod.z.string().trim().min(1),
|
|
1182
|
+
province: zod.z.string().trim().min(1),
|
|
1183
|
+
district: zod.z.string().trim().min(1),
|
|
1184
|
+
phone: zod.z.string().trim(),
|
|
1185
|
+
cellPhone: zod.z.string().trim(),
|
|
1186
|
+
postalCode: zod.z.string().trim().min(1),
|
|
1187
|
+
reference: zod.z.string().trim(),
|
|
1188
|
+
latitude: zod.z.number().nullable(),
|
|
1189
|
+
longitude: zod.z.number().nullable(),
|
|
1190
|
+
isDefault: zod.z.boolean()
|
|
1191
|
+
});
|
|
1192
|
+
var CustomerAddressSchema = CustomerAddressUpsertInputSchema.extend({
|
|
1193
|
+
id: zod.z.union([zod.z.string(), zod.z.number()]).transform(String).optional()
|
|
1194
|
+
});
|
|
1195
|
+
var CustomerAddressesSchema = zod.z.array(CustomerAddressSchema);
|
|
1196
|
+
|
|
1197
|
+
// src/services/customer-address.service.ts
|
|
1198
|
+
var ADDRESSES_PATH = "customer/addresses";
|
|
1199
|
+
var CustomerAddressMutationResponseSchema = zod.z.union([
|
|
1200
|
+
CustomerAddressSchema,
|
|
1201
|
+
zod.z.object({
|
|
1202
|
+
id: zod.z.union([zod.z.string(), zod.z.number()]).transform(String)
|
|
1203
|
+
}),
|
|
1204
|
+
zod.z.null()
|
|
1205
|
+
]);
|
|
1206
|
+
async function getCustomerAddresses(api, options = {}) {
|
|
1207
|
+
return api.get(ADDRESSES_PATH, CustomerAddressesSchema, {
|
|
1208
|
+
headers: options.headers,
|
|
1209
|
+
signal: options.signal
|
|
1210
|
+
});
|
|
1211
|
+
}
|
|
1212
|
+
async function createCustomerAddress(api, data, options = {}) {
|
|
1213
|
+
const payload = CustomerAddressUpsertInputSchema.parse(data);
|
|
1214
|
+
return api.post(ADDRESSES_PATH, payload, CustomerAddressMutationResponseSchema, {
|
|
1215
|
+
headers: options.headers,
|
|
1216
|
+
signal: options.signal
|
|
1217
|
+
});
|
|
1218
|
+
}
|
|
1219
|
+
async function updateCustomerAddress(api, addressId, data, options = {}) {
|
|
1220
|
+
const id = addressId.trim();
|
|
1221
|
+
if (!id) throw new Error("addressId requerido");
|
|
1222
|
+
const payload = CustomerAddressUpsertInputSchema.parse(data);
|
|
1223
|
+
return api.request(
|
|
1224
|
+
"PUT",
|
|
1225
|
+
`${ADDRESSES_PATH}/${encodeURIComponent(id)}`,
|
|
1226
|
+
CustomerAddressMutationResponseSchema,
|
|
1227
|
+
{
|
|
1228
|
+
body: payload,
|
|
1229
|
+
headers: options.headers,
|
|
1230
|
+
signal: options.signal
|
|
1231
|
+
}
|
|
1232
|
+
);
|
|
1233
|
+
}
|
|
1234
|
+
async function deleteCustomerAddress(api, addressId, options = {}) {
|
|
1235
|
+
const id = addressId.trim();
|
|
1236
|
+
if (!id) throw new Error("addressId requerido");
|
|
1237
|
+
await api.request(
|
|
1238
|
+
"DELETE",
|
|
1239
|
+
`${ADDRESSES_PATH}/${encodeURIComponent(id)}`,
|
|
1240
|
+
zod.z.null(),
|
|
1241
|
+
{
|
|
1242
|
+
headers: options.headers,
|
|
1243
|
+
signal: options.signal
|
|
1244
|
+
}
|
|
1245
|
+
);
|
|
1246
|
+
}
|
|
1247
|
+
var DEFAULT_COUNTRY_CODE = "PE";
|
|
1248
|
+
zod.z.object({
|
|
1249
|
+
email: zod.z.string().email(),
|
|
1250
|
+
firstName: zod.z.string().trim().min(1),
|
|
1251
|
+
lastName: zod.z.string().trim().min(1),
|
|
1252
|
+
countryIsoCode: zod.z.string().trim().length(2),
|
|
1253
|
+
password: zod.z.string().min(1),
|
|
1254
|
+
phone: zod.z.string().trim().min(1).optional()
|
|
1255
|
+
});
|
|
1256
|
+
var CustomerProfilePatchSchema = zod.z.object({
|
|
1257
|
+
firstName: zod.z.string().trim().min(1),
|
|
1258
|
+
lastName: zod.z.string().trim().min(1),
|
|
1259
|
+
phone: zod.z.string().trim(),
|
|
1260
|
+
identificationNumber: zod.z.string().nullable(),
|
|
1261
|
+
identificationType: zod.z.string().nullable(),
|
|
1262
|
+
entityName: zod.z.string().nullable(),
|
|
1263
|
+
entityIdentificationNumber: zod.z.string().nullable(),
|
|
1264
|
+
gender: zod.z.string().nullable(),
|
|
1265
|
+
role: zod.z.string().nullable(),
|
|
1266
|
+
companyName: zod.z.string().nullable(),
|
|
1267
|
+
dateOfBirth: zod.z.string().nullable(),
|
|
1268
|
+
consent: zod.z.boolean(),
|
|
1269
|
+
countryIsoCode: zod.z.string().trim().length(2)
|
|
1270
|
+
});
|
|
1271
|
+
zod.z.object({
|
|
1272
|
+
firstName: zod.z.string(),
|
|
1273
|
+
lastName: zod.z.string(),
|
|
1274
|
+
phone: zod.z.string(),
|
|
1275
|
+
email: zod.z.string().email(),
|
|
1276
|
+
identificationNumber: zod.z.string().nullable(),
|
|
1277
|
+
identificationType: zod.z.string().nullable(),
|
|
1278
|
+
countryIsoCode: zod.z.string(),
|
|
1279
|
+
consent: zod.z.boolean(),
|
|
1280
|
+
entityName: zod.z.string().nullable(),
|
|
1281
|
+
entityIdentificationNumber: zod.z.string().nullable(),
|
|
1282
|
+
gender: zod.z.string().nullable(),
|
|
1283
|
+
role: zod.z.string().nullable(),
|
|
1284
|
+
companyName: zod.z.string().nullable(),
|
|
1285
|
+
dateOfBirth: zod.z.string().nullable()
|
|
1286
|
+
});
|
|
1287
|
+
var nullableString = zod.z.string().nullable().optional().transform((v) => v ?? null);
|
|
1288
|
+
var CustomerMeSchema = zod.z.object({
|
|
1289
|
+
id: zod.z.union([zod.z.string(), zod.z.number()]),
|
|
1290
|
+
storeId: zod.z.string().optional(),
|
|
1291
|
+
email: zod.z.string().email(),
|
|
1292
|
+
firstName: zod.z.string(),
|
|
1293
|
+
lastName: zod.z.string(),
|
|
1294
|
+
phone: zod.z.union([zod.z.string(), zod.z.null()]).optional().transform((v) => v ?? ""),
|
|
1295
|
+
identificationNumber: nullableString,
|
|
1296
|
+
identificationType: nullableString,
|
|
1297
|
+
entityName: nullableString,
|
|
1298
|
+
entityIdentificationNumber: nullableString,
|
|
1299
|
+
gender: nullableString,
|
|
1300
|
+
role: nullableString,
|
|
1301
|
+
companyName: nullableString,
|
|
1302
|
+
dateOfBirth: nullableString,
|
|
1303
|
+
countryIsoCode: zod.z.string().optional().transform((v) => v?.trim().length === 2 ? v.trim() : DEFAULT_COUNTRY_CODE),
|
|
1304
|
+
consent: zod.z.boolean().optional().transform((v) => v ?? false)
|
|
1305
|
+
}).passthrough();
|
|
1306
|
+
|
|
1307
|
+
// src/services/customer.service.ts
|
|
1308
|
+
var CUSTOMER_PATH = "customer";
|
|
1309
|
+
async function getCustomerMe(api, options = {}) {
|
|
1310
|
+
return api.get(CUSTOMER_PATH, CustomerMeSchema, {
|
|
1311
|
+
headers: options.headers,
|
|
1312
|
+
signal: options.signal
|
|
1313
|
+
});
|
|
1314
|
+
}
|
|
1315
|
+
async function patchCustomer(api, data, options = {}) {
|
|
1316
|
+
const payload = CustomerProfilePatchSchema.parse(data);
|
|
1317
|
+
await api.request("PATCH", CUSTOMER_PATH, zod.z.null(), {
|
|
1318
|
+
body: payload,
|
|
1319
|
+
headers: options.headers,
|
|
1320
|
+
signal: options.signal
|
|
1321
|
+
});
|
|
1322
|
+
}
|
|
1323
|
+
var CustomerOrderShippingAddressSchema = zod.z.object({
|
|
1324
|
+
name: zod.z.string().nullable().optional(),
|
|
1325
|
+
company: zod.z.string().nullable().optional(),
|
|
1326
|
+
address1: zod.z.string(),
|
|
1327
|
+
address2: zod.z.string().nullable().optional(),
|
|
1328
|
+
city: zod.z.string().nullable().optional(),
|
|
1329
|
+
countryCode: zod.z.string().min(2).max(2),
|
|
1330
|
+
province: zod.z.string().nullable().optional(),
|
|
1331
|
+
postalCode: zod.z.string().nullable().optional(),
|
|
1332
|
+
district: zod.z.string().nullable().optional(),
|
|
1333
|
+
phone: zod.z.string().nullable().optional(),
|
|
1334
|
+
latitude: zod.z.number().nullable().optional(),
|
|
1335
|
+
longitude: zod.z.number().nullable().optional(),
|
|
1336
|
+
metadata: zod.z.record(zod.z.unknown()).nullable().optional()
|
|
1337
|
+
}).passthrough();
|
|
1338
|
+
var CustomerOrderLineItemSchema = zod.z.object({
|
|
1339
|
+
id: zod.z.string(),
|
|
1340
|
+
orderId: zod.z.coerce.string(),
|
|
1341
|
+
productId: zod.z.coerce.string().nullable(),
|
|
1342
|
+
variantId: zod.z.coerce.string().nullable(),
|
|
1343
|
+
title: zod.z.string(),
|
|
1344
|
+
subtitle: zod.z.string().nullable().optional(),
|
|
1345
|
+
thumbnail: zod.z.string().nullable().optional(),
|
|
1346
|
+
variantTitle: zod.z.string().nullable().optional(),
|
|
1347
|
+
productHandle: zod.z.string().nullable().optional(),
|
|
1348
|
+
quantity: zod.z.number(),
|
|
1349
|
+
unitPrice: zod.z.number(),
|
|
1350
|
+
total: zod.z.number(),
|
|
1351
|
+
status: zod.z.string()
|
|
1352
|
+
});
|
|
1353
|
+
var CustomerOrderListItemSchema = zod.z.object({
|
|
1354
|
+
orderId: zod.z.coerce.string(),
|
|
1355
|
+
orderNumber: zod.z.string(),
|
|
1356
|
+
orderGroup: zod.z.string(),
|
|
1357
|
+
orderIds: zod.z.array(zod.z.coerce.string()),
|
|
1358
|
+
status: zod.z.string(),
|
|
1359
|
+
total: zod.z.number(),
|
|
1360
|
+
totalPaid: zod.z.number(),
|
|
1361
|
+
currencyCode: zod.z.string(),
|
|
1362
|
+
orderDate: zod.z.string(),
|
|
1363
|
+
createdOn: zod.z.string(),
|
|
1364
|
+
updatedOn: zod.z.string().nullable().optional(),
|
|
1365
|
+
paymentAt: zod.z.string().nullable().optional(),
|
|
1366
|
+
shippingAddress: CustomerOrderShippingAddressSchema.nullable().optional(),
|
|
1367
|
+
shippingAddressSummary: zod.z.string().nullable().optional(),
|
|
1368
|
+
items: zod.z.array(CustomerOrderLineItemSchema)
|
|
1369
|
+
});
|
|
1370
|
+
var CustomerOrderListSchema = zod.z.array(CustomerOrderListItemSchema);
|
|
1371
|
+
var CustomerOrderPaymentSchema = zod.z.object({
|
|
1372
|
+
id: zod.z.string(),
|
|
1373
|
+
paymentMethod: zod.z.string(),
|
|
1374
|
+
paymentCode: zod.z.string(),
|
|
1375
|
+
amount: zod.z.number(),
|
|
1376
|
+
paymentStatus: zod.z.string(),
|
|
1377
|
+
receiptUrl: zod.z.string().nullable().optional(),
|
|
1378
|
+
createdOn: zod.z.string()
|
|
1379
|
+
});
|
|
1380
|
+
var CustomerOrderStatusTimelineSchema = zod.z.object({
|
|
1381
|
+
key: zod.z.string(),
|
|
1382
|
+
label: zod.z.string(),
|
|
1383
|
+
occurredAt: zod.z.string(),
|
|
1384
|
+
description: zod.z.string().nullable().optional(),
|
|
1385
|
+
status: zod.z.string(),
|
|
1386
|
+
source: zod.z.string()
|
|
1387
|
+
});
|
|
1388
|
+
var CustomerOrderDetailSchema = zod.z.object({
|
|
1389
|
+
id: zod.z.coerce.string(),
|
|
1390
|
+
orderNumber: zod.z.string(),
|
|
1391
|
+
orderGroup: zod.z.string(),
|
|
1392
|
+
status: zod.z.string(),
|
|
1393
|
+
total: zod.z.number(),
|
|
1394
|
+
totalPaid: zod.z.number(),
|
|
1395
|
+
currencyCode: zod.z.string(),
|
|
1396
|
+
orderDate: zod.z.string(),
|
|
1397
|
+
createdOn: zod.z.string(),
|
|
1398
|
+
updatedOn: zod.z.string().nullable().optional(),
|
|
1399
|
+
paymentAt: zod.z.string().nullable().optional(),
|
|
1400
|
+
subTotal: zod.z.number(),
|
|
1401
|
+
discount: zod.z.number(),
|
|
1402
|
+
shipping: zod.z.number(),
|
|
1403
|
+
tax: zod.z.number(),
|
|
1404
|
+
email: zod.z.string(),
|
|
1405
|
+
phone: zod.z.string(),
|
|
1406
|
+
firstName: zod.z.string(),
|
|
1407
|
+
lastName: zod.z.string(),
|
|
1408
|
+
shippingAddress: CustomerOrderShippingAddressSchema.nullable().optional(),
|
|
1409
|
+
shippingAddressSummary: zod.z.string().nullable().optional(),
|
|
1410
|
+
billingAddress: CustomerOrderShippingAddressSchema.nullable().optional(),
|
|
1411
|
+
items: zod.z.array(CustomerOrderLineItemSchema),
|
|
1412
|
+
payments: zod.z.array(CustomerOrderPaymentSchema),
|
|
1413
|
+
statusTimeline: zod.z.array(CustomerOrderStatusTimelineSchema)
|
|
1414
|
+
});
|
|
1415
|
+
|
|
1416
|
+
// src/services/customer-order.service.ts
|
|
1417
|
+
var ORDERS_PATH = "customer/orders";
|
|
1418
|
+
async function getCustomerOrders(api, options = {}) {
|
|
1419
|
+
return api.get(ORDERS_PATH, CustomerOrderListSchema, {
|
|
1420
|
+
headers: options.headers,
|
|
1421
|
+
signal: options.signal
|
|
1422
|
+
});
|
|
1423
|
+
}
|
|
1424
|
+
async function getCustomerOrder(api, orderId, options = {}) {
|
|
1425
|
+
const id = orderId.trim();
|
|
1426
|
+
if (!id) throw new Error("orderId requerido");
|
|
1427
|
+
return api.get(
|
|
1428
|
+
`${ORDERS_PATH}/${encodeURIComponent(id)}`,
|
|
1429
|
+
CustomerOrderDetailSchema,
|
|
1430
|
+
{
|
|
1431
|
+
headers: options.headers,
|
|
1432
|
+
signal: options.signal
|
|
1433
|
+
}
|
|
1434
|
+
);
|
|
1435
|
+
}
|
|
1157
1436
|
|
|
1158
1437
|
// src/client.ts
|
|
1159
1438
|
var DEFAULT_SETTINGS_CACHE_TTL_MS = 3e4;
|
|
@@ -1312,6 +1591,38 @@ function createClient(options) {
|
|
|
1312
1591
|
async function getDistricts2(params) {
|
|
1313
1592
|
return getDistricts(api, params);
|
|
1314
1593
|
}
|
|
1594
|
+
async function getCustomerAddresses2(options2 = {}) {
|
|
1595
|
+
const client = await apiClient();
|
|
1596
|
+
return getCustomerAddresses(client, options2);
|
|
1597
|
+
}
|
|
1598
|
+
async function createCustomerAddress2(data, options2 = {}) {
|
|
1599
|
+
const client = await apiClient();
|
|
1600
|
+
return createCustomerAddress(client, data, options2);
|
|
1601
|
+
}
|
|
1602
|
+
async function updateCustomerAddress2(addressId, data, options2 = {}) {
|
|
1603
|
+
const client = await apiClient();
|
|
1604
|
+
return updateCustomerAddress(client, addressId, data, options2);
|
|
1605
|
+
}
|
|
1606
|
+
async function deleteCustomerAddress2(addressId, options2 = {}) {
|
|
1607
|
+
const client = await apiClient();
|
|
1608
|
+
return deleteCustomerAddress(client, addressId, options2);
|
|
1609
|
+
}
|
|
1610
|
+
async function getCustomerMe2(options2 = {}) {
|
|
1611
|
+
const client = await apiClient();
|
|
1612
|
+
return getCustomerMe(client, options2);
|
|
1613
|
+
}
|
|
1614
|
+
async function patchCustomer2(data, options2 = {}) {
|
|
1615
|
+
const client = await apiClient();
|
|
1616
|
+
return patchCustomer(client, data, options2);
|
|
1617
|
+
}
|
|
1618
|
+
async function getCustomerOrders2(options2 = {}) {
|
|
1619
|
+
const client = await apiClient();
|
|
1620
|
+
return getCustomerOrders(client, options2);
|
|
1621
|
+
}
|
|
1622
|
+
async function getCustomerOrder2(orderId, options2 = {}) {
|
|
1623
|
+
const client = await apiClient();
|
|
1624
|
+
return getCustomerOrder(client, orderId, options2);
|
|
1625
|
+
}
|
|
1315
1626
|
return {
|
|
1316
1627
|
...api,
|
|
1317
1628
|
getSettings,
|
|
@@ -1343,7 +1654,15 @@ function createClient(options) {
|
|
|
1343
1654
|
getCountries: getCountries2,
|
|
1344
1655
|
getDepartments: getDepartments2,
|
|
1345
1656
|
getProvinces: getProvinces2,
|
|
1346
|
-
getDistricts: getDistricts2
|
|
1657
|
+
getDistricts: getDistricts2,
|
|
1658
|
+
getCustomerAddresses: getCustomerAddresses2,
|
|
1659
|
+
createCustomerAddress: createCustomerAddress2,
|
|
1660
|
+
updateCustomerAddress: updateCustomerAddress2,
|
|
1661
|
+
deleteCustomerAddress: deleteCustomerAddress2,
|
|
1662
|
+
getCustomerMe: getCustomerMe2,
|
|
1663
|
+
patchCustomer: patchCustomer2,
|
|
1664
|
+
getCustomerOrders: getCustomerOrders2,
|
|
1665
|
+
getCustomerOrder: getCustomerOrder2
|
|
1347
1666
|
};
|
|
1348
1667
|
}
|
|
1349
1668
|
var createStorefrontClient = createClient;
|