@ecomiq/core 0.1.2 → 0.1.5

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 (39) 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 +324 -10
  8. package/dist/client.cjs.map +1 -1
  9. package/dist/client.d.cts +13 -83
  10. package/dist/client.d.ts +13 -83
  11. package/dist/client.js +324 -10
  12. package/dist/client.js.map +1 -1
  13. package/dist/index.cjs +475 -10
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +4 -1
  16. package/dist/index.d.ts +4 -1
  17. package/dist/index.js +444 -11
  18. package/dist/index.js.map +1 -1
  19. package/dist/models/customer-address.cjs +41 -0
  20. package/dist/models/customer-address.cjs.map +1 -0
  21. package/dist/models/customer-address.d.cts +160 -0
  22. package/dist/models/customer-address.d.ts +160 -0
  23. package/dist/models/customer-address.js +36 -0
  24. package/dist/models/customer-address.js.map +1 -0
  25. package/dist/models/customer-order.cjs +161 -0
  26. package/dist/models/customer-order.cjs.map +1 -0
  27. package/dist/models/customer-order.d.cts +896 -0
  28. package/dist/models/customer-order.d.ts +896 -0
  29. package/dist/models/customer-order.js +149 -0
  30. package/dist/models/customer-order.js.map +1 -0
  31. package/dist/models/customer-profile.cjs +126 -0
  32. package/dist/models/customer-profile.cjs.map +1 -0
  33. package/dist/models/customer-profile.d.cts +178 -0
  34. package/dist/models/customer-profile.d.ts +178 -0
  35. package/dist/models/customer-profile.js +118 -0
  36. package/dist/models/customer-profile.js.map +1 -0
  37. package/dist/models/settings.d.cts +284 -284
  38. package/dist/models/settings.d.ts +284 -284
  39. package/package.json +16 -1
package/dist/index.cjs CHANGED
@@ -25,6 +25,7 @@ var ApiError = class extends Error {
25
25
  function resolveApiBaseUrl(baseUrl = DEFAULT_API_BASE_URL, version = DEFAULT_API_VERSION) {
26
26
  const root = baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`;
27
27
  const segment = version.replace(/^\/+|\/+$/g, "");
28
+ if (!segment) return root;
28
29
  return new URL(`${segment}/`, root).toString();
29
30
  }
30
31
  function createApi(options = {}) {
@@ -67,17 +68,30 @@ function createApi(options = {}) {
67
68
  clearTimeout(timeout);
68
69
  }
69
70
  if (!response.ok) {
70
- const bodyText = await response.text().catch(() => void 0);
71
- let body = bodyText;
72
- if (bodyText) {
71
+ const bodyText2 = await response.text().catch(() => void 0);
72
+ let body = bodyText2;
73
+ if (bodyText2) {
73
74
  try {
74
- body = JSON.parse(bodyText);
75
+ body = JSON.parse(bodyText2);
75
76
  } catch {
76
77
  }
77
78
  }
78
79
  throw new ApiError(`${method} ${url} \u2192 ${response.status}`, response.status, url.toString(), body);
79
80
  }
80
- const json = await response.json();
81
+ const bodyText = await response.text();
82
+ let json = null;
83
+ if (bodyText.trim()) {
84
+ try {
85
+ json = JSON.parse(bodyText);
86
+ } catch {
87
+ throw new ApiError(
88
+ `Respuesta no JSON de ${url}`,
89
+ response.status,
90
+ url.toString(),
91
+ bodyText
92
+ );
93
+ }
94
+ }
81
95
  const parsed = schema.safeParse(json);
82
96
  if (!parsed.success) {
83
97
  throw new ApiError(
@@ -1193,17 +1207,396 @@ async function getDistricts(api, params) {
1193
1207
  }
1194
1208
  });
1195
1209
  }
1210
+ var CustomerAddressUpsertInputSchema = zod.z.object({
1211
+ addressKey: zod.z.string().trim().min(1),
1212
+ countryIsoCode: zod.z.string().trim().length(2),
1213
+ addressLine: zod.z.string().trim().min(1),
1214
+ addressNumber: zod.z.string().trim().min(1),
1215
+ department: zod.z.string().trim().min(1),
1216
+ province: zod.z.string().trim().min(1),
1217
+ district: zod.z.string().trim().min(1),
1218
+ phone: zod.z.string().trim(),
1219
+ cellPhone: zod.z.string().trim(),
1220
+ postalCode: zod.z.string().trim().min(1),
1221
+ reference: zod.z.string().trim(),
1222
+ latitude: zod.z.number().nullable(),
1223
+ longitude: zod.z.number().nullable(),
1224
+ isDefault: zod.z.boolean()
1225
+ });
1226
+ var CustomerAddressSchema = CustomerAddressUpsertInputSchema.extend({
1227
+ id: zod.z.union([zod.z.string(), zod.z.number()]).transform(String).optional()
1228
+ });
1229
+ var CustomerAddressesSchema = zod.z.array(CustomerAddressSchema);
1230
+ function toCustomerSavedAddresses(addresses) {
1231
+ const saved = [];
1232
+ for (const address of addresses) {
1233
+ if (!address.id?.trim()) continue;
1234
+ const { id, ...rest } = address;
1235
+ saved.push({ id: id.trim(), ...rest });
1236
+ }
1237
+ return saved;
1238
+ }
1239
+
1240
+ // src/services/customer-address.service.ts
1241
+ var ADDRESSES_PATH = "customer/addresses";
1242
+ var CustomerAddressMutationResponseSchema = zod.z.union([
1243
+ CustomerAddressSchema,
1244
+ zod.z.object({
1245
+ id: zod.z.union([zod.z.string(), zod.z.number()]).transform(String)
1246
+ }),
1247
+ zod.z.null()
1248
+ ]);
1249
+ async function getCustomerAddresses(api, options = {}) {
1250
+ return api.get(ADDRESSES_PATH, CustomerAddressesSchema, {
1251
+ headers: options.headers,
1252
+ signal: options.signal
1253
+ });
1254
+ }
1255
+ async function createCustomerAddress(api, data, options = {}) {
1256
+ const payload = CustomerAddressUpsertInputSchema.parse(data);
1257
+ return api.post(ADDRESSES_PATH, payload, CustomerAddressMutationResponseSchema, {
1258
+ headers: options.headers,
1259
+ signal: options.signal
1260
+ });
1261
+ }
1262
+ async function updateCustomerAddress(api, addressId, data, options = {}) {
1263
+ const id = addressId.trim();
1264
+ if (!id) throw new Error("addressId requerido");
1265
+ const payload = CustomerAddressUpsertInputSchema.parse(data);
1266
+ return api.request(
1267
+ "PUT",
1268
+ `${ADDRESSES_PATH}/${encodeURIComponent(id)}`,
1269
+ CustomerAddressMutationResponseSchema,
1270
+ {
1271
+ body: payload,
1272
+ headers: options.headers,
1273
+ signal: options.signal
1274
+ }
1275
+ );
1276
+ }
1277
+ async function deleteCustomerAddress(api, addressId, options = {}) {
1278
+ const id = addressId.trim();
1279
+ if (!id) throw new Error("addressId requerido");
1280
+ await api.request(
1281
+ "DELETE",
1282
+ `${ADDRESSES_PATH}/${encodeURIComponent(id)}`,
1283
+ zod.z.null(),
1284
+ {
1285
+ headers: options.headers,
1286
+ signal: options.signal
1287
+ }
1288
+ );
1289
+ }
1290
+ var DEFAULT_COUNTRY_CODE = "PE";
1291
+ var CustomerRegisterRequestSchema = zod.z.object({
1292
+ email: zod.z.string().email(),
1293
+ firstName: zod.z.string().trim().min(1),
1294
+ lastName: zod.z.string().trim().min(1),
1295
+ countryIsoCode: zod.z.string().trim().length(2),
1296
+ password: zod.z.string().min(1),
1297
+ phone: zod.z.string().trim().min(1).optional()
1298
+ });
1299
+ var CustomerProfilePatchSchema = zod.z.object({
1300
+ firstName: zod.z.string().trim().min(1),
1301
+ lastName: zod.z.string().trim().min(1),
1302
+ phone: zod.z.string().trim(),
1303
+ identificationNumber: zod.z.string().nullable(),
1304
+ identificationType: zod.z.string().nullable(),
1305
+ entityName: zod.z.string().nullable(),
1306
+ entityIdentificationNumber: zod.z.string().nullable(),
1307
+ gender: zod.z.string().nullable(),
1308
+ role: zod.z.string().nullable(),
1309
+ companyName: zod.z.string().nullable(),
1310
+ dateOfBirth: zod.z.string().nullable(),
1311
+ consent: zod.z.boolean(),
1312
+ countryIsoCode: zod.z.string().trim().length(2)
1313
+ });
1314
+ var CustomerProfileSchema = zod.z.object({
1315
+ firstName: zod.z.string(),
1316
+ lastName: zod.z.string(),
1317
+ phone: zod.z.string(),
1318
+ email: zod.z.string().email(),
1319
+ identificationNumber: zod.z.string().nullable(),
1320
+ identificationType: zod.z.string().nullable(),
1321
+ countryIsoCode: zod.z.string(),
1322
+ consent: zod.z.boolean(),
1323
+ entityName: zod.z.string().nullable(),
1324
+ entityIdentificationNumber: zod.z.string().nullable(),
1325
+ gender: zod.z.string().nullable(),
1326
+ role: zod.z.string().nullable(),
1327
+ companyName: zod.z.string().nullable(),
1328
+ dateOfBirth: zod.z.string().nullable()
1329
+ });
1330
+ var nullableString = zod.z.string().nullable().optional().transform((v) => v ?? null);
1331
+ var CustomerMeSchema = zod.z.object({
1332
+ id: zod.z.union([zod.z.string(), zod.z.number()]),
1333
+ storeId: zod.z.string().optional(),
1334
+ email: zod.z.string().email(),
1335
+ firstName: zod.z.string(),
1336
+ lastName: zod.z.string(),
1337
+ phone: zod.z.union([zod.z.string(), zod.z.null()]).optional().transform((v) => v ?? ""),
1338
+ identificationNumber: nullableString,
1339
+ identificationType: nullableString,
1340
+ entityName: nullableString,
1341
+ entityIdentificationNumber: nullableString,
1342
+ gender: nullableString,
1343
+ role: nullableString,
1344
+ companyName: nullableString,
1345
+ dateOfBirth: nullableString,
1346
+ countryIsoCode: zod.z.string().optional().transform((v) => v?.trim().length === 2 ? v.trim() : DEFAULT_COUNTRY_CODE),
1347
+ consent: zod.z.boolean().optional().transform((v) => v ?? false)
1348
+ }).passthrough();
1349
+ function customerMeToProfile(me) {
1350
+ return CustomerProfileSchema.parse({
1351
+ firstName: me.firstName,
1352
+ lastName: me.lastName,
1353
+ phone: me.phone,
1354
+ email: me.email,
1355
+ identificationNumber: me.identificationNumber,
1356
+ identificationType: me.identificationType,
1357
+ countryIsoCode: me.countryIsoCode,
1358
+ consent: me.consent,
1359
+ entityName: me.entityName,
1360
+ entityIdentificationNumber: me.entityIdentificationNumber,
1361
+ gender: me.gender,
1362
+ role: me.role,
1363
+ companyName: me.companyName,
1364
+ dateOfBirth: me.dateOfBirth
1365
+ });
1366
+ }
1367
+ function customerMeToProfilePatch(me) {
1368
+ return CustomerProfilePatchSchema.parse({
1369
+ firstName: me.firstName,
1370
+ lastName: me.lastName,
1371
+ phone: me.phone,
1372
+ identificationNumber: me.identificationNumber,
1373
+ identificationType: me.identificationType,
1374
+ entityName: me.entityName,
1375
+ entityIdentificationNumber: me.entityIdentificationNumber,
1376
+ gender: me.gender,
1377
+ role: me.role,
1378
+ companyName: me.companyName,
1379
+ dateOfBirth: me.dateOfBirth,
1380
+ consent: me.consent,
1381
+ countryIsoCode: me.countryIsoCode || DEFAULT_COUNTRY_CODE
1382
+ });
1383
+ }
1384
+ function customerProfileToPatch(profile) {
1385
+ return CustomerProfilePatchSchema.parse({
1386
+ firstName: profile.firstName,
1387
+ lastName: profile.lastName,
1388
+ phone: profile.phone,
1389
+ identificationNumber: profile.identificationNumber,
1390
+ identificationType: profile.identificationType,
1391
+ entityName: profile.entityName,
1392
+ entityIdentificationNumber: profile.entityIdentificationNumber,
1393
+ gender: profile.gender,
1394
+ role: profile.role,
1395
+ companyName: profile.companyName,
1396
+ dateOfBirth: profile.dateOfBirth,
1397
+ consent: profile.consent,
1398
+ countryIsoCode: profile.countryIsoCode || DEFAULT_COUNTRY_CODE
1399
+ });
1400
+ }
1401
+
1402
+ // src/services/customer.service.ts
1403
+ var CUSTOMER_PATH = "customer";
1404
+ var CUSTOMER_REGISTER_PATH = "customer/register";
1405
+ async function registerCustomer(api, data, options = {}) {
1406
+ const payload = CustomerRegisterRequestSchema.parse(data);
1407
+ return api.post(CUSTOMER_REGISTER_PATH, payload, zod.z.unknown(), {
1408
+ headers: options.headers,
1409
+ signal: options.signal
1410
+ });
1411
+ }
1412
+ async function getCustomerMe(api, options = {}) {
1413
+ return api.get(CUSTOMER_PATH, CustomerMeSchema, {
1414
+ headers: options.headers,
1415
+ signal: options.signal
1416
+ });
1417
+ }
1418
+ async function patchCustomer(api, data, options = {}) {
1419
+ const payload = CustomerProfilePatchSchema.parse(data);
1420
+ await api.request("PATCH", CUSTOMER_PATH, zod.z.null(), {
1421
+ body: payload,
1422
+ headers: options.headers,
1423
+ signal: options.signal
1424
+ });
1425
+ }
1426
+ var CustomerOrderShippingAddressSchema = zod.z.object({
1427
+ name: zod.z.string().nullable().optional(),
1428
+ company: zod.z.string().nullable().optional(),
1429
+ address1: zod.z.string(),
1430
+ address2: zod.z.string().nullable().optional(),
1431
+ city: zod.z.string().nullable().optional(),
1432
+ countryCode: zod.z.string().min(2).max(2),
1433
+ province: zod.z.string().nullable().optional(),
1434
+ postalCode: zod.z.string().nullable().optional(),
1435
+ district: zod.z.string().nullable().optional(),
1436
+ phone: zod.z.string().nullable().optional(),
1437
+ latitude: zod.z.number().nullable().optional(),
1438
+ longitude: zod.z.number().nullable().optional(),
1439
+ metadata: zod.z.record(zod.z.unknown()).nullable().optional()
1440
+ }).passthrough();
1441
+ var CustomerOrderLineItemSchema = zod.z.object({
1442
+ id: zod.z.string(),
1443
+ orderId: zod.z.coerce.string(),
1444
+ productId: zod.z.coerce.string().nullable(),
1445
+ variantId: zod.z.coerce.string().nullable(),
1446
+ title: zod.z.string(),
1447
+ subtitle: zod.z.string().nullable().optional(),
1448
+ thumbnail: zod.z.string().nullable().optional(),
1449
+ variantTitle: zod.z.string().nullable().optional(),
1450
+ productHandle: zod.z.string().nullable().optional(),
1451
+ quantity: zod.z.number(),
1452
+ unitPrice: zod.z.number(),
1453
+ total: zod.z.number(),
1454
+ status: zod.z.string()
1455
+ });
1456
+ var CustomerOrderListItemSchema = zod.z.object({
1457
+ orderId: zod.z.coerce.string(),
1458
+ orderNumber: zod.z.string(),
1459
+ orderGroup: zod.z.string(),
1460
+ orderIds: zod.z.array(zod.z.coerce.string()),
1461
+ status: zod.z.string(),
1462
+ total: zod.z.number(),
1463
+ totalPaid: zod.z.number(),
1464
+ currencyCode: zod.z.string(),
1465
+ orderDate: zod.z.string(),
1466
+ createdOn: zod.z.string(),
1467
+ updatedOn: zod.z.string().nullable().optional(),
1468
+ paymentAt: zod.z.string().nullable().optional(),
1469
+ shippingAddress: CustomerOrderShippingAddressSchema.nullable().optional(),
1470
+ shippingAddressSummary: zod.z.string().nullable().optional(),
1471
+ items: zod.z.array(CustomerOrderLineItemSchema)
1472
+ });
1473
+ var CustomerOrderListSchema = zod.z.array(CustomerOrderListItemSchema);
1474
+ var CustomerOrderPaymentSchema = zod.z.object({
1475
+ id: zod.z.string(),
1476
+ paymentMethod: zod.z.string(),
1477
+ paymentCode: zod.z.string(),
1478
+ amount: zod.z.number(),
1479
+ paymentStatus: zod.z.string(),
1480
+ receiptUrl: zod.z.string().nullable().optional(),
1481
+ createdOn: zod.z.string()
1482
+ });
1483
+ var CustomerOrderStatusTimelineSchema = zod.z.object({
1484
+ key: zod.z.string(),
1485
+ label: zod.z.string(),
1486
+ occurredAt: zod.z.string(),
1487
+ description: zod.z.string().nullable().optional(),
1488
+ status: zod.z.string(),
1489
+ source: zod.z.string()
1490
+ });
1491
+ var CustomerOrderDetailSchema = zod.z.object({
1492
+ id: zod.z.coerce.string(),
1493
+ orderNumber: zod.z.string(),
1494
+ orderGroup: zod.z.string(),
1495
+ status: zod.z.string(),
1496
+ total: zod.z.number(),
1497
+ totalPaid: zod.z.number(),
1498
+ currencyCode: zod.z.string(),
1499
+ orderDate: zod.z.string(),
1500
+ createdOn: zod.z.string(),
1501
+ updatedOn: zod.z.string().nullable().optional(),
1502
+ paymentAt: zod.z.string().nullable().optional(),
1503
+ subTotal: zod.z.number(),
1504
+ discount: zod.z.number(),
1505
+ shipping: zod.z.number(),
1506
+ tax: zod.z.number(),
1507
+ email: zod.z.string(),
1508
+ phone: zod.z.string(),
1509
+ firstName: zod.z.string(),
1510
+ lastName: zod.z.string(),
1511
+ shippingAddress: CustomerOrderShippingAddressSchema.nullable().optional(),
1512
+ shippingAddressSummary: zod.z.string().nullable().optional(),
1513
+ billingAddress: CustomerOrderShippingAddressSchema.nullable().optional(),
1514
+ items: zod.z.array(CustomerOrderLineItemSchema),
1515
+ payments: zod.z.array(CustomerOrderPaymentSchema),
1516
+ statusTimeline: zod.z.array(CustomerOrderStatusTimelineSchema)
1517
+ });
1518
+ var ORDER_STATUS_LABELS = {
1519
+ New: "Pedido realizado",
1520
+ Confirmed: "Confirmado",
1521
+ Processing: "En preparaci\xF3n",
1522
+ InTransit: "En camino",
1523
+ Delivered: "Entregado",
1524
+ Cancelled: "Cancelado",
1525
+ Canceled: "Cancelado",
1526
+ Refunded: "Reembolsado",
1527
+ Pending: "Pendiente",
1528
+ PendingToConfirm: "Pendiente de confirmaci\xF3n",
1529
+ Paid: "Pagado",
1530
+ Captured: "Pago confirmado"
1531
+ };
1532
+ function formatCustomerOrderStatus(status) {
1533
+ const trimmed = status.trim();
1534
+ if (!trimmed) return "Desconocido";
1535
+ return ORDER_STATUS_LABELS[trimmed] ?? trimmed.replace(/([A-Z])/g, " $1").trim();
1536
+ }
1537
+ function customerOrderStatusTone(status) {
1538
+ const s = status.toLowerCase();
1539
+ if (s.includes("cancel") || s.includes("refund")) return "danger";
1540
+ if (s.includes("deliver")) return "success";
1541
+ if (s.includes("transit") || s.includes("ship")) return "info";
1542
+ if (s.includes("confirm") || s.includes("paid") || s.includes("capture"))
1543
+ return "success";
1544
+ if (s.includes("pending") || s.includes("new") || s.includes("process"))
1545
+ return "warning";
1546
+ return "default";
1547
+ }
1548
+ function formatOrderDate(iso, locale = "es-PE") {
1549
+ const d = new Date(iso);
1550
+ if (Number.isNaN(d.getTime())) return iso;
1551
+ return new Intl.DateTimeFormat(locale, {
1552
+ day: "numeric",
1553
+ month: "long",
1554
+ year: "numeric"
1555
+ }).format(d);
1556
+ }
1557
+ function formatOrderDateTime(iso, locale = "es-PE") {
1558
+ const d = new Date(iso);
1559
+ if (Number.isNaN(d.getTime())) return iso;
1560
+ return new Intl.DateTimeFormat(locale, {
1561
+ day: "numeric",
1562
+ month: "short",
1563
+ year: "numeric",
1564
+ hour: "2-digit",
1565
+ minute: "2-digit"
1566
+ }).format(d);
1567
+ }
1568
+
1569
+ // src/services/customer-order.service.ts
1570
+ var ORDERS_PATH = "customer/orders";
1571
+ async function getCustomerOrders(api, options = {}) {
1572
+ return api.get(ORDERS_PATH, CustomerOrderListSchema, {
1573
+ headers: options.headers,
1574
+ signal: options.signal
1575
+ });
1576
+ }
1577
+ async function getCustomerOrder(api, orderId, options = {}) {
1578
+ const id = orderId.trim();
1579
+ if (!id) throw new Error("orderId requerido");
1580
+ return api.get(
1581
+ `${ORDERS_PATH}/${encodeURIComponent(id)}`,
1582
+ CustomerOrderDetailSchema,
1583
+ {
1584
+ headers: options.headers,
1585
+ signal: options.signal
1586
+ }
1587
+ );
1588
+ }
1196
1589
 
1197
1590
  // src/client.ts
1198
1591
  var DEFAULT_SETTINGS_CACHE_TTL_MS = 3e4;
1199
1592
  function createClient(options) {
1200
1593
  const {
1201
- slug,
1594
+ domain,
1202
1595
  settingsCacheTtlMs = DEFAULT_SETTINGS_CACHE_TTL_MS,
1203
1596
  ...apiOptions
1204
1597
  } = options;
1205
- if (!slug?.trim()) {
1206
- throw new Error("createClient requiere `slug` (config.slug de ecomiq.config.js)");
1598
+ if (!domain?.trim()) {
1599
+ throw new Error("createClient requiere `domain` (config.domain de ecomiq.config.js)");
1207
1600
  }
1208
1601
  if (!Number.isFinite(settingsCacheTtlMs) || settingsCacheTtlMs < 0) {
1209
1602
  throw new Error("settingsCacheTtlMs debe ser un n\xFAmero mayor o igual a 0");
@@ -1231,7 +1624,7 @@ function createClient(options) {
1231
1624
  if (inflight) return inflight;
1232
1625
  const previous = cache?.data;
1233
1626
  inflight = api.get("settings", StorefrontSettingsSchema, {
1234
- headers: { "x-Store-Domain": slug }
1627
+ headers: { "x-Store-Domain": domain }
1235
1628
  }).then((data) => {
1236
1629
  cache = { data, expiresAt: Date.now() + settingsCacheTtlMs };
1237
1630
  return data;
@@ -1351,6 +1744,38 @@ function createClient(options) {
1351
1744
  async function getDistricts2(params) {
1352
1745
  return getDistricts(api, params);
1353
1746
  }
1747
+ async function getCustomerAddresses2(options2 = {}) {
1748
+ const client = await apiClient();
1749
+ return getCustomerAddresses(client, options2);
1750
+ }
1751
+ async function createCustomerAddress2(data, options2 = {}) {
1752
+ const client = await apiClient();
1753
+ return createCustomerAddress(client, data, options2);
1754
+ }
1755
+ async function updateCustomerAddress2(addressId, data, options2 = {}) {
1756
+ const client = await apiClient();
1757
+ return updateCustomerAddress(client, addressId, data, options2);
1758
+ }
1759
+ async function deleteCustomerAddress2(addressId, options2 = {}) {
1760
+ const client = await apiClient();
1761
+ return deleteCustomerAddress(client, addressId, options2);
1762
+ }
1763
+ async function getCustomerMe2(options2 = {}) {
1764
+ const client = await apiClient();
1765
+ return getCustomerMe(client, options2);
1766
+ }
1767
+ async function patchCustomer2(data, options2 = {}) {
1768
+ const client = await apiClient();
1769
+ return patchCustomer(client, data, options2);
1770
+ }
1771
+ async function getCustomerOrders2(options2 = {}) {
1772
+ const client = await apiClient();
1773
+ return getCustomerOrders(client, options2);
1774
+ }
1775
+ async function getCustomerOrder2(orderId, options2 = {}) {
1776
+ const client = await apiClient();
1777
+ return getCustomerOrder(client, orderId, options2);
1778
+ }
1354
1779
  return {
1355
1780
  ...api,
1356
1781
  getSettings,
@@ -1382,7 +1807,15 @@ function createClient(options) {
1382
1807
  getCountries: getCountries2,
1383
1808
  getDepartments: getDepartments2,
1384
1809
  getProvinces: getProvinces2,
1385
- getDistricts: getDistricts2
1810
+ getDistricts: getDistricts2,
1811
+ getCustomerAddresses: getCustomerAddresses2,
1812
+ createCustomerAddress: createCustomerAddress2,
1813
+ updateCustomerAddress: updateCustomerAddress2,
1814
+ deleteCustomerAddress: deleteCustomerAddress2,
1815
+ getCustomerMe: getCustomerMe2,
1816
+ patchCustomer: patchCustomer2,
1817
+ getCustomerOrders: getCustomerOrders2,
1818
+ getCustomerOrder: getCustomerOrder2
1386
1819
  };
1387
1820
  }
1388
1821
  var createStorefrontClient = createClient;
@@ -1498,6 +1931,21 @@ exports.CountriesSchema = CountriesSchema;
1498
1931
  exports.CountrySchema = CountrySchema;
1499
1932
  exports.CreateCartParamsSchema = CreateCartParamsSchema;
1500
1933
  exports.CreateProductReviewParamsSchema = CreateProductReviewParamsSchema;
1934
+ exports.CustomerAddressMutationResponseSchema = CustomerAddressMutationResponseSchema;
1935
+ exports.CustomerAddressSchema = CustomerAddressSchema;
1936
+ exports.CustomerAddressUpsertInputSchema = CustomerAddressUpsertInputSchema;
1937
+ exports.CustomerAddressesSchema = CustomerAddressesSchema;
1938
+ exports.CustomerMeSchema = CustomerMeSchema;
1939
+ exports.CustomerOrderDetailSchema = CustomerOrderDetailSchema;
1940
+ exports.CustomerOrderLineItemSchema = CustomerOrderLineItemSchema;
1941
+ exports.CustomerOrderListItemSchema = CustomerOrderListItemSchema;
1942
+ exports.CustomerOrderListSchema = CustomerOrderListSchema;
1943
+ exports.CustomerOrderPaymentSchema = CustomerOrderPaymentSchema;
1944
+ exports.CustomerOrderShippingAddressSchema = CustomerOrderShippingAddressSchema;
1945
+ exports.CustomerOrderStatusTimelineSchema = CustomerOrderStatusTimelineSchema;
1946
+ exports.CustomerProfilePatchSchema = CustomerProfilePatchSchema;
1947
+ exports.CustomerProfileSchema = CustomerProfileSchema;
1948
+ exports.CustomerRegisterRequestSchema = CustomerRegisterRequestSchema;
1501
1949
  exports.DEFAULT_API_BASE_URL = DEFAULT_API_BASE_URL;
1502
1950
  exports.DEFAULT_API_VERSION = DEFAULT_API_VERSION;
1503
1951
  exports.DepartmentSchema = DepartmentSchema;
@@ -1593,11 +2041,24 @@ exports.checkoutCart = checkoutCart;
1593
2041
  exports.createApi = createApi;
1594
2042
  exports.createCart = createCart;
1595
2043
  exports.createClient = createClient;
2044
+ exports.createCustomerAddress = createCustomerAddress;
1596
2045
  exports.createProductReview = createProductReview;
1597
2046
  exports.createStorefrontClient = createStorefrontClient;
2047
+ exports.customerMeToProfile = customerMeToProfile;
2048
+ exports.customerMeToProfilePatch = customerMeToProfilePatch;
2049
+ exports.customerOrderStatusTone = customerOrderStatusTone;
2050
+ exports.customerProfileToPatch = customerProfileToPatch;
2051
+ exports.deleteCustomerAddress = deleteCustomerAddress;
2052
+ exports.formatCustomerOrderStatus = formatCustomerOrderStatus;
2053
+ exports.formatOrderDate = formatOrderDate;
2054
+ exports.formatOrderDateTime = formatOrderDateTime;
1598
2055
  exports.getCart = getCart;
1599
2056
  exports.getCartCheckout = getCartCheckout;
1600
2057
  exports.getCountries = getCountries;
2058
+ exports.getCustomerAddresses = getCustomerAddresses;
2059
+ exports.getCustomerMe = getCustomerMe;
2060
+ exports.getCustomerOrder = getCustomerOrder;
2061
+ exports.getCustomerOrders = getCustomerOrders;
1601
2062
  exports.getDepartments = getDepartments;
1602
2063
  exports.getDistricts = getDistricts;
1603
2064
  exports.getMenuItems = getMenuItems;
@@ -1610,13 +2071,17 @@ exports.getShippingOptions = getShippingOptions;
1610
2071
  exports.listProductReviews = listProductReviews;
1611
2072
  exports.patchCartAddresses = patchCartAddresses;
1612
2073
  exports.patchCartBuyer = patchCartBuyer;
2074
+ exports.patchCustomer = patchCustomer;
1613
2075
  exports.putCartShippingMethod = putCartShippingMethod;
2076
+ exports.registerCustomer = registerCustomer;
1614
2077
  exports.removeCartItem = removeCartItem;
1615
2078
  exports.removeCartPromotionCode = removeCartPromotionCode;
1616
2079
  exports.resolveApiBaseUrl = resolveApiBaseUrl;
1617
2080
  exports.sanitizeHtml = sanitizeHtml;
1618
2081
  exports.stripHtml = stripHtml;
2082
+ exports.toCustomerSavedAddresses = toCustomerSavedAddresses;
1619
2083
  exports.updateCartItemQuantity = updateCartItemQuantity;
2084
+ exports.updateCustomerAddress = updateCustomerAddress;
1620
2085
  exports.uploadPaymentReceipt = uploadPaymentReceipt;
1621
2086
  //# sourceMappingURL=index.cjs.map
1622
2087
  //# sourceMappingURL=index.cjs.map