@ecomiq/core 0.1.9 → 1.0.0
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/LICENSE +21 -0
- package/README.md +39 -2
- package/dist/_virtual/_rolldown/runtime-C6LprzCP.cjs +22 -0
- package/dist/api.cjs +117 -102
- package/dist/api.d.cts +33 -37
- package/dist/api.d.ts +33 -37
- package/dist/api.js +116 -100
- package/dist/client.cjs +499 -1676
- package/dist/client.d.cts +156 -15
- package/dist/client.d.ts +156 -15
- package/dist/client.js +500 -1675
- package/dist/index.cjs +333 -2092
- package/dist/index.d.cts +53 -1127
- package/dist/index.d.ts +53 -1127
- package/dist/index.js +52 -1895
- package/dist/libs/bounded-read-cache-Abmb5VnJ.js +41 -0
- package/dist/libs/bounded-read-cache-D4644LJo.cjs +41 -0
- package/dist/libs/catalog-link-key-B7l5KZsF.js +9 -0
- package/dist/libs/catalog-link-key-CZTHJBGD.cjs +9 -0
- package/dist/libs/catalog-link-key.d.cts +2 -0
- package/dist/libs/catalog-link-key.d.ts +2 -0
- package/dist/libs/graphql-_6Y8lR_Q.js +49 -0
- package/dist/libs/graphql-selection-Cj51WkJn.cjs +21 -0
- package/dist/libs/graphql-selection-H1RMh6VD.js +21 -0
- package/dist/libs/graphql-selection.d.cts +3 -0
- package/dist/libs/graphql-selection.d.ts +3 -0
- package/dist/libs/graphql-wJH7HaQU.cjs +50 -0
- package/dist/libs/graphql.d.cts +24 -0
- package/dist/libs/graphql.d.ts +24 -0
- package/dist/models/amounts-cKBCecl7.js +5 -0
- package/dist/models/amounts-lmg89eJQ.cjs +4 -0
- package/dist/models/articles-C-4JvT2Z.js +27 -0
- package/dist/models/articles-xHCXLKDK.cjs +30 -0
- package/dist/models/articles.d.cts +46 -0
- package/dist/models/articles.d.ts +46 -0
- package/dist/models/catalog-links-BzJeyBy4.js +80 -0
- package/dist/models/catalog-links-c4LADGf_.cjs +88 -0
- package/dist/models/catalog-links.d.cts +39 -0
- package/dist/models/catalog-links.d.ts +39 -0
- package/dist/models/categories-CKkJY8_P.js +42 -0
- package/dist/models/categories-DZ5i5kwi.cjs +45 -0
- package/dist/models/categories.d.cts +54 -0
- package/dist/models/categories.d.ts +54 -0
- package/dist/models/collections.cjs +13 -22
- package/dist/models/collections.d.cts +23 -56
- package/dist/models/collections.d.ts +23 -56
- package/dist/models/collections.js +12 -20
- package/dist/models/complaint-book-D5INpuI2.cjs +64 -0
- package/dist/models/complaint-book-QpQZe7Xl.js +58 -0
- package/dist/models/complaint-book.d.cts +71 -0
- package/dist/models/complaint-book.d.ts +71 -0
- package/dist/models/customer-address.cjs +39 -38
- package/dist/models/customer-address.d.cts +59 -158
- package/dist/models/customer-address.d.ts +59 -158
- package/dist/models/customer-address.js +38 -36
- package/dist/models/customer-order.cjs +181 -142
- package/dist/models/customer-order.d.cts +430 -858
- package/dist/models/customer-order.d.ts +430 -858
- package/dist/models/customer-order.js +178 -141
- package/dist/models/customer-profile.cjs +121 -118
- package/dist/models/customer-profile.d.cts +89 -174
- package/dist/models/customer-profile.d.ts +89 -174
- package/dist/models/customer-profile.js +121 -116
- package/dist/models/customer-registration-C13knqyv.js +28 -0
- package/dist/models/customer-registration-EZ0yZgGr.cjs +31 -0
- package/dist/models/customer-registration.d.cts +66 -0
- package/dist/models/customer-registration.d.ts +66 -0
- package/dist/models/customer-session-BiX0TXhO.js +41 -0
- package/dist/models/customer-session-JeQiC8Yx.cjs +45 -0
- package/dist/models/customer-session.d.cts +61 -0
- package/dist/models/customer-session.d.ts +61 -0
- package/dist/models/geo.cjs +52 -49
- package/dist/models/geo.d.cts +141 -270
- package/dist/models/geo.d.ts +141 -270
- package/dist/models/geo.js +51 -47
- package/dist/models/ids.cjs +8 -11
- package/dist/models/ids.d.cts +7 -10
- package/dist/models/ids.d.ts +7 -10
- package/dist/models/ids.js +7 -9
- package/dist/models/order-draft-CnHJ0btL.js +37 -0
- package/dist/models/order-draft-PFBZfRRR.cjs +39 -0
- package/dist/models/order-draft.d.cts +51 -0
- package/dist/models/order-draft.d.ts +51 -0
- package/dist/models/order-review--xGlZKtS.cjs +18 -0
- package/dist/models/order-review-egGeCaqB.js +17 -0
- package/dist/models/order-review.d.cts +22 -0
- package/dist/models/order-review.d.ts +22 -0
- package/dist/models/order-status-CS_OeSPY.cjs +66 -0
- package/dist/models/order-status-CgaLkU0M.js +60 -0
- package/dist/models/order-status.d.cts +298 -0
- package/dist/models/order-status.d.ts +298 -0
- package/dist/models/payment-methods--VUUZpMz.js +17 -0
- package/dist/models/payment-methods-CmK08zBM.cjs +19 -0
- package/dist/models/payment-methods.d.cts +28 -0
- package/dist/models/payment-methods.d.ts +28 -0
- package/dist/models/products.cjs +215 -194
- package/dist/models/products.d.cts +612 -1354
- package/dist/models/products.d.ts +612 -1354
- package/dist/models/products.js +211 -187
- package/dist/models/search.cjs +13 -23
- package/dist/models/search.d.cts +21 -51
- package/dist/models/search.d.ts +21 -51
- package/dist/models/search.js +12 -21
- package/dist/models/sellers.cjs +44 -0
- package/dist/models/sellers.d.cts +82 -0
- package/dist/models/sellers.d.ts +82 -0
- package/dist/models/sellers.js +38 -0
- package/dist/models/settings.cjs +205 -236
- package/dist/models/settings.d.cts +853 -6940
- package/dist/models/settings.d.ts +853 -6940
- package/dist/models/settings.js +213 -239
- package/dist/models/storefront-cart.cjs +144 -118
- package/dist/models/storefront-cart.d.cts +246 -706
- package/dist/models/storefront-cart.d.ts +246 -706
- package/dist/models/storefront-cart.js +141 -117
- package/dist/models/storefront-checkout.cjs +212 -297
- package/dist/models/storefront-checkout.d.cts +654 -2449
- package/dist/models/storefront-checkout.d.ts +654 -2449
- package/dist/models/storefront-checkout.js +208 -297
- package/dist/models/storefront-reviews.cjs +58 -43
- package/dist/models/storefront-reviews.d.cts +71 -139
- package/dist/models/storefront-reviews.d.ts +71 -139
- package/dist/models/storefront-reviews.js +55 -42
- package/dist/models/tracking-CiIAhQW0.js +33 -0
- package/dist/models/tracking-wNyzQ6Bp.cjs +36 -0
- package/dist/models/tracking.d.cts +26 -0
- package/dist/models/tracking.d.ts +26 -0
- package/dist/models/urls-B0ZODOwH.cjs +35 -0
- package/dist/models/urls-Dt_dTt4Q.js +33 -0
- package/dist/models/urls.d.cts +201 -0
- package/dist/models/urls.d.ts +201 -0
- package/dist/redirects.cjs +113 -0
- package/dist/redirects.d.cts +11 -0
- package/dist/redirects.d.ts +11 -0
- package/dist/redirects.js +108 -0
- package/dist/services/article.service-DBsOvflH.js +10 -0
- package/dist/services/article.service-zmTkbbPV.cjs +11 -0
- package/dist/services/article.service.d.cts +4 -0
- package/dist/services/article.service.d.ts +4 -0
- package/dist/services/cart.service-B0D8s6jI.cjs +37 -0
- package/dist/services/cart.service-yMCz9oQP.js +33 -0
- package/dist/services/cart.service.d.cts +527 -0
- package/dist/services/cart.service.d.ts +527 -0
- package/dist/services/catalog-link.service-BQ2d-EPX.js +8 -0
- package/dist/services/catalog-link.service-DiB-OVjn.cjs +8 -0
- package/dist/services/category.service-8tieYX2r.js +6 -0
- package/dist/services/category.service-BsSJZV2B.cjs +6 -0
- package/dist/services/checkout.service-CC-3tm2y.js +60 -0
- package/dist/services/checkout.service-CG8KrDNY.cjs +69 -0
- package/dist/services/checkout.service.d.cts +439 -0
- package/dist/services/checkout.service.d.ts +439 -0
- package/dist/services/collection.service-C4QETpuI.js +11 -0
- package/dist/services/collection.service-DHGN3rhs.cjs +12 -0
- package/dist/services/complaint-book.service-C7TxltQe.cjs +13 -0
- package/dist/services/complaint-book.service-DXiVyKdD.js +12 -0
- package/dist/services/complaint-book.service.d.cts +4 -0
- package/dist/services/complaint-book.service.d.ts +4 -0
- package/dist/services/customer-address.service-Ca4qla_R.cjs +51 -0
- package/dist/services/customer-address.service-xEThx7cQ.js +47 -0
- package/dist/services/customer-address.service.d.cts +19 -0
- package/dist/services/customer-address.service.d.ts +19 -0
- package/dist/services/customer-order.service-DLGgT0xa.cjs +54 -0
- package/dist/services/customer-order.service-qHoRBuyX.js +51 -0
- package/dist/services/customer-order.service.d.cts +34 -0
- package/dist/services/customer-order.service.d.ts +34 -0
- package/dist/services/customer-registration.service-C3BNyCHP.cjs +10 -0
- package/dist/services/customer-registration.service-CxcWD2hf.js +9 -0
- package/dist/services/customer-registration.service.d.cts +5 -0
- package/dist/services/customer-registration.service.d.ts +5 -0
- package/dist/services/customer-session.service-4YgfbWRB.js +16 -0
- package/dist/services/customer-session.service-Bd8pLC2v.cjs +19 -0
- package/dist/services/customer.service-BM0NrOxP.cjs +26 -0
- package/dist/services/customer.service-BoU6l2-R.js +25 -0
- package/dist/services/customer.service.d.cts +10 -0
- package/dist/services/customer.service.d.ts +10 -0
- package/dist/services/geo.service-C32R7N8W.js +39 -0
- package/dist/services/geo.service-JeTT3Wun.cjs +42 -0
- package/dist/services/geo.service.d.cts +10 -0
- package/dist/services/geo.service.d.ts +10 -0
- package/dist/services/layout.service-BkvLzl1g.cjs +50 -0
- package/dist/services/layout.service-DmbeMOkK.js +50 -0
- package/dist/services/layout.service.d.cts +9 -0
- package/dist/services/layout.service.d.ts +9 -0
- package/dist/services/order-draft.service-D9gy-OPr.cjs +14 -0
- package/dist/services/order-draft.service-DYPR_pcV.js +13 -0
- package/dist/services/order-draft.service.d.cts +4 -0
- package/dist/services/order-draft.service.d.ts +4 -0
- package/dist/services/order-review.service-BEr-FB6_.cjs +11 -0
- package/dist/services/order-review.service-PdBPUsxE.js +11 -0
- package/dist/services/order-review.service.d.cts +7 -0
- package/dist/services/order-review.service.d.ts +7 -0
- package/dist/services/order-status.service-Cn7dsaJo.cjs +26 -0
- package/dist/services/order-status.service-MC9hVpP-.js +23 -0
- package/dist/services/order-status.service.d.cts +16 -0
- package/dist/services/order-status.service.d.ts +16 -0
- package/dist/services/page.service-CWhWCjMQ.js +7 -0
- package/dist/services/page.service-DmCSeMiR.cjs +7 -0
- package/dist/services/page.service.d.cts +4 -0
- package/dist/services/page.service.d.ts +4 -0
- package/dist/services/payment-method.service-CEt_nB4R.cjs +7 -0
- package/dist/services/payment-method.service-CjKbAsOh.js +7 -0
- package/dist/services/payment-method.service.d.cts +4 -0
- package/dist/services/payment-method.service.d.ts +4 -0
- package/dist/services/product.service-B05Qmbuh.js +35 -0
- package/dist/services/product.service-B7OFZWB1.cjs +37 -0
- package/dist/services/product.service.d.cts +231 -0
- package/dist/services/product.service.d.ts +231 -0
- package/dist/services/review.service-CO2icjpu.cjs +46 -0
- package/dist/services/review.service-De1YkhFp.js +43 -0
- package/dist/services/review.service.d.cts +28 -0
- package/dist/services/review.service.d.ts +28 -0
- package/dist/services/search.service-Bx1zbTHJ.cjs +10 -0
- package/dist/services/search.service-DSBMhaSY.js +10 -0
- package/dist/services/search.service.d.cts +9 -0
- package/dist/services/search.service.d.ts +9 -0
- package/dist/services/seller.service-D11WHhbC.cjs +10 -0
- package/dist/services/seller.service-DUptDTv4.js +9 -0
- package/dist/services/seller.service.d.cts +42 -0
- package/dist/services/seller.service.d.ts +42 -0
- package/dist/services/tracking.service-CPK1B69N.js +11 -0
- package/dist/services/tracking.service-DqOoi8qr.cjs +11 -0
- package/dist/services/tracking.service.d.cts +7 -0
- package/dist/services/tracking.service.d.ts +7 -0
- package/dist/services/url.service-B-nC14Ue.cjs +19 -0
- package/dist/services/url.service-CLW0Tc7S.js +18 -0
- package/dist/storefront-cache-revision.cjs +23 -0
- package/dist/storefront-cache-revision.d.cts +16 -0
- package/dist/storefront-cache-revision.d.ts +16 -0
- package/dist/storefront-cache-revision.js +17 -0
- package/dist/storefront-routes.cjs +14 -0
- package/dist/storefront-routes.d.cts +11 -0
- package/dist/storefront-routes.d.ts +11 -0
- package/dist/storefront-routes.js +12 -0
- package/dist/utils-CDEC5xcY.cjs +139 -0
- package/dist/utils-DK7qa54o.js +136 -0
- package/dist/utils.d.cts +3 -0
- package/dist/utils.d.ts +3 -0
- package/dist/video-links-CbRO0m8V.js +47 -0
- package/dist/video-links-ClryQjPH.cjs +47 -0
- package/dist/video-links.d.cts +7 -0
- package/dist/video-links.d.ts +7 -0
- package/package.json +28 -11
- package/dist/api.cjs.map +0 -1
- package/dist/api.js.map +0 -1
- package/dist/client-Ba1r_uiO.d.ts +0 -195
- package/dist/client-Cqcnv2tC.d.cts +0 -195
- package/dist/client.cjs.map +0 -1
- package/dist/client.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/models/collections.cjs.map +0 -1
- package/dist/models/collections.js.map +0 -1
- package/dist/models/customer-address.cjs.map +0 -1
- package/dist/models/customer-address.js.map +0 -1
- package/dist/models/customer-order.cjs.map +0 -1
- package/dist/models/customer-order.js.map +0 -1
- package/dist/models/customer-profile.cjs.map +0 -1
- package/dist/models/customer-profile.js.map +0 -1
- package/dist/models/geo.cjs.map +0 -1
- package/dist/models/geo.js.map +0 -1
- package/dist/models/ids.cjs.map +0 -1
- package/dist/models/ids.js.map +0 -1
- package/dist/models/products.cjs.map +0 -1
- package/dist/models/products.js.map +0 -1
- package/dist/models/search.cjs.map +0 -1
- package/dist/models/search.js.map +0 -1
- package/dist/models/settings.cjs.map +0 -1
- package/dist/models/settings.js.map +0 -1
- package/dist/models/storefront-cart.cjs.map +0 -1
- package/dist/models/storefront-cart.js.map +0 -1
- package/dist/models/storefront-checkout.cjs.map +0 -1
- package/dist/models/storefront-checkout.js.map +0 -1
- package/dist/models/storefront-reviews.cjs.map +0 -1
- package/dist/models/storefront-reviews.js.map +0 -1
|
@@ -1,155 +1,192 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { DiscountAmountSchema } from "./amounts-cKBCecl7.js";
|
|
2
|
+
import { EntityIdSchema } from "./ids.js";
|
|
3
|
+
import { z } from "zod";
|
|
3
4
|
// src/models/customer-order.ts
|
|
4
|
-
|
|
5
|
-
z.string().
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
5
|
+
const CustomerOrderShippingAddressSchema = z.object({
|
|
6
|
+
name: z.string().nullable(),
|
|
7
|
+
company: z.string().nullable(),
|
|
8
|
+
address1: z.string(),
|
|
9
|
+
address2: z.string().nullable(),
|
|
10
|
+
city: z.string(),
|
|
11
|
+
countryCode: z.string(),
|
|
12
|
+
province: z.string().nullable(),
|
|
13
|
+
postalCode: z.string().nullable(),
|
|
14
|
+
district: z.string().nullable(),
|
|
15
|
+
phone: z.string().nullable(),
|
|
16
|
+
latitude: z.number().nullable(),
|
|
17
|
+
longitude: z.number().nullable(),
|
|
18
|
+
metadata: z.record(z.string(), z.unknown())
|
|
19
|
+
});
|
|
20
|
+
const OrderStepSchema = z.preprocess((value) => typeof value === "string" ? value.charAt(0).toLowerCase() + value.slice(1) : value, z.enum([
|
|
21
|
+
"pending",
|
|
22
|
+
"confirmed",
|
|
23
|
+
"shipped",
|
|
24
|
+
"outForDelivery",
|
|
25
|
+
"delivered",
|
|
26
|
+
"cancelled"
|
|
27
|
+
]));
|
|
28
|
+
const CustomerOrderLineItemSchema = z.object({
|
|
29
|
+
id: EntityIdSchema,
|
|
30
|
+
orderId: EntityIdSchema,
|
|
31
|
+
productId: EntityIdSchema.nullable(),
|
|
32
|
+
variantId: EntityIdSchema.nullable(),
|
|
33
|
+
title: z.string(),
|
|
34
|
+
subtitle: z.string().nullable(),
|
|
35
|
+
thumbnail: z.string().nullable(),
|
|
36
|
+
variantTitle: z.string().nullable(),
|
|
37
|
+
productHandle: z.string().nullable(),
|
|
38
|
+
productUrl: z.string().nullable(),
|
|
39
|
+
quantity: z.number(),
|
|
40
|
+
unitPrice: z.number(),
|
|
41
|
+
total: z.number(),
|
|
42
|
+
status: z.string(),
|
|
43
|
+
step: OrderStepSchema.optional(),
|
|
44
|
+
carrierName: z.string().nullish(),
|
|
45
|
+
trackingNumber: z.string().nullish(),
|
|
46
|
+
trackingLink: z.string().nullish(),
|
|
47
|
+
shippedAt: z.string().nullish(),
|
|
48
|
+
deliveredAt: z.string().nullish(),
|
|
49
|
+
returnableQuantity: z.number().default(0)
|
|
50
|
+
});
|
|
51
|
+
const CustomerOrderPaymentSchema = z.object({
|
|
52
|
+
id: EntityIdSchema,
|
|
53
|
+
paymentMethod: z.string(),
|
|
54
|
+
paymentCode: z.string(),
|
|
55
|
+
cardBrand: z.string().nullish(),
|
|
56
|
+
cardLast4: z.string().nullish(),
|
|
57
|
+
installments: z.number().int().nullish(),
|
|
58
|
+
amount: z.number(),
|
|
59
|
+
paymentStatus: z.string().nullable(),
|
|
60
|
+
receiptUrl: z.string().nullable(),
|
|
61
|
+
createdOn: z.string()
|
|
62
|
+
});
|
|
63
|
+
/** GET /v1/customer/orders (listado agrupado vía proxy `customer/orders`). */
|
|
64
|
+
const CustomerOrderListItemSchema = z.object({
|
|
65
|
+
orderId: EntityIdSchema,
|
|
66
|
+
orderNumber: z.string(),
|
|
67
|
+
orderGroup: z.string(),
|
|
68
|
+
orderIds: z.array(EntityIdSchema),
|
|
69
|
+
status: z.string(),
|
|
70
|
+
step: OrderStepSchema.optional(),
|
|
71
|
+
total: z.number(),
|
|
72
|
+
totalPaid: z.number(),
|
|
73
|
+
currencyCode: z.string(),
|
|
74
|
+
orderDate: z.string(),
|
|
75
|
+
createdOn: z.string(),
|
|
76
|
+
updatedOn: z.string().nullable(),
|
|
77
|
+
paymentAt: z.string().nullable(),
|
|
78
|
+
shippingAddress: CustomerOrderShippingAddressSchema,
|
|
79
|
+
shippingAddressSummary: z.string().nullable(),
|
|
80
|
+
items: z.array(CustomerOrderLineItemSchema),
|
|
81
|
+
payments: z.array(CustomerOrderPaymentSchema).default([])
|
|
39
82
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
total: z.number(),
|
|
47
|
-
totalPaid: z.number(),
|
|
48
|
-
currencyCode: z.string(),
|
|
49
|
-
orderDate: z.string(),
|
|
50
|
-
createdOn: z.string(),
|
|
51
|
-
updatedOn: z.string().nullable().optional(),
|
|
52
|
-
paymentAt: z.string().nullable().optional(),
|
|
53
|
-
shippingAddress: CustomerOrderShippingAddressSchema.nullable().optional(),
|
|
54
|
-
shippingAddressSummary: z.string().nullable().optional(),
|
|
55
|
-
items: z.array(CustomerOrderLineItemSchema)
|
|
83
|
+
const CustomerOrderListSchema = z.array(CustomerOrderListItemSchema);
|
|
84
|
+
const CustomerOrderPageSchema = z.object({
|
|
85
|
+
data: CustomerOrderListSchema,
|
|
86
|
+
hasNextPage: z.boolean(),
|
|
87
|
+
nextCursor: z.string().nullable(),
|
|
88
|
+
totalCount: z.number().nullable()
|
|
56
89
|
});
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
receiptUrl: z.string().nullable().optional(),
|
|
65
|
-
createdOn: z.string()
|
|
90
|
+
const CustomerOrderStatusTimelineSchema = z.object({
|
|
91
|
+
key: z.string(),
|
|
92
|
+
label: z.string(),
|
|
93
|
+
occurredAt: z.string(),
|
|
94
|
+
description: z.string().nullable(),
|
|
95
|
+
status: z.string().nullable(),
|
|
96
|
+
source: z.string()
|
|
66
97
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
description: z.string().nullable().optional(),
|
|
72
|
-
status: z.string(),
|
|
73
|
-
source: z.string()
|
|
98
|
+
const CustomerOrderShipmentSchema = z.object({
|
|
99
|
+
carrierName: z.string().nullable(),
|
|
100
|
+
trackingNumber: z.string().nullable(),
|
|
101
|
+
trackingLink: z.string().nullable()
|
|
74
102
|
});
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
103
|
+
/** GET /v1/customer/orders/{orderId} (detalle vía proxy). */
|
|
104
|
+
const CustomerOrderDetailSchema = z.object({
|
|
105
|
+
id: EntityIdSchema,
|
|
106
|
+
orderNumber: z.string(),
|
|
107
|
+
orderGroup: z.string().nullable(),
|
|
108
|
+
status: z.string(),
|
|
109
|
+
step: OrderStepSchema.optional(),
|
|
110
|
+
total: z.number(),
|
|
111
|
+
totalPaid: z.number(),
|
|
112
|
+
currencyCode: z.string(),
|
|
113
|
+
orderDate: z.string(),
|
|
114
|
+
createdOn: z.string(),
|
|
115
|
+
updatedOn: z.string().nullable(),
|
|
116
|
+
paymentAt: z.string().nullable(),
|
|
117
|
+
subTotal: z.number(),
|
|
118
|
+
discount: DiscountAmountSchema,
|
|
119
|
+
shipping: z.number(),
|
|
120
|
+
tax: z.number(),
|
|
121
|
+
email: z.string().nullable(),
|
|
122
|
+
phone: z.string().nullable(),
|
|
123
|
+
identificationType: z.string().nullish(),
|
|
124
|
+
identificationNumber: z.string().nullish(),
|
|
125
|
+
identificationCountryCode: z.string().length(2).nullish(),
|
|
126
|
+
firstName: z.string().nullable(),
|
|
127
|
+
lastName: z.string().nullable(),
|
|
128
|
+
shippingAddress: CustomerOrderShippingAddressSchema,
|
|
129
|
+
shippingAddressSummary: z.string().nullable(),
|
|
130
|
+
billingAddress: CustomerOrderShippingAddressSchema,
|
|
131
|
+
items: z.array(CustomerOrderLineItemSchema),
|
|
132
|
+
payments: z.array(CustomerOrderPaymentSchema),
|
|
133
|
+
statusTimeline: z.array(CustomerOrderStatusTimelineSchema),
|
|
134
|
+
shipments: z.array(CustomerOrderShipmentSchema),
|
|
135
|
+
paymentPath: z.string().nullish(),
|
|
136
|
+
returnStatus: z.string().nullish(),
|
|
137
|
+
returnDeadline: z.string().nullish(),
|
|
138
|
+
canRequestReturn: z.boolean().default(false),
|
|
139
|
+
cancellationRequestedAt: z.string().nullish(),
|
|
140
|
+
canRequestCancellation: z.boolean().default(false)
|
|
101
141
|
});
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
142
|
+
/** Etiquetas en español para estados de pedido (upstream suele enviar PascalCase). */
|
|
143
|
+
const ORDER_STATUS_LABELS = {
|
|
144
|
+
New: "Pedido realizado",
|
|
145
|
+
Confirmed: "Confirmado",
|
|
146
|
+
Processing: "En preparación",
|
|
147
|
+
InTransit: "En camino",
|
|
148
|
+
Delivered: "Entregado",
|
|
149
|
+
Cancelled: "Cancelado",
|
|
150
|
+
Canceled: "Cancelado",
|
|
151
|
+
Refunded: "Reembolsado",
|
|
152
|
+
Pending: "Pendiente",
|
|
153
|
+
PendingToConfirm: "Pendiente de confirmación",
|
|
154
|
+
Paid: "Pagado",
|
|
155
|
+
Captured: "Pago confirmado"
|
|
115
156
|
};
|
|
116
157
|
function formatCustomerOrderStatus(status) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
158
|
+
const trimmed = status.trim();
|
|
159
|
+
if (!trimmed) return "Desconocido";
|
|
160
|
+
return ORDER_STATUS_LABELS[trimmed] ?? trimmed.replace(/([A-Z])/g, " $1").trim();
|
|
120
161
|
}
|
|
121
162
|
function customerOrderStatusTone(status) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
return "warning";
|
|
130
|
-
return "default";
|
|
163
|
+
const s = status.toLowerCase();
|
|
164
|
+
if (s.includes("cancel") || s.includes("refund")) return "danger";
|
|
165
|
+
if (s.includes("deliver")) return "success";
|
|
166
|
+
if (s.includes("transit") || s.includes("ship")) return "info";
|
|
167
|
+
if (s.includes("confirm") || s.includes("paid") || s.includes("capture")) return "success";
|
|
168
|
+
if (s.includes("pending") || s.includes("new") || s.includes("process")) return "warning";
|
|
169
|
+
return "default";
|
|
131
170
|
}
|
|
132
|
-
function formatOrderDate(iso, locale = "es-PE") {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
171
|
+
function formatOrderDate(iso, locale = "es-PE", timeZone) {
|
|
172
|
+
const d = new Date(iso);
|
|
173
|
+
if (Number.isNaN(d.getTime())) return iso;
|
|
174
|
+
return new Intl.DateTimeFormat(locale, {
|
|
175
|
+
day: "numeric",
|
|
176
|
+
month: "long",
|
|
177
|
+
year: "numeric",
|
|
178
|
+
timeZone
|
|
179
|
+
}).format(d);
|
|
140
180
|
}
|
|
141
181
|
function formatOrderDateTime(iso, locale = "es-PE") {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
182
|
+
const d = new Date(iso);
|
|
183
|
+
if (Number.isNaN(d.getTime())) return iso;
|
|
184
|
+
return new Intl.DateTimeFormat(locale, {
|
|
185
|
+
day: "numeric",
|
|
186
|
+
month: "short",
|
|
187
|
+
year: "numeric",
|
|
188
|
+
hour: "2-digit",
|
|
189
|
+
minute: "2-digit"
|
|
190
|
+
}).format(d);
|
|
151
191
|
}
|
|
152
|
-
|
|
153
|
-
export { CustomerOrderDetailSchema, CustomerOrderLineItemSchema, CustomerOrderListItemSchema, CustomerOrderListSchema, CustomerOrderPaymentSchema, CustomerOrderShippingAddressSchema, CustomerOrderStatusTimelineSchema, customerOrderStatusTone, formatCustomerOrderStatus, formatOrderDate, formatOrderDateTime };
|
|
154
|
-
//# sourceMappingURL=customer-order.js.map
|
|
155
|
-
//# sourceMappingURL=customer-order.js.map
|
|
192
|
+
export { CustomerOrderDetailSchema, CustomerOrderLineItemSchema, CustomerOrderListItemSchema, CustomerOrderListSchema, CustomerOrderPageSchema, CustomerOrderPaymentSchema, CustomerOrderShipmentSchema, CustomerOrderShippingAddressSchema, CustomerOrderStatusTimelineSchema, OrderStepSchema, customerOrderStatusTone, formatCustomerOrderStatus, formatOrderDate, formatOrderDateTime };
|
|
@@ -1,132 +1,135 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_models_ids = require("./ids.cjs");
|
|
3
|
+
const require_models_customer_address = require("./customer-address.cjs");
|
|
4
|
+
let zod = require("zod");
|
|
5
5
|
// src/models/customer-profile.ts
|
|
6
|
-
|
|
7
|
-
zod.z.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
/** Cuerpo de `PATCH /v1/customer` (proxy `customer`). */
|
|
7
|
+
const CustomerProfilePatchSchema = zod.z.object({
|
|
8
|
+
firstName: zod.z.string().trim().max(100),
|
|
9
|
+
lastName: zod.z.string().trim().max(100),
|
|
10
|
+
phone: zod.z.string().trim(),
|
|
11
|
+
identificationNumber: zod.z.string().nullable(),
|
|
12
|
+
identificationType: zod.z.string().nullable(),
|
|
13
|
+
identificationCountryCode: zod.z.string().length(2).nullish(),
|
|
14
|
+
entityName: zod.z.string().nullable(),
|
|
15
|
+
entityIdentificationNumber: zod.z.string().nullable(),
|
|
16
|
+
gender: zod.z.string().nullable(),
|
|
17
|
+
role: zod.z.string().nullable(),
|
|
18
|
+
companyName: zod.z.string().nullable(),
|
|
19
|
+
dateOfBirth: zod.z.string().nullable(),
|
|
20
|
+
consent: zod.z.boolean(),
|
|
21
|
+
countryIsoCode: zod.z.string().trim().length(2)
|
|
20
22
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
/** Perfil mostrado en cuenta (subset de GET customer). */
|
|
24
|
+
const CustomerProfileSchema = zod.z.object({
|
|
25
|
+
firstName: zod.z.string(),
|
|
26
|
+
lastName: zod.z.string(),
|
|
27
|
+
phone: zod.z.string(),
|
|
28
|
+
email: zod.z.string(),
|
|
29
|
+
identificationNumber: zod.z.string().nullable(),
|
|
30
|
+
identificationType: zod.z.string().nullable(),
|
|
31
|
+
identificationCountryCode: zod.z.string().length(2).nullish(),
|
|
32
|
+
countryIsoCode: zod.z.string(),
|
|
33
|
+
consent: zod.z.boolean(),
|
|
34
|
+
entityName: zod.z.string().nullable(),
|
|
35
|
+
entityIdentificationNumber: zod.z.string().nullable(),
|
|
36
|
+
gender: zod.z.string().nullable(),
|
|
37
|
+
role: zod.z.string().nullable(),
|
|
38
|
+
companyName: zod.z.string().nullable(),
|
|
39
|
+
dateOfBirth: zod.z.string().nullable()
|
|
35
40
|
});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
41
|
+
/** Respuesta de `GET /v1/customer/me` (proxy `customer`). */
|
|
42
|
+
const CustomerMeSchema = zod.z.object({
|
|
43
|
+
id: require_models_ids.EntityIdSchema,
|
|
44
|
+
storeId: require_models_ids.EntityIdSchema,
|
|
45
|
+
email: zod.z.string().nullable(),
|
|
46
|
+
firstName: zod.z.string().nullable(),
|
|
47
|
+
lastName: zod.z.string().nullable(),
|
|
48
|
+
phone: zod.z.string().nullable(),
|
|
49
|
+
identificationNumber: zod.z.string().nullable(),
|
|
50
|
+
identificationType: zod.z.string().nullable(),
|
|
51
|
+
identificationCountryCode: zod.z.string().length(2).nullish(),
|
|
52
|
+
entityName: zod.z.string().nullable(),
|
|
53
|
+
dateOfBirth: zod.z.string().nullable(),
|
|
54
|
+
gender: zod.z.string(),
|
|
55
|
+
countryIsoCode: zod.z.string().nullable(),
|
|
56
|
+
role: zod.z.string().nullable(),
|
|
57
|
+
companyName: zod.z.string().nullable(),
|
|
58
|
+
consent: zod.z.boolean(),
|
|
59
|
+
userId: zod.z.string().uuid().nullable(),
|
|
60
|
+
customerType: zod.z.string(),
|
|
61
|
+
status: zod.z.string(),
|
|
62
|
+
isVerified: zod.z.boolean(),
|
|
63
|
+
entityIdentificationNumber: zod.z.string().nullable(),
|
|
64
|
+
defaultAddressId: require_models_ids.EntityIdSchema.nullable(),
|
|
65
|
+
metadata: zod.z.record(zod.z.string(), zod.z.unknown()).nullable(),
|
|
66
|
+
totalOrders: zod.z.number().int().nonnegative(),
|
|
67
|
+
avgOrders: zod.z.number(),
|
|
68
|
+
lastOrderId: require_models_ids.EntityIdSchema.nullable(),
|
|
69
|
+
lastOrderDate: zod.z.string().nullable(),
|
|
70
|
+
loyaltyPoints: zod.z.number().int(),
|
|
71
|
+
addresses: zod.z.array(require_models_customer_address.CustomerAddressSchema),
|
|
72
|
+
createdOn: zod.z.string(),
|
|
73
|
+
updatedOn: zod.z.string().nullable()
|
|
51
74
|
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}).passthrough();
|
|
71
|
-
function customerMeToProfile(me) {
|
|
72
|
-
return CustomerProfileSchema.parse({
|
|
73
|
-
firstName: me.firstName,
|
|
74
|
-
lastName: me.lastName,
|
|
75
|
-
phone: me.phone,
|
|
76
|
-
email: me.email,
|
|
77
|
-
identificationNumber: me.identificationNumber,
|
|
78
|
-
identificationType: me.identificationType,
|
|
79
|
-
countryIsoCode: me.countryIsoCode,
|
|
80
|
-
consent: me.consent,
|
|
81
|
-
entityName: me.entityName,
|
|
82
|
-
entityIdentificationNumber: me.entityIdentificationNumber,
|
|
83
|
-
gender: me.gender,
|
|
84
|
-
role: me.role,
|
|
85
|
-
companyName: me.companyName,
|
|
86
|
-
dateOfBirth: me.dateOfBirth
|
|
87
|
-
});
|
|
75
|
+
function customerMeToProfile(me, countryCode) {
|
|
76
|
+
return CustomerProfileSchema.parse({
|
|
77
|
+
firstName: me.firstName ?? "",
|
|
78
|
+
lastName: me.lastName ?? "",
|
|
79
|
+
phone: me.phone ?? "",
|
|
80
|
+
email: me.email ?? "",
|
|
81
|
+
identificationNumber: me.identificationNumber,
|
|
82
|
+
identificationType: me.identificationType,
|
|
83
|
+
identificationCountryCode: me.identificationCountryCode,
|
|
84
|
+
countryIsoCode: me.countryIsoCode ?? countryCode,
|
|
85
|
+
consent: me.consent,
|
|
86
|
+
entityName: me.entityName,
|
|
87
|
+
entityIdentificationNumber: me.entityIdentificationNumber,
|
|
88
|
+
gender: me.gender,
|
|
89
|
+
role: me.role,
|
|
90
|
+
companyName: me.companyName,
|
|
91
|
+
dateOfBirth: me.dateOfBirth
|
|
92
|
+
});
|
|
88
93
|
}
|
|
89
|
-
function customerMeToProfilePatch(me) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
94
|
+
function customerMeToProfilePatch(me, countryCode) {
|
|
95
|
+
return CustomerProfilePatchSchema.parse({
|
|
96
|
+
firstName: me.firstName ?? "",
|
|
97
|
+
lastName: me.lastName ?? "",
|
|
98
|
+
phone: me.phone ?? "",
|
|
99
|
+
identificationNumber: me.identificationNumber,
|
|
100
|
+
identificationType: me.identificationType,
|
|
101
|
+
identificationCountryCode: me.identificationCountryCode,
|
|
102
|
+
entityName: me.entityName,
|
|
103
|
+
entityIdentificationNumber: me.entityIdentificationNumber,
|
|
104
|
+
gender: me.gender,
|
|
105
|
+
role: me.role,
|
|
106
|
+
companyName: me.companyName,
|
|
107
|
+
dateOfBirth: me.dateOfBirth,
|
|
108
|
+
consent: me.consent,
|
|
109
|
+
countryIsoCode: me.countryIsoCode ?? countryCode
|
|
110
|
+
});
|
|
105
111
|
}
|
|
106
112
|
function customerProfileToPatch(profile) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
113
|
+
return CustomerProfilePatchSchema.parse({
|
|
114
|
+
firstName: profile.firstName,
|
|
115
|
+
lastName: profile.lastName,
|
|
116
|
+
phone: profile.phone,
|
|
117
|
+
identificationNumber: profile.identificationNumber,
|
|
118
|
+
identificationType: profile.identificationType,
|
|
119
|
+
identificationCountryCode: profile.identificationCountryCode,
|
|
120
|
+
entityName: profile.entityName,
|
|
121
|
+
entityIdentificationNumber: profile.entityIdentificationNumber,
|
|
122
|
+
gender: profile.gender,
|
|
123
|
+
role: profile.role,
|
|
124
|
+
companyName: profile.companyName,
|
|
125
|
+
dateOfBirth: profile.dateOfBirth,
|
|
126
|
+
consent: profile.consent,
|
|
127
|
+
countryIsoCode: profile.countryIsoCode
|
|
128
|
+
});
|
|
122
129
|
}
|
|
123
|
-
|
|
124
130
|
exports.CustomerMeSchema = CustomerMeSchema;
|
|
125
131
|
exports.CustomerProfilePatchSchema = CustomerProfilePatchSchema;
|
|
126
132
|
exports.CustomerProfileSchema = CustomerProfileSchema;
|
|
127
|
-
exports.CustomerRegisterRequestSchema = CustomerRegisterRequestSchema;
|
|
128
133
|
exports.customerMeToProfile = customerMeToProfile;
|
|
129
134
|
exports.customerMeToProfilePatch = customerMeToProfilePatch;
|
|
130
135
|
exports.customerProfileToPatch = customerProfileToPatch;
|
|
131
|
-
//# sourceMappingURL=customer-profile.cjs.map
|
|
132
|
-
//# sourceMappingURL=customer-profile.cjs.map
|