@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
@@ -0,0 +1,149 @@
1
+ import { z } from 'zod';
2
+
3
+ // src/models/customer-order.ts
4
+ var CustomerOrderShippingAddressSchema = z.object({
5
+ name: z.string().nullable().optional(),
6
+ company: z.string().nullable().optional(),
7
+ address1: z.string(),
8
+ address2: z.string().nullable().optional(),
9
+ city: z.string().nullable().optional(),
10
+ countryCode: z.string().min(2).max(2),
11
+ province: z.string().nullable().optional(),
12
+ postalCode: z.string().nullable().optional(),
13
+ district: z.string().nullable().optional(),
14
+ phone: z.string().nullable().optional(),
15
+ latitude: z.number().nullable().optional(),
16
+ longitude: z.number().nullable().optional(),
17
+ metadata: z.record(z.unknown()).nullable().optional()
18
+ }).passthrough();
19
+ var CustomerOrderLineItemSchema = z.object({
20
+ id: z.string(),
21
+ orderId: z.coerce.string(),
22
+ productId: z.coerce.string().nullable(),
23
+ variantId: z.coerce.string().nullable(),
24
+ title: z.string(),
25
+ subtitle: z.string().nullable().optional(),
26
+ thumbnail: z.string().nullable().optional(),
27
+ variantTitle: z.string().nullable().optional(),
28
+ productHandle: z.string().nullable().optional(),
29
+ quantity: z.number(),
30
+ unitPrice: z.number(),
31
+ total: z.number(),
32
+ status: z.string()
33
+ });
34
+ var CustomerOrderListItemSchema = z.object({
35
+ orderId: z.coerce.string(),
36
+ orderNumber: z.string(),
37
+ orderGroup: z.string(),
38
+ orderIds: z.array(z.coerce.string()),
39
+ status: z.string(),
40
+ total: z.number(),
41
+ totalPaid: z.number(),
42
+ currencyCode: z.string(),
43
+ orderDate: z.string(),
44
+ createdOn: z.string(),
45
+ updatedOn: z.string().nullable().optional(),
46
+ paymentAt: z.string().nullable().optional(),
47
+ shippingAddress: CustomerOrderShippingAddressSchema.nullable().optional(),
48
+ shippingAddressSummary: z.string().nullable().optional(),
49
+ items: z.array(CustomerOrderLineItemSchema)
50
+ });
51
+ var CustomerOrderListSchema = z.array(CustomerOrderListItemSchema);
52
+ var CustomerOrderPaymentSchema = z.object({
53
+ id: z.string(),
54
+ paymentMethod: z.string(),
55
+ paymentCode: z.string(),
56
+ amount: z.number(),
57
+ paymentStatus: z.string(),
58
+ receiptUrl: z.string().nullable().optional(),
59
+ createdOn: z.string()
60
+ });
61
+ var CustomerOrderStatusTimelineSchema = z.object({
62
+ key: z.string(),
63
+ label: z.string(),
64
+ occurredAt: z.string(),
65
+ description: z.string().nullable().optional(),
66
+ status: z.string(),
67
+ source: z.string()
68
+ });
69
+ var CustomerOrderDetailSchema = z.object({
70
+ id: z.coerce.string(),
71
+ orderNumber: z.string(),
72
+ orderGroup: z.string(),
73
+ status: z.string(),
74
+ total: z.number(),
75
+ totalPaid: z.number(),
76
+ currencyCode: z.string(),
77
+ orderDate: z.string(),
78
+ createdOn: z.string(),
79
+ updatedOn: z.string().nullable().optional(),
80
+ paymentAt: z.string().nullable().optional(),
81
+ subTotal: z.number(),
82
+ discount: z.number(),
83
+ shipping: z.number(),
84
+ tax: z.number(),
85
+ email: z.string(),
86
+ phone: z.string(),
87
+ firstName: z.string(),
88
+ lastName: z.string(),
89
+ shippingAddress: CustomerOrderShippingAddressSchema.nullable().optional(),
90
+ shippingAddressSummary: z.string().nullable().optional(),
91
+ billingAddress: CustomerOrderShippingAddressSchema.nullable().optional(),
92
+ items: z.array(CustomerOrderLineItemSchema),
93
+ payments: z.array(CustomerOrderPaymentSchema),
94
+ statusTimeline: z.array(CustomerOrderStatusTimelineSchema)
95
+ });
96
+ var ORDER_STATUS_LABELS = {
97
+ New: "Pedido realizado",
98
+ Confirmed: "Confirmado",
99
+ Processing: "En preparaci\xF3n",
100
+ InTransit: "En camino",
101
+ Delivered: "Entregado",
102
+ Cancelled: "Cancelado",
103
+ Canceled: "Cancelado",
104
+ Refunded: "Reembolsado",
105
+ Pending: "Pendiente",
106
+ PendingToConfirm: "Pendiente de confirmaci\xF3n",
107
+ Paid: "Pagado",
108
+ Captured: "Pago confirmado"
109
+ };
110
+ function formatCustomerOrderStatus(status) {
111
+ const trimmed = status.trim();
112
+ if (!trimmed) return "Desconocido";
113
+ return ORDER_STATUS_LABELS[trimmed] ?? trimmed.replace(/([A-Z])/g, " $1").trim();
114
+ }
115
+ function customerOrderStatusTone(status) {
116
+ const s = status.toLowerCase();
117
+ if (s.includes("cancel") || s.includes("refund")) return "danger";
118
+ if (s.includes("deliver")) return "success";
119
+ if (s.includes("transit") || s.includes("ship")) return "info";
120
+ if (s.includes("confirm") || s.includes("paid") || s.includes("capture"))
121
+ return "success";
122
+ if (s.includes("pending") || s.includes("new") || s.includes("process"))
123
+ return "warning";
124
+ return "default";
125
+ }
126
+ function formatOrderDate(iso, locale = "es-PE") {
127
+ const d = new Date(iso);
128
+ if (Number.isNaN(d.getTime())) return iso;
129
+ return new Intl.DateTimeFormat(locale, {
130
+ day: "numeric",
131
+ month: "long",
132
+ year: "numeric"
133
+ }).format(d);
134
+ }
135
+ function formatOrderDateTime(iso, locale = "es-PE") {
136
+ const d = new Date(iso);
137
+ if (Number.isNaN(d.getTime())) return iso;
138
+ return new Intl.DateTimeFormat(locale, {
139
+ day: "numeric",
140
+ month: "short",
141
+ year: "numeric",
142
+ hour: "2-digit",
143
+ minute: "2-digit"
144
+ }).format(d);
145
+ }
146
+
147
+ export { CustomerOrderDetailSchema, CustomerOrderLineItemSchema, CustomerOrderListItemSchema, CustomerOrderListSchema, CustomerOrderPaymentSchema, CustomerOrderShippingAddressSchema, CustomerOrderStatusTimelineSchema, customerOrderStatusTone, formatCustomerOrderStatus, formatOrderDate, formatOrderDateTime };
148
+ //# sourceMappingURL=customer-order.js.map
149
+ //# sourceMappingURL=customer-order.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/models/customer-order.ts"],"names":[],"mappings":";;;AAEO,IAAM,kCAAA,GAAqC,EAC/C,MAAA,CAAO;AAAA,EACN,MAAM,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,GAAW,QAAA,EAAS;AAAA,EACrC,SAAS,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,GAAW,QAAA,EAAS;AAAA,EACxC,QAAA,EAAU,EAAE,MAAA,EAAO;AAAA,EACnB,UAAU,CAAA,CAAE,MA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,IACL,KAAA,EAAO,MAAA;AAAA,IACP,IAAA,EAAM;AAAA,GACP,CAAA,CAAE,MAAA,CAAO,CAAC,CAAA;AACb;AAEO,SAAS,mBAAA,CAAoB,GAAA,EAAa,MAAA,GAAS,OAAA,EAAiB;AACzE,EAAA,MAAM,CAAA,GAAI,IAAI,IAAA,CAAK,GAAG,CAAA;AACtB,EAAA,IAAI,OAAO,KAAA,CAAM,CAAA,CAAE,OAAA,EAAS,GAAG,OAAO,GAAA;AACtC,EAAA,OAAO,IAAI,IAAA,CAAK,cAAA,CAAe,MAAA,EAAQ;AAAA,IACrC,GAAA,EAAK,SAAA;AAAA,IACL,KAAA,EAAO,OAAA;AAAA,IACP,IAAA,EAAM,SAAA;AAAA,IACN,IAAA,EAAM,SAAA;AAAA,IACN,MAAA,EAAQ;AAAA,GACT,CAAA,CAAE,MAAA,CAAO,CAAC,CAAA;AACb","file":"customer-order.js","sourcesContent":["import { z } from 'zod'\n\nexport const CustomerOrderShippingAddressSchema = z\n .object({\n name: z.string().nullable().optional(),\n company: z.string().nullable().optional(),\n address1: z.string(),\n address2: z.string().nullable().optional(),\n city: z.string().nullable().optional(),\n countryCode: z.string().min(2).max(2),\n province: z.string().nullable().optional(),\n postalCode: z.string().nullable().optional(),\n district: z.string().nullable().optional(),\n phone: z.string().nullable().optional(),\n latitude: z.number().nullable().optional(),\n longitude: z.number().nullable().optional(),\n metadata: z.record(z.unknown()).nullable().optional(),\n })\n .passthrough()\n\nexport type CustomerOrderShippingAddress = z.infer<\n typeof CustomerOrderShippingAddressSchema\n>\n\nexport const CustomerOrderLineItemSchema = z.object({\n id: z.string(),\n orderId: z.coerce.string(),\n productId: z.coerce.string().nullable(),\n variantId: z.coerce.string().nullable(),\n title: z.string(),\n subtitle: z.string().nullable().optional(),\n thumbnail: z.string().nullable().optional(),\n variantTitle: z.string().nullable().optional(),\n productHandle: z.string().nullable().optional(),\n quantity: z.number(),\n unitPrice: z.number(),\n total: z.number(),\n status: z.string(),\n})\n\nexport type CustomerOrderLineItem = z.infer<typeof CustomerOrderLineItemSchema>\n\n/** GET /v1/customer/orders (listado agrupado vía proxy `customer/orders`). */\nexport const CustomerOrderListItemSchema = z.object({\n orderId: z.coerce.string(),\n orderNumber: z.string(),\n orderGroup: z.string(),\n orderIds: z.array(z.coerce.string()),\n status: z.string(),\n total: z.number(),\n totalPaid: z.number(),\n currencyCode: z.string(),\n orderDate: z.string(),\n createdOn: z.string(),\n updatedOn: z.string().nullable().optional(),\n paymentAt: z.string().nullable().optional(),\n shippingAddress: CustomerOrderShippingAddressSchema.nullable().optional(),\n shippingAddressSummary: z.string().nullable().optional(),\n items: z.array(CustomerOrderLineItemSchema),\n})\n\nexport type CustomerOrderListItem = z.infer<typeof CustomerOrderListItemSchema>\n/** @deprecated Alias del tipo canónico. */\nexport type CustomerOrderListItemDto = CustomerOrderListItem\n\nexport const CustomerOrderListSchema = z.array(CustomerOrderListItemSchema)\n\nexport type CustomerOrderList = z.infer<typeof CustomerOrderListSchema>\n\nexport const CustomerOrderPaymentSchema = z.object({\n id: z.string(),\n paymentMethod: z.string(),\n paymentCode: z.string(),\n amount: z.number(),\n paymentStatus: z.string(),\n receiptUrl: z.string().nullable().optional(),\n createdOn: z.string(),\n})\n\nexport type CustomerOrderPayment = z.infer<typeof CustomerOrderPaymentSchema>\n\nexport const CustomerOrderStatusTimelineSchema = z.object({\n key: z.string(),\n label: z.string(),\n occurredAt: z.string(),\n description: z.string().nullable().optional(),\n status: z.string(),\n source: z.string(),\n})\n\nexport type CustomerOrderStatusTimelineEntry = z.infer<\n typeof CustomerOrderStatusTimelineSchema\n>\n\n/** GET /v1/customer/orders/{orderId} (detalle vía proxy). */\nexport const CustomerOrderDetailSchema = z.object({\n id: z.coerce.string(),\n orderNumber: z.string(),\n orderGroup: z.string(),\n status: z.string(),\n total: z.number(),\n totalPaid: z.number(),\n currencyCode: z.string(),\n orderDate: z.string(),\n createdOn: z.string(),\n updatedOn: z.string().nullable().optional(),\n paymentAt: z.string().nullable().optional(),\n subTotal: z.number(),\n discount: z.number(),\n shipping: z.number(),\n tax: z.number(),\n email: z.string(),\n phone: z.string(),\n firstName: z.string(),\n lastName: z.string(),\n shippingAddress: CustomerOrderShippingAddressSchema.nullable().optional(),\n shippingAddressSummary: z.string().nullable().optional(),\n billingAddress: CustomerOrderShippingAddressSchema.nullable().optional(),\n items: z.array(CustomerOrderLineItemSchema),\n payments: z.array(CustomerOrderPaymentSchema),\n statusTimeline: z.array(CustomerOrderStatusTimelineSchema),\n})\n\nexport type CustomerOrderDetail = z.infer<typeof CustomerOrderDetailSchema>\n/** @deprecated Alias del tipo canónico. */\nexport type CustomerOrderDetailDto = CustomerOrderDetail\n\n/** Etiquetas en español para estados de pedido (upstream suele enviar PascalCase). */\nconst ORDER_STATUS_LABELS: Record<string, string> = {\n New: 'Pedido realizado',\n Confirmed: 'Confirmado',\n Processing: 'En preparación',\n InTransit: 'En camino',\n Delivered: 'Entregado',\n Cancelled: 'Cancelado',\n Canceled: 'Cancelado',\n Refunded: 'Reembolsado',\n Pending: 'Pendiente',\n PendingToConfirm: 'Pendiente de confirmación',\n Paid: 'Pagado',\n Captured: 'Pago confirmado',\n}\n\nexport function formatCustomerOrderStatus(status: string): string {\n const trimmed = status.trim()\n if (!trimmed) return 'Desconocido'\n return (\n ORDER_STATUS_LABELS[trimmed] ??\n trimmed.replace(/([A-Z])/g, ' $1').trim()\n )\n}\n\nexport function customerOrderStatusTone(\n status: string,\n): 'default' | 'success' | 'warning' | 'danger' | 'info' {\n const s = status.toLowerCase()\n if (s.includes('cancel') || s.includes('refund')) return 'danger'\n if (s.includes('deliver')) return 'success'\n if (s.includes('transit') || s.includes('ship')) return 'info'\n if (s.includes('confirm') || s.includes('paid') || s.includes('capture'))\n return 'success'\n if (s.includes('pending') || s.includes('new') || s.includes('process'))\n return 'warning'\n return 'default'\n}\n\nexport function formatOrderDate(iso: string, locale = 'es-PE'): string {\n const d = new Date(iso)\n if (Number.isNaN(d.getTime())) return iso\n return new Intl.DateTimeFormat(locale, {\n day: 'numeric',\n month: 'long',\n year: 'numeric',\n }).format(d)\n}\n\nexport function formatOrderDateTime(iso: string, locale = 'es-PE'): string {\n const d = new Date(iso)\n if (Number.isNaN(d.getTime())) return iso\n return new Intl.DateTimeFormat(locale, {\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n }).format(d)\n}\n"]}
@@ -0,0 +1,126 @@
1
+ 'use strict';
2
+
3
+ var zod = require('zod');
4
+
5
+ // src/models/customer-profile.ts
6
+ var DEFAULT_COUNTRY_CODE = "PE";
7
+ var CustomerRegisterRequestSchema = zod.z.object({
8
+ email: zod.z.string().email(),
9
+ firstName: zod.z.string().trim().min(1),
10
+ lastName: zod.z.string().trim().min(1),
11
+ countryIsoCode: zod.z.string().trim().length(2),
12
+ password: zod.z.string().min(1),
13
+ phone: zod.z.string().trim().min(1).optional()
14
+ });
15
+ var CustomerProfilePatchSchema = zod.z.object({
16
+ firstName: zod.z.string().trim().min(1),
17
+ lastName: zod.z.string().trim().min(1),
18
+ phone: zod.z.string().trim(),
19
+ identificationNumber: zod.z.string().nullable(),
20
+ identificationType: zod.z.string().nullable(),
21
+ entityName: zod.z.string().nullable(),
22
+ entityIdentificationNumber: zod.z.string().nullable(),
23
+ gender: zod.z.string().nullable(),
24
+ role: zod.z.string().nullable(),
25
+ companyName: zod.z.string().nullable(),
26
+ dateOfBirth: zod.z.string().nullable(),
27
+ consent: zod.z.boolean(),
28
+ countryIsoCode: zod.z.string().trim().length(2)
29
+ });
30
+ var CustomerProfileSchema = zod.z.object({
31
+ firstName: zod.z.string(),
32
+ lastName: zod.z.string(),
33
+ phone: zod.z.string(),
34
+ email: zod.z.string().email(),
35
+ identificationNumber: zod.z.string().nullable(),
36
+ identificationType: zod.z.string().nullable(),
37
+ countryIsoCode: zod.z.string(),
38
+ consent: zod.z.boolean(),
39
+ entityName: zod.z.string().nullable(),
40
+ entityIdentificationNumber: zod.z.string().nullable(),
41
+ gender: zod.z.string().nullable(),
42
+ role: zod.z.string().nullable(),
43
+ companyName: zod.z.string().nullable(),
44
+ dateOfBirth: zod.z.string().nullable()
45
+ });
46
+ var nullableString = zod.z.string().nullable().optional().transform((v) => v ?? null);
47
+ var CustomerMeSchema = zod.z.object({
48
+ id: zod.z.union([zod.z.string(), zod.z.number()]),
49
+ storeId: zod.z.string().optional(),
50
+ email: zod.z.string().email(),
51
+ firstName: zod.z.string(),
52
+ lastName: zod.z.string(),
53
+ phone: zod.z.union([zod.z.string(), zod.z.null()]).optional().transform((v) => v ?? ""),
54
+ identificationNumber: nullableString,
55
+ identificationType: nullableString,
56
+ entityName: nullableString,
57
+ entityIdentificationNumber: nullableString,
58
+ gender: nullableString,
59
+ role: nullableString,
60
+ companyName: nullableString,
61
+ dateOfBirth: nullableString,
62
+ countryIsoCode: zod.z.string().optional().transform((v) => v?.trim().length === 2 ? v.trim() : DEFAULT_COUNTRY_CODE),
63
+ consent: zod.z.boolean().optional().transform((v) => v ?? false)
64
+ }).passthrough();
65
+ function customerMeToProfile(me) {
66
+ return CustomerProfileSchema.parse({
67
+ firstName: me.firstName,
68
+ lastName: me.lastName,
69
+ phone: me.phone,
70
+ email: me.email,
71
+ identificationNumber: me.identificationNumber,
72
+ identificationType: me.identificationType,
73
+ countryIsoCode: me.countryIsoCode,
74
+ consent: me.consent,
75
+ entityName: me.entityName,
76
+ entityIdentificationNumber: me.entityIdentificationNumber,
77
+ gender: me.gender,
78
+ role: me.role,
79
+ companyName: me.companyName,
80
+ dateOfBirth: me.dateOfBirth
81
+ });
82
+ }
83
+ function customerMeToProfilePatch(me) {
84
+ return CustomerProfilePatchSchema.parse({
85
+ firstName: me.firstName,
86
+ lastName: me.lastName,
87
+ phone: me.phone,
88
+ identificationNumber: me.identificationNumber,
89
+ identificationType: me.identificationType,
90
+ entityName: me.entityName,
91
+ entityIdentificationNumber: me.entityIdentificationNumber,
92
+ gender: me.gender,
93
+ role: me.role,
94
+ companyName: me.companyName,
95
+ dateOfBirth: me.dateOfBirth,
96
+ consent: me.consent,
97
+ countryIsoCode: me.countryIsoCode || DEFAULT_COUNTRY_CODE
98
+ });
99
+ }
100
+ function customerProfileToPatch(profile) {
101
+ return CustomerProfilePatchSchema.parse({
102
+ firstName: profile.firstName,
103
+ lastName: profile.lastName,
104
+ phone: profile.phone,
105
+ identificationNumber: profile.identificationNumber,
106
+ identificationType: profile.identificationType,
107
+ entityName: profile.entityName,
108
+ entityIdentificationNumber: profile.entityIdentificationNumber,
109
+ gender: profile.gender,
110
+ role: profile.role,
111
+ companyName: profile.companyName,
112
+ dateOfBirth: profile.dateOfBirth,
113
+ consent: profile.consent,
114
+ countryIsoCode: profile.countryIsoCode || DEFAULT_COUNTRY_CODE
115
+ });
116
+ }
117
+
118
+ exports.CustomerMeSchema = CustomerMeSchema;
119
+ exports.CustomerProfilePatchSchema = CustomerProfilePatchSchema;
120
+ exports.CustomerProfileSchema = CustomerProfileSchema;
121
+ exports.CustomerRegisterRequestSchema = CustomerRegisterRequestSchema;
122
+ exports.customerMeToProfile = customerMeToProfile;
123
+ exports.customerMeToProfilePatch = customerMeToProfilePatch;
124
+ exports.customerProfileToPatch = customerProfileToPatch;
125
+ //# sourceMappingURL=customer-profile.cjs.map
126
+ //# sourceMappingURL=customer-profile.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/models/customer-profile.ts"],"names":["z"],"mappings":";;;;;AAEA,IAAM,oBAAA,GAAuB,IAAA;AAGtB,IAAM,6BAAA,GAAgCA,MAAE,MAAA,CAAO;AAAA,EACpD,KAAA,EAAOA,KAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM;AAAA,EACxB,WAAWA,KAAA,CAAE,MAAA,GAAS,IAAA,EAAK,CAAE,IAAI,CAAC,CAAA;AAAA,EAClC,UAAUA,KAAA,CAAE,MAAA,GAAS,IAAA,EAAK,CAAE,IAAI,CAAC,CAAA;AAAA,EACjC,gBAAgBA,KAAA,CAAE,MAAA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IAAA;AAAA,IACd,aAAa,OAAA,CAAQ,WAAA;AAAA,IACrB,aAAa,OAAA,CAAQ,WAAA;AAAA,IACrB,SAAS,OAAA,CAAQ,OAAA;AAAA,IACjB,cAAA,EAAgB,QAAQ,cAAA,IAAkB;AAAA,GAC3C,CAAA;AACH","file":"customer-profile.cjs","sourcesContent":["import { z } from 'zod'\n\nconst DEFAULT_COUNTRY_CODE = 'PE'\n\n/** Cuerpo de `POST /v1/customer/register` (proxy `customer/register`). */\nexport const CustomerRegisterRequestSchema = z.object({\n email: z.string().email(),\n firstName: z.string().trim().min(1),\n lastName: z.string().trim().min(1),\n countryIsoCode: z.string().trim().length(2),\n password: z.string().min(1),\n phone: z.string().trim().min(1).optional(),\n})\n\nexport type CustomerRegisterRequest = z.infer<typeof CustomerRegisterRequestSchema>\n\n/** Cuerpo de `PATCH /v1/customer` (proxy `customer`). */\nexport const CustomerProfilePatchSchema = z.object({\n firstName: z.string().trim().min(1),\n lastName: z.string().trim().min(1),\n phone: z.string().trim(),\n identificationNumber: z.string().nullable(),\n identificationType: z.string().nullable(),\n entityName: z.string().nullable(),\n entityIdentificationNumber: z.string().nullable(),\n gender: z.string().nullable(),\n role: z.string().nullable(),\n companyName: z.string().nullable(),\n dateOfBirth: z.string().nullable(),\n consent: z.boolean(),\n countryIsoCode: z.string().trim().length(2),\n})\n\nexport type CustomerProfilePatch = z.infer<typeof CustomerProfilePatchSchema>\n\n/** Perfil mostrado en cuenta (subset de GET customer). */\nexport const CustomerProfileSchema = z.object({\n firstName: z.string(),\n lastName: z.string(),\n phone: z.string(),\n email: z.string().email(),\n identificationNumber: z.string().nullable(),\n identificationType: z.string().nullable(),\n countryIsoCode: z.string(),\n consent: z.boolean(),\n entityName: z.string().nullable(),\n entityIdentificationNumber: z.string().nullable(),\n gender: z.string().nullable(),\n role: z.string().nullable(),\n companyName: z.string().nullable(),\n dateOfBirth: z.string().nullable(),\n})\n\nexport type CustomerProfile = z.infer<typeof CustomerProfileSchema>\n\nconst nullableString = z.string().nullable().optional().transform((v) => v ?? null)\n\n/** Respuesta de `GET /v1/customer/me` (proxy `customer`). */\nexport const CustomerMeSchema = z\n .object({\n id: z.union([z.string(), z.number()]),\n storeId: z.string().optional(),\n email: z.string().email(),\n firstName: z.string(),\n lastName: z.string(),\n phone: z\n .union([z.string(), z.null()])\n .optional()\n .transform((v) => v ?? ''),\n identificationNumber: nullableString,\n identificationType: nullableString,\n entityName: nullableString,\n entityIdentificationNumber: nullableString,\n gender: nullableString,\n role: nullableString,\n companyName: nullableString,\n dateOfBirth: nullableString,\n countryIsoCode: z\n .string()\n .optional()\n .transform((v) => (v?.trim().length === 2 ? v.trim() : DEFAULT_COUNTRY_CODE)),\n consent: z.boolean().optional().transform((v) => v ?? false),\n })\n .passthrough()\n\nexport type CustomerMe = z.infer<typeof CustomerMeSchema>\n\nexport function customerMeToProfile(me: CustomerMe): CustomerProfile {\n return CustomerProfileSchema.parse({\n firstName: me.firstName,\n lastName: me.lastName,\n phone: me.phone,\n email: me.email,\n identificationNumber: me.identificationNumber,\n identificationType: me.identificationType,\n countryIsoCode: me.countryIsoCode,\n consent: me.consent,\n entityName: me.entityName,\n entityIdentificationNumber: me.entityIdentificationNumber,\n gender: me.gender,\n role: me.role,\n companyName: me.companyName,\n dateOfBirth: me.dateOfBirth,\n })\n}\n\nexport function customerMeToProfilePatch(me: CustomerMe): CustomerProfilePatch {\n return CustomerProfilePatchSchema.parse({\n firstName: me.firstName,\n lastName: me.lastName,\n phone: me.phone,\n identificationNumber: me.identificationNumber,\n identificationType: me.identificationType,\n entityName: me.entityName,\n entityIdentificationNumber: me.entityIdentificationNumber,\n gender: me.gender,\n role: me.role,\n companyName: me.companyName,\n dateOfBirth: me.dateOfBirth,\n consent: me.consent,\n countryIsoCode: me.countryIsoCode || DEFAULT_COUNTRY_CODE,\n })\n}\n\nexport function customerProfileToPatch(profile: CustomerProfile): CustomerProfilePatch {\n return CustomerProfilePatchSchema.parse({\n firstName: profile.firstName,\n lastName: profile.lastName,\n phone: profile.phone,\n identificationNumber: profile.identificationNumber,\n identificationType: profile.identificationType,\n entityName: profile.entityName,\n entityIdentificationNumber: profile.entityIdentificationNumber,\n gender: profile.gender,\n role: profile.role,\n companyName: profile.companyName,\n dateOfBirth: profile.dateOfBirth,\n consent: profile.consent,\n countryIsoCode: profile.countryIsoCode || DEFAULT_COUNTRY_CODE,\n })\n}\n"]}
@@ -0,0 +1,178 @@
1
+ import { z } from 'zod';
2
+
3
+ /** Cuerpo de `POST /v1/customer/register` (proxy `customer/register`). */
4
+ declare const CustomerRegisterRequestSchema: z.ZodObject<{
5
+ email: z.ZodString;
6
+ firstName: z.ZodString;
7
+ lastName: z.ZodString;
8
+ countryIsoCode: z.ZodString;
9
+ password: z.ZodString;
10
+ phone: z.ZodOptional<z.ZodString>;
11
+ }, "strip", z.ZodTypeAny, {
12
+ email: string;
13
+ firstName: string;
14
+ lastName: string;
15
+ countryIsoCode: string;
16
+ password: string;
17
+ phone?: string | undefined;
18
+ }, {
19
+ email: string;
20
+ firstName: string;
21
+ lastName: string;
22
+ countryIsoCode: string;
23
+ password: string;
24
+ phone?: string | undefined;
25
+ }>;
26
+ type CustomerRegisterRequest = z.infer<typeof CustomerRegisterRequestSchema>;
27
+ /** Cuerpo de `PATCH /v1/customer` (proxy `customer`). */
28
+ declare const CustomerProfilePatchSchema: z.ZodObject<{
29
+ firstName: z.ZodString;
30
+ lastName: z.ZodString;
31
+ phone: z.ZodString;
32
+ identificationNumber: z.ZodNullable<z.ZodString>;
33
+ identificationType: z.ZodNullable<z.ZodString>;
34
+ entityName: z.ZodNullable<z.ZodString>;
35
+ entityIdentificationNumber: z.ZodNullable<z.ZodString>;
36
+ gender: z.ZodNullable<z.ZodString>;
37
+ role: z.ZodNullable<z.ZodString>;
38
+ companyName: z.ZodNullable<z.ZodString>;
39
+ dateOfBirth: z.ZodNullable<z.ZodString>;
40
+ consent: z.ZodBoolean;
41
+ countryIsoCode: z.ZodString;
42
+ }, "strip", z.ZodTypeAny, {
43
+ gender: string | null;
44
+ phone: string;
45
+ firstName: string;
46
+ lastName: string;
47
+ countryIsoCode: string;
48
+ identificationNumber: string | null;
49
+ identificationType: string | null;
50
+ entityName: string | null;
51
+ entityIdentificationNumber: string | null;
52
+ role: string | null;
53
+ companyName: string | null;
54
+ dateOfBirth: string | null;
55
+ consent: boolean;
56
+ }, {
57
+ gender: string | null;
58
+ phone: string;
59
+ firstName: string;
60
+ lastName: string;
61
+ countryIsoCode: string;
62
+ identificationNumber: string | null;
63
+ identificationType: string | null;
64
+ entityName: string | null;
65
+ entityIdentificationNumber: string | null;
66
+ role: string | null;
67
+ companyName: string | null;
68
+ dateOfBirth: string | null;
69
+ consent: boolean;
70
+ }>;
71
+ type CustomerProfilePatch = z.infer<typeof CustomerProfilePatchSchema>;
72
+ /** Perfil mostrado en cuenta (subset de GET customer). */
73
+ declare const CustomerProfileSchema: z.ZodObject<{
74
+ firstName: z.ZodString;
75
+ lastName: z.ZodString;
76
+ phone: z.ZodString;
77
+ email: z.ZodString;
78
+ identificationNumber: z.ZodNullable<z.ZodString>;
79
+ identificationType: z.ZodNullable<z.ZodString>;
80
+ countryIsoCode: z.ZodString;
81
+ consent: z.ZodBoolean;
82
+ entityName: z.ZodNullable<z.ZodString>;
83
+ entityIdentificationNumber: z.ZodNullable<z.ZodString>;
84
+ gender: z.ZodNullable<z.ZodString>;
85
+ role: z.ZodNullable<z.ZodString>;
86
+ companyName: z.ZodNullable<z.ZodString>;
87
+ dateOfBirth: z.ZodNullable<z.ZodString>;
88
+ }, "strip", z.ZodTypeAny, {
89
+ gender: string | null;
90
+ phone: string;
91
+ email: string;
92
+ firstName: string;
93
+ lastName: string;
94
+ countryIsoCode: string;
95
+ identificationNumber: string | null;
96
+ identificationType: string | null;
97
+ entityName: string | null;
98
+ entityIdentificationNumber: string | null;
99
+ role: string | null;
100
+ companyName: string | null;
101
+ dateOfBirth: string | null;
102
+ consent: boolean;
103
+ }, {
104
+ gender: string | null;
105
+ phone: string;
106
+ email: string;
107
+ firstName: string;
108
+ lastName: string;
109
+ countryIsoCode: string;
110
+ identificationNumber: string | null;
111
+ identificationType: string | null;
112
+ entityName: string | null;
113
+ entityIdentificationNumber: string | null;
114
+ role: string | null;
115
+ companyName: string | null;
116
+ dateOfBirth: string | null;
117
+ consent: boolean;
118
+ }>;
119
+ type CustomerProfile = z.infer<typeof CustomerProfileSchema>;
120
+ /** Respuesta de `GET /v1/customer/me` (proxy `customer`). */
121
+ declare const CustomerMeSchema: z.ZodObject<{
122
+ id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
123
+ storeId: z.ZodOptional<z.ZodString>;
124
+ email: z.ZodString;
125
+ firstName: z.ZodString;
126
+ lastName: z.ZodString;
127
+ phone: z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>, string, string | null | undefined>;
128
+ identificationNumber: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
129
+ identificationType: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
130
+ entityName: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
131
+ entityIdentificationNumber: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
132
+ gender: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
133
+ role: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
134
+ companyName: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
135
+ dateOfBirth: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
136
+ countryIsoCode: z.ZodEffects<z.ZodOptional<z.ZodString>, string, string | undefined>;
137
+ consent: z.ZodEffects<z.ZodOptional<z.ZodBoolean>, boolean, boolean | undefined>;
138
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
139
+ id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
140
+ storeId: z.ZodOptional<z.ZodString>;
141
+ email: z.ZodString;
142
+ firstName: z.ZodString;
143
+ lastName: z.ZodString;
144
+ phone: z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>, string, string | null | undefined>;
145
+ identificationNumber: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
146
+ identificationType: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
147
+ entityName: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
148
+ entityIdentificationNumber: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
149
+ gender: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
150
+ role: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
151
+ companyName: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
152
+ dateOfBirth: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
153
+ countryIsoCode: z.ZodEffects<z.ZodOptional<z.ZodString>, string, string | undefined>;
154
+ consent: z.ZodEffects<z.ZodOptional<z.ZodBoolean>, boolean, boolean | undefined>;
155
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
156
+ id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
157
+ storeId: z.ZodOptional<z.ZodString>;
158
+ email: z.ZodString;
159
+ firstName: z.ZodString;
160
+ lastName: z.ZodString;
161
+ phone: z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>, string, string | null | undefined>;
162
+ identificationNumber: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
163
+ identificationType: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
164
+ entityName: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
165
+ entityIdentificationNumber: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
166
+ gender: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
167
+ role: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
168
+ companyName: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
169
+ dateOfBirth: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
170
+ countryIsoCode: z.ZodEffects<z.ZodOptional<z.ZodString>, string, string | undefined>;
171
+ consent: z.ZodEffects<z.ZodOptional<z.ZodBoolean>, boolean, boolean | undefined>;
172
+ }, z.ZodTypeAny, "passthrough">>;
173
+ type CustomerMe = z.infer<typeof CustomerMeSchema>;
174
+ declare function customerMeToProfile(me: CustomerMe): CustomerProfile;
175
+ declare function customerMeToProfilePatch(me: CustomerMe): CustomerProfilePatch;
176
+ declare function customerProfileToPatch(profile: CustomerProfile): CustomerProfilePatch;
177
+
178
+ export { type CustomerMe, CustomerMeSchema, type CustomerProfile, type CustomerProfilePatch, CustomerProfilePatchSchema, CustomerProfileSchema, type CustomerRegisterRequest, CustomerRegisterRequestSchema, customerMeToProfile, customerMeToProfilePatch, customerProfileToPatch };