@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.
Files changed (57) hide show
  1. package/dist/api.cjs +19 -5
  2. package/dist/api.cjs.map +1 -1
  3. package/dist/api.js +19 -5
  4. package/dist/api.js.map +1 -1
  5. package/dist/client-4ZTG2RZ3.d.ts +195 -0
  6. package/dist/client-BpX4yR6S.d.cts +195 -0
  7. package/dist/client.cjs +331 -12
  8. package/dist/client.cjs.map +1 -1
  9. package/dist/client.d.cts +13 -84
  10. package/dist/client.d.ts +13 -84
  11. package/dist/client.js +331 -12
  12. package/dist/client.js.map +1 -1
  13. package/dist/index.cjs +484 -12
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +327 -324
  16. package/dist/index.d.ts +327 -324
  17. package/dist/index.js +451 -13
  18. package/dist/index.js.map +1 -1
  19. package/dist/models/collections.d.cts +4 -4
  20. package/dist/models/collections.d.ts +4 -4
  21. package/dist/models/customer-address.cjs +41 -0
  22. package/dist/models/customer-address.cjs.map +1 -0
  23. package/dist/models/customer-address.d.cts +160 -0
  24. package/dist/models/customer-address.d.ts +160 -0
  25. package/dist/models/customer-address.js +36 -0
  26. package/dist/models/customer-address.js.map +1 -0
  27. package/dist/models/customer-order.cjs +161 -0
  28. package/dist/models/customer-order.cjs.map +1 -0
  29. package/dist/models/customer-order.d.cts +896 -0
  30. package/dist/models/customer-order.d.ts +896 -0
  31. package/dist/models/customer-order.js +149 -0
  32. package/dist/models/customer-order.js.map +1 -0
  33. package/dist/models/customer-profile.cjs +126 -0
  34. package/dist/models/customer-profile.cjs.map +1 -0
  35. package/dist/models/customer-profile.d.cts +178 -0
  36. package/dist/models/customer-profile.d.ts +178 -0
  37. package/dist/models/customer-profile.js +118 -0
  38. package/dist/models/customer-profile.js.map +1 -0
  39. package/dist/models/geo.d.cts +14 -14
  40. package/dist/models/geo.d.ts +14 -14
  41. package/dist/models/products.d.cts +130 -130
  42. package/dist/models/products.d.ts +130 -130
  43. package/dist/models/search.d.cts +4 -4
  44. package/dist/models/search.d.ts +4 -4
  45. package/dist/models/settings.cjs +13 -6
  46. package/dist/models/settings.cjs.map +1 -1
  47. package/dist/models/settings.d.cts +844 -841
  48. package/dist/models/settings.d.ts +844 -841
  49. package/dist/models/settings.js +12 -7
  50. package/dist/models/settings.js.map +1 -1
  51. package/dist/models/storefront-cart.d.cts +80 -80
  52. package/dist/models/storefront-cart.d.ts +80 -80
  53. package/dist/models/storefront-checkout.d.cts +400 -400
  54. package/dist/models/storefront-checkout.d.ts +400 -400
  55. package/dist/models/storefront-reviews.d.cts +8 -8
  56. package/dist/models/storefront-reviews.d.ts +8 -8
  57. package/package.json +16 -1
package/dist/index.js CHANGED
@@ -19,6 +19,7 @@ var ApiError = class extends Error {
19
19
  function resolveApiBaseUrl(baseUrl = DEFAULT_API_BASE_URL, version = DEFAULT_API_VERSION) {
20
20
  const root = baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`;
21
21
  const segment = version.replace(/^\/+|\/+$/g, "");
22
+ if (!segment) return root;
22
23
  return new URL(`${segment}/`, root).toString();
23
24
  }
24
25
  function createApi(options = {}) {
@@ -61,17 +62,30 @@ function createApi(options = {}) {
61
62
  clearTimeout(timeout);
62
63
  }
63
64
  if (!response.ok) {
64
- const bodyText = await response.text().catch(() => void 0);
65
- let body = bodyText;
66
- if (bodyText) {
65
+ const bodyText2 = await response.text().catch(() => void 0);
66
+ let body = bodyText2;
67
+ if (bodyText2) {
67
68
  try {
68
- body = JSON.parse(bodyText);
69
+ body = JSON.parse(bodyText2);
69
70
  } catch {
70
71
  }
71
72
  }
72
73
  throw new ApiError(`${method} ${url} \u2192 ${response.status}`, response.status, url.toString(), body);
73
74
  }
74
- const json = await response.json();
75
+ const bodyText = await response.text();
76
+ let json = null;
77
+ if (bodyText.trim()) {
78
+ try {
79
+ json = JSON.parse(bodyText);
80
+ } catch {
81
+ throw new ApiError(
82
+ `Respuesta no JSON de ${url}`,
83
+ response.status,
84
+ url.toString(),
85
+ bodyText
86
+ );
87
+ }
88
+ }
75
89
  const parsed = schema.safeParse(json);
76
90
  if (!parsed.success) {
77
91
  throw new ApiError(
@@ -293,6 +307,11 @@ var JsonElementSchema = z.lazy(
293
307
  var DateTimeOffsetSchema = z.string().datetime({ offset: true });
294
308
  var NullableDateTimeOffsetSchema = DateTimeOffsetSchema.nullable();
295
309
  var NullableUuidSchema = z.string().uuid().nullable();
310
+ var EntityIdSchema = z.union([
311
+ z.string().uuid(),
312
+ z.string().regex(/^\d+$/, "Expected numeric id")
313
+ ]);
314
+ var NullableEntityIdSchema = EntityIdSchema.nullable();
296
315
  var StoreTypeSchema = z.enum([
297
316
  "b2C",
298
317
  "marketplace",
@@ -355,9 +374,9 @@ var StoreCheckoutSettingsSchema = z.object({
355
374
  ordersAndPayments: StoreCheckoutOrdersAndPaymentsSettingsSchema
356
375
  }).strict();
357
376
  var StorefrontStoreShape = {
358
- id: z.string().uuid(),
359
- tenantId: z.string().uuid(),
360
- sellerId: NullableUuidSchema,
377
+ id: EntityIdSchema,
378
+ tenantId: EntityIdSchema,
379
+ sellerId: NullableEntityIdSchema,
361
380
  type: StoreTypeSchema,
362
381
  isActive: z.boolean(),
363
382
  name: z.string(),
@@ -438,13 +457,13 @@ var CmsMenuDtoSchema = z.object({
438
457
  items: z.array(CmsMenuItemSchema)
439
458
  }).strict();
440
459
  var CmsBlockDtoSchema = z.object({
441
- id: z.string().uuid(),
460
+ id: EntityIdSchema,
442
461
  type: z.string(),
443
462
  order: z.number().int(),
444
463
  settings: JsonElementSchema
445
464
  }).strict();
446
465
  var CmsSectionDtoSchema = z.object({
447
- id: z.string().uuid(),
466
+ id: EntityIdSchema,
448
467
  type: z.string(),
449
468
  order: z.number().int(),
450
469
  settings: JsonElementSchema,
@@ -453,7 +472,7 @@ var CmsSectionDtoSchema = z.object({
453
472
  var CmsContentChannelSchema = z.enum(["storefront", "pos"]);
454
473
  var CmsPageStatusSchema = z.enum(["draft", "published", "archived"]);
455
474
  var CmsPageDetailsDtoSchema = z.object({
456
- id: z.string().uuid(),
475
+ id: EntityIdSchema,
457
476
  name: z.string(),
458
477
  slug: z.string(),
459
478
  channel: CmsContentChannelSchema,
@@ -1187,6 +1206,385 @@ async function getDistricts(api, params) {
1187
1206
  }
1188
1207
  });
1189
1208
  }
1209
+ var CustomerAddressUpsertInputSchema = z.object({
1210
+ addressKey: z.string().trim().min(1),
1211
+ countryIsoCode: z.string().trim().length(2),
1212
+ addressLine: z.string().trim().min(1),
1213
+ addressNumber: z.string().trim().min(1),
1214
+ department: z.string().trim().min(1),
1215
+ province: z.string().trim().min(1),
1216
+ district: z.string().trim().min(1),
1217
+ phone: z.string().trim(),
1218
+ cellPhone: z.string().trim(),
1219
+ postalCode: z.string().trim().min(1),
1220
+ reference: z.string().trim(),
1221
+ latitude: z.number().nullable(),
1222
+ longitude: z.number().nullable(),
1223
+ isDefault: z.boolean()
1224
+ });
1225
+ var CustomerAddressSchema = CustomerAddressUpsertInputSchema.extend({
1226
+ id: z.union([z.string(), z.number()]).transform(String).optional()
1227
+ });
1228
+ var CustomerAddressesSchema = z.array(CustomerAddressSchema);
1229
+ function toCustomerSavedAddresses(addresses) {
1230
+ const saved = [];
1231
+ for (const address of addresses) {
1232
+ if (!address.id?.trim()) continue;
1233
+ const { id, ...rest } = address;
1234
+ saved.push({ id: id.trim(), ...rest });
1235
+ }
1236
+ return saved;
1237
+ }
1238
+
1239
+ // src/services/customer-address.service.ts
1240
+ var ADDRESSES_PATH = "customer/addresses";
1241
+ var CustomerAddressMutationResponseSchema = z.union([
1242
+ CustomerAddressSchema,
1243
+ z.object({
1244
+ id: z.union([z.string(), z.number()]).transform(String)
1245
+ }),
1246
+ z.null()
1247
+ ]);
1248
+ async function getCustomerAddresses(api, options = {}) {
1249
+ return api.get(ADDRESSES_PATH, CustomerAddressesSchema, {
1250
+ headers: options.headers,
1251
+ signal: options.signal
1252
+ });
1253
+ }
1254
+ async function createCustomerAddress(api, data, options = {}) {
1255
+ const payload = CustomerAddressUpsertInputSchema.parse(data);
1256
+ return api.post(ADDRESSES_PATH, payload, CustomerAddressMutationResponseSchema, {
1257
+ headers: options.headers,
1258
+ signal: options.signal
1259
+ });
1260
+ }
1261
+ async function updateCustomerAddress(api, addressId, data, options = {}) {
1262
+ const id = addressId.trim();
1263
+ if (!id) throw new Error("addressId requerido");
1264
+ const payload = CustomerAddressUpsertInputSchema.parse(data);
1265
+ return api.request(
1266
+ "PUT",
1267
+ `${ADDRESSES_PATH}/${encodeURIComponent(id)}`,
1268
+ CustomerAddressMutationResponseSchema,
1269
+ {
1270
+ body: payload,
1271
+ headers: options.headers,
1272
+ signal: options.signal
1273
+ }
1274
+ );
1275
+ }
1276
+ async function deleteCustomerAddress(api, addressId, options = {}) {
1277
+ const id = addressId.trim();
1278
+ if (!id) throw new Error("addressId requerido");
1279
+ await api.request(
1280
+ "DELETE",
1281
+ `${ADDRESSES_PATH}/${encodeURIComponent(id)}`,
1282
+ z.null(),
1283
+ {
1284
+ headers: options.headers,
1285
+ signal: options.signal
1286
+ }
1287
+ );
1288
+ }
1289
+ var DEFAULT_COUNTRY_CODE = "PE";
1290
+ var CustomerRegisterRequestSchema = z.object({
1291
+ email: z.string().email(),
1292
+ firstName: z.string().trim().min(1),
1293
+ lastName: z.string().trim().min(1),
1294
+ countryIsoCode: z.string().trim().length(2),
1295
+ password: z.string().min(1),
1296
+ phone: z.string().trim().min(1).optional()
1297
+ });
1298
+ var CustomerProfilePatchSchema = z.object({
1299
+ firstName: z.string().trim().min(1),
1300
+ lastName: z.string().trim().min(1),
1301
+ phone: z.string().trim(),
1302
+ identificationNumber: z.string().nullable(),
1303
+ identificationType: z.string().nullable(),
1304
+ entityName: z.string().nullable(),
1305
+ entityIdentificationNumber: z.string().nullable(),
1306
+ gender: z.string().nullable(),
1307
+ role: z.string().nullable(),
1308
+ companyName: z.string().nullable(),
1309
+ dateOfBirth: z.string().nullable(),
1310
+ consent: z.boolean(),
1311
+ countryIsoCode: z.string().trim().length(2)
1312
+ });
1313
+ var CustomerProfileSchema = z.object({
1314
+ firstName: z.string(),
1315
+ lastName: z.string(),
1316
+ phone: z.string(),
1317
+ email: z.string().email(),
1318
+ identificationNumber: z.string().nullable(),
1319
+ identificationType: z.string().nullable(),
1320
+ countryIsoCode: z.string(),
1321
+ consent: z.boolean(),
1322
+ entityName: z.string().nullable(),
1323
+ entityIdentificationNumber: z.string().nullable(),
1324
+ gender: z.string().nullable(),
1325
+ role: z.string().nullable(),
1326
+ companyName: z.string().nullable(),
1327
+ dateOfBirth: z.string().nullable()
1328
+ });
1329
+ var nullableString = z.string().nullable().optional().transform((v) => v ?? null);
1330
+ var CustomerMeSchema = z.object({
1331
+ id: z.union([z.string(), z.number()]),
1332
+ storeId: z.string().optional(),
1333
+ email: z.string().email(),
1334
+ firstName: z.string(),
1335
+ lastName: z.string(),
1336
+ phone: z.union([z.string(), z.null()]).optional().transform((v) => v ?? ""),
1337
+ identificationNumber: nullableString,
1338
+ identificationType: nullableString,
1339
+ entityName: nullableString,
1340
+ entityIdentificationNumber: nullableString,
1341
+ gender: nullableString,
1342
+ role: nullableString,
1343
+ companyName: nullableString,
1344
+ dateOfBirth: nullableString,
1345
+ countryIsoCode: z.string().optional().transform((v) => v?.trim().length === 2 ? v.trim() : DEFAULT_COUNTRY_CODE),
1346
+ consent: z.boolean().optional().transform((v) => v ?? false)
1347
+ }).passthrough();
1348
+ function customerMeToProfile(me) {
1349
+ return CustomerProfileSchema.parse({
1350
+ firstName: me.firstName,
1351
+ lastName: me.lastName,
1352
+ phone: me.phone,
1353
+ email: me.email,
1354
+ identificationNumber: me.identificationNumber,
1355
+ identificationType: me.identificationType,
1356
+ countryIsoCode: me.countryIsoCode,
1357
+ consent: me.consent,
1358
+ entityName: me.entityName,
1359
+ entityIdentificationNumber: me.entityIdentificationNumber,
1360
+ gender: me.gender,
1361
+ role: me.role,
1362
+ companyName: me.companyName,
1363
+ dateOfBirth: me.dateOfBirth
1364
+ });
1365
+ }
1366
+ function customerMeToProfilePatch(me) {
1367
+ return CustomerProfilePatchSchema.parse({
1368
+ firstName: me.firstName,
1369
+ lastName: me.lastName,
1370
+ phone: me.phone,
1371
+ identificationNumber: me.identificationNumber,
1372
+ identificationType: me.identificationType,
1373
+ entityName: me.entityName,
1374
+ entityIdentificationNumber: me.entityIdentificationNumber,
1375
+ gender: me.gender,
1376
+ role: me.role,
1377
+ companyName: me.companyName,
1378
+ dateOfBirth: me.dateOfBirth,
1379
+ consent: me.consent,
1380
+ countryIsoCode: me.countryIsoCode || DEFAULT_COUNTRY_CODE
1381
+ });
1382
+ }
1383
+ function customerProfileToPatch(profile) {
1384
+ return CustomerProfilePatchSchema.parse({
1385
+ firstName: profile.firstName,
1386
+ lastName: profile.lastName,
1387
+ phone: profile.phone,
1388
+ identificationNumber: profile.identificationNumber,
1389
+ identificationType: profile.identificationType,
1390
+ entityName: profile.entityName,
1391
+ entityIdentificationNumber: profile.entityIdentificationNumber,
1392
+ gender: profile.gender,
1393
+ role: profile.role,
1394
+ companyName: profile.companyName,
1395
+ dateOfBirth: profile.dateOfBirth,
1396
+ consent: profile.consent,
1397
+ countryIsoCode: profile.countryIsoCode || DEFAULT_COUNTRY_CODE
1398
+ });
1399
+ }
1400
+
1401
+ // src/services/customer.service.ts
1402
+ var CUSTOMER_PATH = "customer";
1403
+ var CUSTOMER_REGISTER_PATH = "customer/register";
1404
+ async function registerCustomer(api, data, options = {}) {
1405
+ const payload = CustomerRegisterRequestSchema.parse(data);
1406
+ return api.post(CUSTOMER_REGISTER_PATH, payload, z.unknown(), {
1407
+ headers: options.headers,
1408
+ signal: options.signal
1409
+ });
1410
+ }
1411
+ async function getCustomerMe(api, options = {}) {
1412
+ return api.get(CUSTOMER_PATH, CustomerMeSchema, {
1413
+ headers: options.headers,
1414
+ signal: options.signal
1415
+ });
1416
+ }
1417
+ async function patchCustomer(api, data, options = {}) {
1418
+ const payload = CustomerProfilePatchSchema.parse(data);
1419
+ await api.request("PATCH", CUSTOMER_PATH, z.null(), {
1420
+ body: payload,
1421
+ headers: options.headers,
1422
+ signal: options.signal
1423
+ });
1424
+ }
1425
+ var CustomerOrderShippingAddressSchema = z.object({
1426
+ name: z.string().nullable().optional(),
1427
+ company: z.string().nullable().optional(),
1428
+ address1: z.string(),
1429
+ address2: z.string().nullable().optional(),
1430
+ city: z.string().nullable().optional(),
1431
+ countryCode: z.string().min(2).max(2),
1432
+ province: z.string().nullable().optional(),
1433
+ postalCode: z.string().nullable().optional(),
1434
+ district: z.string().nullable().optional(),
1435
+ phone: z.string().nullable().optional(),
1436
+ latitude: z.number().nullable().optional(),
1437
+ longitude: z.number().nullable().optional(),
1438
+ metadata: z.record(z.unknown()).nullable().optional()
1439
+ }).passthrough();
1440
+ var CustomerOrderLineItemSchema = z.object({
1441
+ id: z.string(),
1442
+ orderId: z.coerce.string(),
1443
+ productId: z.coerce.string().nullable(),
1444
+ variantId: z.coerce.string().nullable(),
1445
+ title: z.string(),
1446
+ subtitle: z.string().nullable().optional(),
1447
+ thumbnail: z.string().nullable().optional(),
1448
+ variantTitle: z.string().nullable().optional(),
1449
+ productHandle: z.string().nullable().optional(),
1450
+ quantity: z.number(),
1451
+ unitPrice: z.number(),
1452
+ total: z.number(),
1453
+ status: z.string()
1454
+ });
1455
+ var CustomerOrderListItemSchema = z.object({
1456
+ orderId: z.coerce.string(),
1457
+ orderNumber: z.string(),
1458
+ orderGroup: z.string(),
1459
+ orderIds: z.array(z.coerce.string()),
1460
+ status: z.string(),
1461
+ total: z.number(),
1462
+ totalPaid: z.number(),
1463
+ currencyCode: z.string(),
1464
+ orderDate: z.string(),
1465
+ createdOn: z.string(),
1466
+ updatedOn: z.string().nullable().optional(),
1467
+ paymentAt: z.string().nullable().optional(),
1468
+ shippingAddress: CustomerOrderShippingAddressSchema.nullable().optional(),
1469
+ shippingAddressSummary: z.string().nullable().optional(),
1470
+ items: z.array(CustomerOrderLineItemSchema)
1471
+ });
1472
+ var CustomerOrderListSchema = z.array(CustomerOrderListItemSchema);
1473
+ var CustomerOrderPaymentSchema = z.object({
1474
+ id: z.string(),
1475
+ paymentMethod: z.string(),
1476
+ paymentCode: z.string(),
1477
+ amount: z.number(),
1478
+ paymentStatus: z.string(),
1479
+ receiptUrl: z.string().nullable().optional(),
1480
+ createdOn: z.string()
1481
+ });
1482
+ var CustomerOrderStatusTimelineSchema = z.object({
1483
+ key: z.string(),
1484
+ label: z.string(),
1485
+ occurredAt: z.string(),
1486
+ description: z.string().nullable().optional(),
1487
+ status: z.string(),
1488
+ source: z.string()
1489
+ });
1490
+ var CustomerOrderDetailSchema = z.object({
1491
+ id: z.coerce.string(),
1492
+ orderNumber: z.string(),
1493
+ orderGroup: z.string(),
1494
+ status: z.string(),
1495
+ total: z.number(),
1496
+ totalPaid: z.number(),
1497
+ currencyCode: z.string(),
1498
+ orderDate: z.string(),
1499
+ createdOn: z.string(),
1500
+ updatedOn: z.string().nullable().optional(),
1501
+ paymentAt: z.string().nullable().optional(),
1502
+ subTotal: z.number(),
1503
+ discount: z.number(),
1504
+ shipping: z.number(),
1505
+ tax: z.number(),
1506
+ email: z.string(),
1507
+ phone: z.string(),
1508
+ firstName: z.string(),
1509
+ lastName: z.string(),
1510
+ shippingAddress: CustomerOrderShippingAddressSchema.nullable().optional(),
1511
+ shippingAddressSummary: z.string().nullable().optional(),
1512
+ billingAddress: CustomerOrderShippingAddressSchema.nullable().optional(),
1513
+ items: z.array(CustomerOrderLineItemSchema),
1514
+ payments: z.array(CustomerOrderPaymentSchema),
1515
+ statusTimeline: z.array(CustomerOrderStatusTimelineSchema)
1516
+ });
1517
+ var ORDER_STATUS_LABELS = {
1518
+ New: "Pedido realizado",
1519
+ Confirmed: "Confirmado",
1520
+ Processing: "En preparaci\xF3n",
1521
+ InTransit: "En camino",
1522
+ Delivered: "Entregado",
1523
+ Cancelled: "Cancelado",
1524
+ Canceled: "Cancelado",
1525
+ Refunded: "Reembolsado",
1526
+ Pending: "Pendiente",
1527
+ PendingToConfirm: "Pendiente de confirmaci\xF3n",
1528
+ Paid: "Pagado",
1529
+ Captured: "Pago confirmado"
1530
+ };
1531
+ function formatCustomerOrderStatus(status) {
1532
+ const trimmed = status.trim();
1533
+ if (!trimmed) return "Desconocido";
1534
+ return ORDER_STATUS_LABELS[trimmed] ?? trimmed.replace(/([A-Z])/g, " $1").trim();
1535
+ }
1536
+ function customerOrderStatusTone(status) {
1537
+ const s = status.toLowerCase();
1538
+ if (s.includes("cancel") || s.includes("refund")) return "danger";
1539
+ if (s.includes("deliver")) return "success";
1540
+ if (s.includes("transit") || s.includes("ship")) return "info";
1541
+ if (s.includes("confirm") || s.includes("paid") || s.includes("capture"))
1542
+ return "success";
1543
+ if (s.includes("pending") || s.includes("new") || s.includes("process"))
1544
+ return "warning";
1545
+ return "default";
1546
+ }
1547
+ function formatOrderDate(iso, locale = "es-PE") {
1548
+ const d = new Date(iso);
1549
+ if (Number.isNaN(d.getTime())) return iso;
1550
+ return new Intl.DateTimeFormat(locale, {
1551
+ day: "numeric",
1552
+ month: "long",
1553
+ year: "numeric"
1554
+ }).format(d);
1555
+ }
1556
+ function formatOrderDateTime(iso, locale = "es-PE") {
1557
+ const d = new Date(iso);
1558
+ if (Number.isNaN(d.getTime())) return iso;
1559
+ return new Intl.DateTimeFormat(locale, {
1560
+ day: "numeric",
1561
+ month: "short",
1562
+ year: "numeric",
1563
+ hour: "2-digit",
1564
+ minute: "2-digit"
1565
+ }).format(d);
1566
+ }
1567
+
1568
+ // src/services/customer-order.service.ts
1569
+ var ORDERS_PATH = "customer/orders";
1570
+ async function getCustomerOrders(api, options = {}) {
1571
+ return api.get(ORDERS_PATH, CustomerOrderListSchema, {
1572
+ headers: options.headers,
1573
+ signal: options.signal
1574
+ });
1575
+ }
1576
+ async function getCustomerOrder(api, orderId, options = {}) {
1577
+ const id = orderId.trim();
1578
+ if (!id) throw new Error("orderId requerido");
1579
+ return api.get(
1580
+ `${ORDERS_PATH}/${encodeURIComponent(id)}`,
1581
+ CustomerOrderDetailSchema,
1582
+ {
1583
+ headers: options.headers,
1584
+ signal: options.signal
1585
+ }
1586
+ );
1587
+ }
1190
1588
 
1191
1589
  // src/client.ts
1192
1590
  var DEFAULT_SETTINGS_CACHE_TTL_MS = 3e4;
@@ -1345,6 +1743,38 @@ function createClient(options) {
1345
1743
  async function getDistricts2(params) {
1346
1744
  return getDistricts(api, params);
1347
1745
  }
1746
+ async function getCustomerAddresses2(options2 = {}) {
1747
+ const client = await apiClient();
1748
+ return getCustomerAddresses(client, options2);
1749
+ }
1750
+ async function createCustomerAddress2(data, options2 = {}) {
1751
+ const client = await apiClient();
1752
+ return createCustomerAddress(client, data, options2);
1753
+ }
1754
+ async function updateCustomerAddress2(addressId, data, options2 = {}) {
1755
+ const client = await apiClient();
1756
+ return updateCustomerAddress(client, addressId, data, options2);
1757
+ }
1758
+ async function deleteCustomerAddress2(addressId, options2 = {}) {
1759
+ const client = await apiClient();
1760
+ return deleteCustomerAddress(client, addressId, options2);
1761
+ }
1762
+ async function getCustomerMe2(options2 = {}) {
1763
+ const client = await apiClient();
1764
+ return getCustomerMe(client, options2);
1765
+ }
1766
+ async function patchCustomer2(data, options2 = {}) {
1767
+ const client = await apiClient();
1768
+ return patchCustomer(client, data, options2);
1769
+ }
1770
+ async function getCustomerOrders2(options2 = {}) {
1771
+ const client = await apiClient();
1772
+ return getCustomerOrders(client, options2);
1773
+ }
1774
+ async function getCustomerOrder2(orderId, options2 = {}) {
1775
+ const client = await apiClient();
1776
+ return getCustomerOrder(client, orderId, options2);
1777
+ }
1348
1778
  return {
1349
1779
  ...api,
1350
1780
  getSettings,
@@ -1376,7 +1806,15 @@ function createClient(options) {
1376
1806
  getCountries: getCountries2,
1377
1807
  getDepartments: getDepartments2,
1378
1808
  getProvinces: getProvinces2,
1379
- getDistricts: getDistricts2
1809
+ getDistricts: getDistricts2,
1810
+ getCustomerAddresses: getCustomerAddresses2,
1811
+ createCustomerAddress: createCustomerAddress2,
1812
+ updateCustomerAddress: updateCustomerAddress2,
1813
+ deleteCustomerAddress: deleteCustomerAddress2,
1814
+ getCustomerMe: getCustomerMe2,
1815
+ patchCustomer: patchCustomer2,
1816
+ getCustomerOrders: getCustomerOrders2,
1817
+ getCustomerOrder: getCustomerOrder2
1380
1818
  };
1381
1819
  }
1382
1820
  var createStorefrontClient = createClient;
@@ -1455,6 +1893,6 @@ function stripHtml(html) {
1455
1893
  return html.replace(/<br\s*\/?>/gi, " ").replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
1456
1894
  }
1457
1895
 
1458
- export { AddCartItemParamsSchema, ApiError, BundleItemSchema, CartAddressWriteSchema, CartAddressesParamsSchema, CartBuyerParamsSchema, CartCheckoutParamsSchema, CartCheckoutPaymentActionSchema, CartCheckoutPaymentSchema, CartCheckoutReadParamsSchema, CartCheckoutReadResponseSchema, CartCheckoutResponseSchema, CartItemModifierSchema, CartPaymentMethodSchema, CartPaymentReceiptResponseSchema, CartPromotionCodeParamsSchema, CmsBlockDtoSchema, CmsBrandingSettingsDtoSchema, CmsContactSettingsDtoSchema, CmsContentChannelSchema, CmsCustomScriptsDtoSchema, CmsMenuDtoSchema, CmsMenuItemSchema, CmsPageDetailsDtoSchema, CmsPageStatusSchema, CmsSectionDtoSchema, CmsSeoSettingsDtoSchema, CmsSiteSettingsDtoSchema, CmsSnapshotDtoSchema, CmsSocialLinksDtoSchema, CmsTrackingSettingsDtoSchema, CollectionSchema, CollectionsSchema, CountriesSchema, CountrySchema, CreateCartParamsSchema, CreateProductReviewParamsSchema, DEFAULT_API_BASE_URL, DEFAULT_API_VERSION, DepartmentSchema, DepartmentsSchema, DistrictSchema, DistrictsSchema, FacetItemSchema, FacetSchema, GeoDivisionSchema, GeoDivisionTypeSchema, GetCartParamsSchema, GetDepartmentsParamsSchema, GetDistrictsParamsSchema, GetProvincesParamsSchema, GetShippingOptionsParamsSchema, JsonElementSchema, ListProductReviewsParamsSchema, PriceTierSchema, ProductAutocompleteParamsSchema, ProductDetailParamsSchema, ProductDetailSchema, ProductImageSchema, ProductPriceTierSchema, ProductPublicIdSchema, ProductSchema, ProductSortSchema, ProductSuggestionSchema, ProductSuggestionsSchema, ProductSummariesSchema, ProductSummarySchema, ProductsParamsSchema, ProductsResponseSchema, ProvinceSchema, ProvincesSchema, PutShippingMethodParamsSchema, RelatedProductsParamsSchema, RemoveCartItemParamsSchema, SearchFilterSchema, ShippingOptionGroupSchema, ShippingOptionsResponseSchema, ShippingRateSchema, SizeGuideMeasurementSchema, SizeGuideRowSchema, SizeGuideSchema, SpecItemSchema, StoreCheckoutCartPageSettingsSchema, StoreCheckoutGeneralSettingsSchema, StoreCheckoutOrderBumpSettingsSchema, StoreCheckoutOrdersAndPaymentsSettingsSchema, StoreCheckoutSettingsSchema, StoreCheckoutShippingSettingsSchema, StoreFeatureFlagsSchema, StoreModelSchema, StoreSettingsSnapshotDtoSchema, StoreThemeSettingsSchema, StoreTypeSchema, StoreVisibilitySchema, StorefrontAddressSchema, StorefrontCartBundleItemSchema, StorefrontCartItemSchema, StorefrontCartSchema, StorefrontCartShippingMethodSchema, StorefrontCartStatusSchema, StorefrontCartTotalsSchema, StorefrontCheckoutSettingsSchema, StorefrontCmsBrandingSchema, StorefrontCmsContactSchema, StorefrontCmsCustomScriptsSchema, StorefrontCmsPageSchema, StorefrontCmsSeoSchema, StorefrontCmsSettingsSchema, StorefrontCmsSocialLinksSchema, StorefrontCmsTrackingSchema, StorefrontFeaturesEnabledSchema, StorefrontMenuItemSchema, StorefrontMenuSchema, StorefrontOrderBumpSchema, StorefrontReviewSchema, StorefrontReviewsSchema, StorefrontSettingsSchema, StorefrontStoreSchema, StorefrontStoreTypeSchema, StorefrontThemeConfigSchema, UpdateCartItemQuantityParamsSchema, VariantItemSchema, VariantOptionSchema, VariantSchema, addCartItem, addCartPromotionCode, autocompleteProducts, cartVariantIdFromProduct, checkoutCart, createApi, createCart, createClient, createProductReview, createStorefrontClient, getCart, getCartCheckout, getCountries, getDepartments, getDistricts, getMenuItems, getPageBySlug, getProductBySlug, getProducts, getProvinces, getRelatedProducts, getShippingOptions, listProductReviews, patchCartAddresses, patchCartBuyer, putCartShippingMethod, removeCartItem, removeCartPromotionCode, resolveApiBaseUrl, sanitizeHtml, stripHtml, updateCartItemQuantity, uploadPaymentReceipt };
1896
+ export { AddCartItemParamsSchema, ApiError, BundleItemSchema, CartAddressWriteSchema, CartAddressesParamsSchema, CartBuyerParamsSchema, CartCheckoutParamsSchema, CartCheckoutPaymentActionSchema, CartCheckoutPaymentSchema, CartCheckoutReadParamsSchema, CartCheckoutReadResponseSchema, CartCheckoutResponseSchema, CartItemModifierSchema, CartPaymentMethodSchema, CartPaymentReceiptResponseSchema, CartPromotionCodeParamsSchema, CmsBlockDtoSchema, CmsBrandingSettingsDtoSchema, CmsContactSettingsDtoSchema, CmsContentChannelSchema, CmsCustomScriptsDtoSchema, CmsMenuDtoSchema, CmsMenuItemSchema, CmsPageDetailsDtoSchema, CmsPageStatusSchema, CmsSectionDtoSchema, CmsSeoSettingsDtoSchema, CmsSiteSettingsDtoSchema, CmsSnapshotDtoSchema, CmsSocialLinksDtoSchema, CmsTrackingSettingsDtoSchema, CollectionSchema, CollectionsSchema, CountriesSchema, CountrySchema, CreateCartParamsSchema, CreateProductReviewParamsSchema, CustomerAddressMutationResponseSchema, CustomerAddressSchema, CustomerAddressUpsertInputSchema, CustomerAddressesSchema, CustomerMeSchema, CustomerOrderDetailSchema, CustomerOrderLineItemSchema, CustomerOrderListItemSchema, CustomerOrderListSchema, CustomerOrderPaymentSchema, CustomerOrderShippingAddressSchema, CustomerOrderStatusTimelineSchema, CustomerProfilePatchSchema, CustomerProfileSchema, CustomerRegisterRequestSchema, DEFAULT_API_BASE_URL, DEFAULT_API_VERSION, DepartmentSchema, DepartmentsSchema, DistrictSchema, DistrictsSchema, EntityIdSchema, FacetItemSchema, FacetSchema, GeoDivisionSchema, GeoDivisionTypeSchema, GetCartParamsSchema, GetDepartmentsParamsSchema, GetDistrictsParamsSchema, GetProvincesParamsSchema, GetShippingOptionsParamsSchema, JsonElementSchema, ListProductReviewsParamsSchema, NullableEntityIdSchema, PriceTierSchema, ProductAutocompleteParamsSchema, ProductDetailParamsSchema, ProductDetailSchema, ProductImageSchema, ProductPriceTierSchema, ProductPublicIdSchema, ProductSchema, ProductSortSchema, ProductSuggestionSchema, ProductSuggestionsSchema, ProductSummariesSchema, ProductSummarySchema, ProductsParamsSchema, ProductsResponseSchema, ProvinceSchema, ProvincesSchema, PutShippingMethodParamsSchema, RelatedProductsParamsSchema, RemoveCartItemParamsSchema, SearchFilterSchema, ShippingOptionGroupSchema, ShippingOptionsResponseSchema, ShippingRateSchema, SizeGuideMeasurementSchema, SizeGuideRowSchema, SizeGuideSchema, SpecItemSchema, StoreCheckoutCartPageSettingsSchema, StoreCheckoutGeneralSettingsSchema, StoreCheckoutOrderBumpSettingsSchema, StoreCheckoutOrdersAndPaymentsSettingsSchema, StoreCheckoutSettingsSchema, StoreCheckoutShippingSettingsSchema, StoreFeatureFlagsSchema, StoreModelSchema, StoreSettingsSnapshotDtoSchema, StoreThemeSettingsSchema, StoreTypeSchema, StoreVisibilitySchema, StorefrontAddressSchema, StorefrontCartBundleItemSchema, StorefrontCartItemSchema, StorefrontCartSchema, StorefrontCartShippingMethodSchema, StorefrontCartStatusSchema, StorefrontCartTotalsSchema, StorefrontCheckoutSettingsSchema, StorefrontCmsBrandingSchema, StorefrontCmsContactSchema, StorefrontCmsCustomScriptsSchema, StorefrontCmsPageSchema, StorefrontCmsSeoSchema, StorefrontCmsSettingsSchema, StorefrontCmsSocialLinksSchema, StorefrontCmsTrackingSchema, StorefrontFeaturesEnabledSchema, StorefrontMenuItemSchema, StorefrontMenuSchema, StorefrontOrderBumpSchema, StorefrontReviewSchema, StorefrontReviewsSchema, StorefrontSettingsSchema, StorefrontStoreSchema, StorefrontStoreTypeSchema, StorefrontThemeConfigSchema, UpdateCartItemQuantityParamsSchema, VariantItemSchema, VariantOptionSchema, VariantSchema, addCartItem, addCartPromotionCode, autocompleteProducts, cartVariantIdFromProduct, checkoutCart, createApi, createCart, createClient, createCustomerAddress, createProductReview, createStorefrontClient, customerMeToProfile, customerMeToProfilePatch, customerOrderStatusTone, customerProfileToPatch, deleteCustomerAddress, formatCustomerOrderStatus, formatOrderDate, formatOrderDateTime, getCart, getCartCheckout, getCountries, getCustomerAddresses, getCustomerMe, getCustomerOrder, getCustomerOrders, getDepartments, getDistricts, getMenuItems, getPageBySlug, getProductBySlug, getProducts, getProvinces, getRelatedProducts, getShippingOptions, listProductReviews, patchCartAddresses, patchCartBuyer, patchCustomer, putCartShippingMethod, registerCustomer, removeCartItem, removeCartPromotionCode, resolveApiBaseUrl, sanitizeHtml, stripHtml, toCustomerSavedAddresses, updateCartItemQuantity, updateCustomerAddress, uploadPaymentReceipt };
1459
1897
  //# sourceMappingURL=index.js.map
1460
1898
  //# sourceMappingURL=index.js.map