@ecomiq/storefront 1.0.2 → 1.1.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/README.md +29 -19
- package/dist/{chunk-TDQ53V3E.js → chunk-3C4ZLHSU.js} +7 -321
- package/dist/chunk-3C4ZLHSU.js.map +1 -0
- package/dist/{chunk-Q762YXCQ.js → chunk-3URTJY6X.js} +4 -5
- package/dist/chunk-3URTJY6X.js.map +1 -0
- package/dist/chunk-ASFU32ZM.js +236 -0
- package/dist/chunk-ASFU32ZM.js.map +1 -0
- package/dist/{chunk-PCLA4TZF.js → chunk-EADDSNJS.js} +4 -157
- package/dist/chunk-EADDSNJS.js.map +1 -0
- package/dist/chunk-S7CPZ4UE.js +6 -0
- package/dist/chunk-S7CPZ4UE.js.map +1 -0
- package/dist/chunk-W372BFMG.js +159 -0
- package/dist/chunk-W372BFMG.js.map +1 -0
- package/dist/chunks/client.d.ts +1 -643
- package/dist/chunks/client.js +2 -21
- package/dist/chunks/client.js.map +1 -1
- package/dist/chunks/config.js +2 -1
- package/dist/chunks/core-public.d.ts +130 -0
- package/dist/chunks/core-public.js +98 -0
- package/dist/chunks/core-public.js.map +1 -0
- package/dist/chunks/server-nextjs.d.ts +3 -2
- package/dist/chunks/server-nextjs.js +7 -4
- package/dist/chunks/server-nextjs.js.map +1 -1
- package/dist/chunks/server-tanstack.d.ts +3 -2
- package/dist/chunks/server-tanstack.js +7 -4
- package/dist/chunks/server-tanstack.js.map +1 -1
- package/dist/collection-BHD4hhQa.d.ts +3609 -0
- package/dist/{format-currency-oJD9jGYW.d.ts → ecomiq-oauth-password-plugin-DJCOOij3.d.ts} +165 -3299
- package/dist/index.d.ts +1 -12
- package/dist/index.js +1 -11
- package/dist/index.server.d.ts +1 -0
- package/dist/index.server.js +1 -0
- package/dist/nextjs/api.js +2 -1
- package/dist/nextjs/api.js.map +1 -1
- package/dist/nextjs.d.ts +1 -13
- package/dist/nextjs.js +2 -11
- package/dist/react.d.ts +1 -0
- package/dist/react.js +2 -0
- package/dist/react.js.map +1 -0
- package/dist/tanstack/api.js +3 -2
- package/dist/tanstack/api.js.map +1 -1
- package/dist/tanstack.d.ts +1 -13
- package/dist/tanstack.js +2 -11
- package/package.json +5 -1
- package/dist/chunk-PCLA4TZF.js.map +0 -1
- package/dist/chunk-Q762YXCQ.js.map +0 -1
- package/dist/chunk-TDQ53V3E.js.map +0 -1
package/dist/chunks/config.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { EcomiqConfigSchema, clearEcomiqConfigCache, hasEcomiqSlugStoreConfig, loadEcomiqConfig, resolvePublicStoreKey } from '../chunk-
|
|
1
|
+
export { EcomiqConfigSchema, clearEcomiqConfigCache, hasEcomiqSlugStoreConfig, loadEcomiqConfig, resolvePublicStoreKey } from '../chunk-W372BFMG.js';
|
|
2
|
+
import '../chunk-EADDSNJS.js';
|
|
2
3
|
//# sourceMappingURL=config.js.map
|
|
3
4
|
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { S as StorefrontSettings, a as StorefrontPageDetail } from '../collection-BHD4hhQa.js';
|
|
2
|
+
export { d as StorefrontCmsPage, c as StorefrontCmsSettings, j as StorefrontCollection, k as StorefrontCollectionDetail, u as StorefrontCollectionDetailSchema, s as StorefrontCollectionSchema, t as StorefrontCollectionsResponseSchema, w as StorefrontPageDetailSchema, l as StorefrontPageListItem, v as StorefrontPageListItemSchema, e as StorefrontProduct, f as StorefrontProductDetail, r as StorefrontProductDetailSchema, o as StorefrontProductSchema, h as StorefrontProductsParamsInput, q as StorefrontProductsParamsSchema, g as StorefrontProductsResponse, p as StorefrontProductsResponseSchema, m as StorefrontSettingsSchema, b as StorefrontStore, n as StorefrontStoreSchema, i as StorefrontVariant } from '../collection-BHD4hhQa.js';
|
|
3
|
+
import 'zod';
|
|
4
|
+
|
|
5
|
+
/** Prefijo base de la API storefront (ej. v1/storefront). */
|
|
6
|
+
declare const STOREFRONT_API_PATH_PREFIX = "v1";
|
|
7
|
+
|
|
8
|
+
declare const countryCurrency: {
|
|
9
|
+
PEN: string;
|
|
10
|
+
USD: string;
|
|
11
|
+
COP: string;
|
|
12
|
+
MXN: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Formats a number as currency using the store's locale for the given currency code.
|
|
17
|
+
* Uses countryCurrency to pick the right locale (e.g. PEN → es-PE, USD → en-US).
|
|
18
|
+
*/
|
|
19
|
+
declare function formatCurrency(amount: number, currency?: string): string;
|
|
20
|
+
|
|
21
|
+
/** Sanitización mínima de HTML (script, event handlers, javascript:…). */
|
|
22
|
+
declare function sanitizeHtml(html: string): string;
|
|
23
|
+
/** Convierte HTML en texto plano (metadata, JSON-LD). */
|
|
24
|
+
declare function stripHtml(html: string): string;
|
|
25
|
+
|
|
26
|
+
declare function formatCustomerOrderStatus(status: string): string;
|
|
27
|
+
declare function customerOrderStatusTone(status: string): "default" | "success" | "warning" | "danger" | "info";
|
|
28
|
+
declare function formatOrderDate(iso: string, locale?: string): string;
|
|
29
|
+
declare function formatOrderDateTime(iso: string, locale?: string): string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Busca una página CMS en `settings.cms.pages` (payload de `getPublicStore` / settings)
|
|
33
|
+
* y la valida como `StorefrontPageDetail` para `DynamicPage`.
|
|
34
|
+
*/
|
|
35
|
+
declare function findStorefrontCmsPageBySlug(settings: StorefrontSettings | null | undefined, slug: string): StorefrontPageDetail | null;
|
|
36
|
+
|
|
37
|
+
/** Dirección de envío en pedidos del cliente (listado y detalle). */
|
|
38
|
+
type CustomerOrderShippingAddress = {
|
|
39
|
+
name?: string | null;
|
|
40
|
+
company?: string | null;
|
|
41
|
+
address1: string;
|
|
42
|
+
address2?: string | null;
|
|
43
|
+
city?: string | null;
|
|
44
|
+
countryCode: string;
|
|
45
|
+
province?: string | null;
|
|
46
|
+
postalCode?: string | null;
|
|
47
|
+
district?: string | null;
|
|
48
|
+
phone?: string | null;
|
|
49
|
+
latitude?: number | null;
|
|
50
|
+
longitude?: number | null;
|
|
51
|
+
metadata?: Record<string, unknown> | null;
|
|
52
|
+
};
|
|
53
|
+
type CustomerOrderListItem = {
|
|
54
|
+
orderId: string;
|
|
55
|
+
orderNumber: string;
|
|
56
|
+
orderGroup: string;
|
|
57
|
+
orderIds: string[];
|
|
58
|
+
status: string;
|
|
59
|
+
total: number;
|
|
60
|
+
totalPaid: number;
|
|
61
|
+
currencyCode: string;
|
|
62
|
+
orderDate: string;
|
|
63
|
+
createdOn: string;
|
|
64
|
+
updatedOn?: string | null;
|
|
65
|
+
paymentAt?: string | null;
|
|
66
|
+
shippingAddress?: CustomerOrderShippingAddress | null;
|
|
67
|
+
shippingAddressSummary?: string | null;
|
|
68
|
+
items: CustomerOrderLineItem[];
|
|
69
|
+
};
|
|
70
|
+
type CustomerOrderLineItem = {
|
|
71
|
+
id: string;
|
|
72
|
+
orderId: string;
|
|
73
|
+
productId: string | null;
|
|
74
|
+
variantId: string | null;
|
|
75
|
+
title: string;
|
|
76
|
+
subtitle?: string | null;
|
|
77
|
+
thumbnail?: string | null;
|
|
78
|
+
variantTitle?: string | null;
|
|
79
|
+
productHandle?: string | null;
|
|
80
|
+
quantity: number;
|
|
81
|
+
unitPrice: number;
|
|
82
|
+
total: number;
|
|
83
|
+
status: string;
|
|
84
|
+
};
|
|
85
|
+
type CustomerOrderPayment = {
|
|
86
|
+
id: string;
|
|
87
|
+
paymentMethod: string;
|
|
88
|
+
paymentCode: string;
|
|
89
|
+
amount: number;
|
|
90
|
+
paymentStatus: string;
|
|
91
|
+
receiptUrl?: string | null;
|
|
92
|
+
createdOn: string;
|
|
93
|
+
};
|
|
94
|
+
type CustomerOrderStatusTimelineEntry = {
|
|
95
|
+
key: string;
|
|
96
|
+
label: string;
|
|
97
|
+
occurredAt: string;
|
|
98
|
+
description?: string | null;
|
|
99
|
+
status: string;
|
|
100
|
+
source: string;
|
|
101
|
+
};
|
|
102
|
+
type CustomerOrderDetail = {
|
|
103
|
+
id: string;
|
|
104
|
+
orderNumber: string;
|
|
105
|
+
orderGroup: string;
|
|
106
|
+
status: string;
|
|
107
|
+
total: number;
|
|
108
|
+
totalPaid: number;
|
|
109
|
+
currencyCode: string;
|
|
110
|
+
orderDate: string;
|
|
111
|
+
createdOn: string;
|
|
112
|
+
updatedOn?: string | null;
|
|
113
|
+
paymentAt?: string | null;
|
|
114
|
+
subTotal: number;
|
|
115
|
+
discount: number;
|
|
116
|
+
shipping: number;
|
|
117
|
+
tax: number;
|
|
118
|
+
email: string;
|
|
119
|
+
phone: string;
|
|
120
|
+
firstName: string;
|
|
121
|
+
lastName: string;
|
|
122
|
+
shippingAddress?: CustomerOrderShippingAddress | null;
|
|
123
|
+
shippingAddressSummary?: string | null;
|
|
124
|
+
billingAddress?: CustomerOrderShippingAddress | null;
|
|
125
|
+
items: CustomerOrderLineItem[];
|
|
126
|
+
payments: CustomerOrderPayment[];
|
|
127
|
+
statusTimeline: CustomerOrderStatusTimelineEntry[];
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export { type CustomerOrderDetail, type CustomerOrderListItem, STOREFRONT_API_PATH_PREFIX, StorefrontPageDetail, StorefrontSettings, countryCurrency, customerOrderStatusTone, findStorefrontCmsPageBySlug, formatCurrency, formatCustomerOrderStatus, formatOrderDate, formatOrderDateTime, sanitizeHtml, stripHtml };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { StorefrontPageDetailSchema } from '../chunk-ASFU32ZM.js';
|
|
2
|
+
export { StorefrontCollectionDetailSchema, StorefrontCollectionSchema, StorefrontCollectionsResponseSchema, StorefrontPageDetailSchema, StorefrontPageListItemSchema, StorefrontProductDetailSchema, StorefrontProductSchema, StorefrontProductsParamsSchema, StorefrontProductsResponseSchema } from '../chunk-ASFU32ZM.js';
|
|
3
|
+
export { StorefrontSettingsSchema, StorefrontStoreSchema } from '../chunk-EADDSNJS.js';
|
|
4
|
+
export { STOREFRONT_API_PATH_PREFIX } from '../chunk-S7CPZ4UE.js';
|
|
5
|
+
|
|
6
|
+
// src/core/constants/currency.ts
|
|
7
|
+
var countryCurrency = {
|
|
8
|
+
"PEN": "es-PE",
|
|
9
|
+
"USD": "en-US",
|
|
10
|
+
"COP": "es-CO",
|
|
11
|
+
"MXN": "es-MX"
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// src/core/utils/format-currency.ts
|
|
15
|
+
function formatCurrency(amount, currency = "USD") {
|
|
16
|
+
const locale = countryCurrency[currency] ?? "en-US";
|
|
17
|
+
return new Intl.NumberFormat(locale, {
|
|
18
|
+
style: "currency",
|
|
19
|
+
currency
|
|
20
|
+
}).format(amount);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/core/utils/cms-html.ts
|
|
24
|
+
function sanitizeHtml(html) {
|
|
25
|
+
return html.replace(/<script[\s\S]*?>[\s\S]*?<\/script>/gi, "").replace(/<style[\s\S]*?>[\s\S]*?<\/style>/gi, "").replace(/<(iframe|object|embed|link|meta)[\s\S]*?>/gi, "").replace(/\son\w+\s*=\s*(['"]).*?\1/gi, "").replace(/\s(href|src)\s*=\s*(['"])\s*javascript:[\s\S]*?\2/gi, "");
|
|
26
|
+
}
|
|
27
|
+
function stripHtml(html) {
|
|
28
|
+
return html.replace(/<br\s*\/?>/gi, " ").replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// src/core/lib/customer-order-labels.ts
|
|
32
|
+
var ORDER_STATUS_LABELS = {
|
|
33
|
+
New: "Pedido realizado",
|
|
34
|
+
Confirmed: "Confirmado",
|
|
35
|
+
Processing: "En preparaci\xF3n",
|
|
36
|
+
InTransit: "En camino",
|
|
37
|
+
Delivered: "Entregado",
|
|
38
|
+
Cancelled: "Cancelado",
|
|
39
|
+
Canceled: "Cancelado",
|
|
40
|
+
Refunded: "Reembolsado",
|
|
41
|
+
Pending: "Pendiente",
|
|
42
|
+
Paid: "Pagado",
|
|
43
|
+
Captured: "Pago confirmado"
|
|
44
|
+
};
|
|
45
|
+
function formatCustomerOrderStatus(status) {
|
|
46
|
+
const trimmed = status.trim();
|
|
47
|
+
if (!trimmed) return "Desconocido";
|
|
48
|
+
return ORDER_STATUS_LABELS[trimmed] ?? trimmed.replace(/([A-Z])/g, " $1").trim();
|
|
49
|
+
}
|
|
50
|
+
function customerOrderStatusTone(status) {
|
|
51
|
+
const s = status.toLowerCase();
|
|
52
|
+
if (s.includes("cancel") || s.includes("refund")) return "danger";
|
|
53
|
+
if (s.includes("deliver")) return "success";
|
|
54
|
+
if (s.includes("transit") || s.includes("ship")) return "info";
|
|
55
|
+
if (s.includes("confirm") || s.includes("paid") || s.includes("capture")) return "success";
|
|
56
|
+
if (s.includes("pending") || s.includes("new") || s.includes("process")) return "warning";
|
|
57
|
+
return "default";
|
|
58
|
+
}
|
|
59
|
+
function formatOrderDate(iso, locale = "es-PE") {
|
|
60
|
+
const d = new Date(iso);
|
|
61
|
+
if (Number.isNaN(d.getTime())) return iso;
|
|
62
|
+
return new Intl.DateTimeFormat(locale, {
|
|
63
|
+
day: "numeric",
|
|
64
|
+
month: "long",
|
|
65
|
+
year: "numeric"
|
|
66
|
+
}).format(d);
|
|
67
|
+
}
|
|
68
|
+
function formatOrderDateTime(iso, locale = "es-PE") {
|
|
69
|
+
const d = new Date(iso);
|
|
70
|
+
if (Number.isNaN(d.getTime())) return iso;
|
|
71
|
+
return new Intl.DateTimeFormat(locale, {
|
|
72
|
+
day: "numeric",
|
|
73
|
+
month: "short",
|
|
74
|
+
year: "numeric",
|
|
75
|
+
hour: "2-digit",
|
|
76
|
+
minute: "2-digit"
|
|
77
|
+
}).format(d);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// src/react/shell/lib/find-storefront-cms-page.ts
|
|
81
|
+
function isRenderableCmsPage(p) {
|
|
82
|
+
if (!p.status) return true;
|
|
83
|
+
return p.status === "published";
|
|
84
|
+
}
|
|
85
|
+
function findStorefrontCmsPageBySlug(settings, slug) {
|
|
86
|
+
const pages = settings?.cms?.pages;
|
|
87
|
+
if (!pages?.length) return null;
|
|
88
|
+
const raw = pages.find(
|
|
89
|
+
(p) => p.slug === slug && isRenderableCmsPage(p)
|
|
90
|
+
);
|
|
91
|
+
if (!raw) return null;
|
|
92
|
+
const parsed = StorefrontPageDetailSchema.safeParse(raw);
|
|
93
|
+
return parsed.success ? parsed.data : null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export { countryCurrency, customerOrderStatusTone, findStorefrontCmsPageBySlug, formatCurrency, formatCustomerOrderStatus, formatOrderDate, formatOrderDateTime, sanitizeHtml, stripHtml };
|
|
97
|
+
//# sourceMappingURL=core-public.js.map
|
|
98
|
+
//# sourceMappingURL=core-public.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/constants/currency.ts","../../src/core/utils/format-currency.ts","../../src/core/utils/cms-html.ts","../../src/core/lib/customer-order-labels.ts","../../src/react/shell/lib/find-storefront-cms-page.ts"],"names":[],"mappings":"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","file":"core-public.js","sourcesContent":["export const countryCurrency = {\n \"PEN\": \"es-PE\",\n \"USD\": \"en-US\",\n \"COP\": \"es-CO\",\n \"MXN\": \"es-MX\",\n}\n","import { countryCurrency } from \"../constants/currency\";\n\n/**\n * Formats a number as currency using the store's locale for the given currency code.\n * Uses countryCurrency to pick the right locale (e.g. PEN → es-PE, USD → en-US).\n */\nexport function formatCurrency(\n amount: number,\n currency: string = \"USD\"\n): string {\n const locale =\n countryCurrency[currency as keyof typeof countryCurrency] ?? \"en-US\";\n return new Intl.NumberFormat(locale, {\n style: \"currency\",\n currency,\n }).format(amount);\n}\n","/** Sanitización mínima de HTML (script, event handlers, javascript:…). */\nexport function sanitizeHtml(html: string) {\n return html\n .replace(/<script[\\s\\S]*?>[\\s\\S]*?<\\/script>/gi, \"\")\n .replace(/<style[\\s\\S]*?>[\\s\\S]*?<\\/style>/gi, \"\")\n .replace(/<(iframe|object|embed|link|meta)[\\s\\S]*?>/gi, \"\")\n .replace(/\\son\\w+\\s*=\\s*(['\"]).*?\\1/gi, \"\")\n .replace(/\\s(href|src)\\s*=\\s*(['\"])\\s*javascript:[\\s\\S]*?\\2/gi, \"\");\n}\n\n/** Convierte HTML en texto plano (metadata, JSON-LD). */\nexport function stripHtml(html: string) {\n return html\n .replace(/<br\\s*\\/?>/gi, \" \")\n .replace(/<[^>]+>/g, \" \")\n .replace(/\\s+/g, \" \")\n .trim();\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 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 ORDER_STATUS_LABELS[trimmed] ?? trimmed.replace(/([A-Z])/g, \" $1\").trim();\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\")) return \"success\";\n if (s.includes(\"pending\") || s.includes(\"new\") || s.includes(\"process\")) 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","import type { StorefrontSettings } from \"../../../core/models/store\";\nimport type { StorefrontPageDetail } from \"../../../core/models/page\";\nimport { StorefrontPageDetailSchema } from \"../../../core/models/page\";\n\nfunction isRenderableCmsPage(p: { status?: string }): boolean {\n if (!p.status) return true;\n return p.status === \"published\";\n}\n\n/**\n * Busca una página CMS en `settings.cms.pages` (payload de `getPublicStore` / settings)\n * y la valida como `StorefrontPageDetail` para `DynamicPage`.\n */\nexport function findStorefrontCmsPageBySlug(\n settings: StorefrontSettings | null | undefined,\n slug: string\n): StorefrontPageDetail | null {\n const pages = settings?.cms?.pages;\n if (!pages?.length) return null;\n const raw = pages.find(\n (p) => p.slug === slug && isRenderableCmsPage(p as { status?: string })\n );\n if (!raw) return null;\n const parsed = StorefrontPageDetailSchema.safeParse(raw);\n return parsed.success ? parsed.data : null;\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { P as PublicStoreSettingsSource, a as PublicStoreResult, F as FetchPublicStoreSettingsOptions } from '../
|
|
2
|
-
export {
|
|
1
|
+
import { P as PublicStoreSettingsSource, a as PublicStoreResult, F as FetchPublicStoreSettingsOptions } from '../ecomiq-oauth-password-plugin-DJCOOij3.js';
|
|
2
|
+
export { a4 as CustomerAddress, _ as CustomerAddressSchema, a5 as CustomerAddressUpsert, $ as CustomerAddressUpsertSchema, a6 as CustomerMe, a0 as CustomerMeSchema, ad as CustomerOrderDetail, ad as CustomerOrderDetailDto, ab as CustomerOrderDetailSchema, ac as CustomerOrderListItem, ac as CustomerOrderListItemDto, aa as CustomerOrderListItemSchema, a7 as CustomerProfilePatch, a1 as CustomerProfilePatchSchema, a3 as CustomerRegisterRequest, T as CustomerRegisterRequestSchema, E as ECOMIQ_CLIENTS_STORE_KV_BINDING, S as StoreApiClient, l as StoreApiGetOptions, K as addCartCoupon, b as applyServerRequestOriginFromHeaders, p as buildStorefrontKvSnapshotKey, q as buildStorefrontKvSnapshotKeyFromStoreKey, N as checkoutCart, M as createCart, V as createCustomerAddress, k as createStoreApiClient, a2 as customerMeToProfilePatch, X as deleteCustomerAddress, e as ecomiqOAuthPassword, f as fetchPublicStoreSettings, G as getCart, H as getCartCheckout, Q as getCartPaymentMethods, U as getCustomerAddresses, Y as getCustomerMe, a9 as getCustomerOrder, a8 as getCustomerOrders, ae as getSharedOrderDraft, I as getShippingOptions, h as getStoreApiBaseUrl, j as getStoreApiClient, y as getStorefrontCollectionBySlug, x as getStorefrontCollections, A as getStorefrontPageBySlug, B as getStorefrontPagePreview, z as getStorefrontPages, w as getStorefrontProductBySlug, v as getStorefrontProducts, m as getStorefrontSettings, n as getStorefrontSettingsFromKv, o as getStorefrontSettingsFromKvByStoreKey, i as isCartNotActiveApiError, t as normalizeStoreHost, D as patchCartAddresses, C as patchCartBuyer, Z as patchCustomer, J as putCartShippingMethod, R as registerCustomer, L as removeCartCoupon, r as resolvePublicStoreSettingsSource, u as resolveStorefrontSettingsHost, g as setClientStoreId, c as setServerRequestOrigin, d as setServerStoreId, s as storeApiClient, W as updateCustomerAddress, O as uploadPaymentReceipt } from '../ecomiq-oauth-password-plugin-DJCOOij3.js';
|
|
3
3
|
export { S as StoreProxyHandlerConfig, h as handleStoreProxyRequest } from '../store-proxy-handler-CNzKlTFA.js';
|
|
4
|
+
import '../collection-BHD4hhQa.js';
|
|
4
5
|
import 'zod';
|
|
5
6
|
import 'better-auth';
|
|
6
7
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { applyServerRequestOriginFromHeaders, normalizeRequestHostname, fetchPublicStoreSettings } from '../chunk-
|
|
2
|
-
export { CustomerAddressSchema, CustomerAddressUpsertSchema, CustomerMeSchema, CustomerOrderDetailSchema, CustomerOrderListItemSchema, CustomerProfilePatchSchema, CustomerRegisterRequestSchema, StoreApiClient,
|
|
3
|
-
export { ECOMIQ_CLIENTS_STORE_KV_BINDING,
|
|
4
|
-
|
|
1
|
+
import { applyServerRequestOriginFromHeaders, normalizeRequestHostname, fetchPublicStoreSettings } from '../chunk-3C4ZLHSU.js';
|
|
2
|
+
export { CustomerAddressSchema, CustomerAddressUpsertSchema, CustomerMeSchema, CustomerOrderDetailSchema, CustomerOrderListItemSchema, CustomerProfilePatchSchema, CustomerRegisterRequestSchema, StoreApiClient, addCartCoupon, applyServerRequestOriginFromHeaders, checkoutCart, createCart, createCustomerAddress, createStoreApiClient, customerMeToProfilePatch, deleteCustomerAddress, ecomiqOAuthPassword, fetchPublicStoreSettings, getCart, getCartCheckout, getCartPaymentMethods, getCustomerAddresses, getCustomerMe, getCustomerOrder, getCustomerOrders, getSharedOrderDraft, getShippingOptions, getStoreApiBaseUrl, getStoreApiClient, getStorefrontCollectionBySlug, getStorefrontCollections, getStorefrontPageBySlug, getStorefrontPagePreview, getStorefrontPages, getStorefrontProductBySlug, getStorefrontProducts, getStorefrontSettings, isCartNotActiveApiError, patchCartAddresses, patchCartBuyer, patchCustomer, putCartShippingMethod, registerCustomer, removeCartCoupon, resolvePublicStoreSettingsSource, setClientStoreId, setServerRequestOrigin, setServerStoreId, storeApiClient, updateCustomerAddress, uploadPaymentReceipt } from '../chunk-3C4ZLHSU.js';
|
|
3
|
+
export { ECOMIQ_CLIENTS_STORE_KV_BINDING, buildStorefrontKvSnapshotKey, buildStorefrontKvSnapshotKeyFromStoreKey, getStorefrontSettingsFromKv, getStorefrontSettingsFromKvByStoreKey, normalizeStoreHost, resolveStorefrontSettingsHost } from '../chunk-W372BFMG.js';
|
|
4
|
+
import '../chunk-ASFU32ZM.js';
|
|
5
|
+
import '../chunk-EADDSNJS.js';
|
|
6
|
+
export { handleStoreProxyRequest } from '../chunk-3URTJY6X.js';
|
|
7
|
+
import '../chunk-S7CPZ4UE.js';
|
|
5
8
|
import { headers } from 'next/headers';
|
|
6
9
|
|
|
7
10
|
async function getHostname() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/react/frameworks/nextjs/actions/getHostName.ts","../../src/react/frameworks/nextjs/actions/getPublicStore.ts"],"names":["headers"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/react/frameworks/nextjs/actions/getHostName.ts","../../src/react/frameworks/nextjs/actions/getPublicStore.ts"],"names":["headers"],"mappings":";;;;;;;;;AAWA,eAAsB,WAAA,GAAsC;AAC1D,EAAA,MAAM,UAAA,GAAa,MAAM,OAAA,EAAQ;AACjC,EAAA,mCAAA,CAAoC,UAAU,CAAA;AAC9C,EAAA,OAAO,yBAAyB,UAAU,CAAA;AAC5C;ACaA,eAAsB,eACpB,OAAA,EAC4B;AAC5B,EAAA,MAAM,UAAA,GAAa,MAAMA,OAAAA,EAAQ;AACjC,EAAA,mCAAA,CAAoC,UAAU,CAAA;AAC9C,EAAA,OAAO,wBAAA,CAAyB;AAAA,IAC9B,IAAA,EAAM,UAAA,CAAW,GAAA,CAAI,MAAM,CAAA;AAAA,IAC3B,QAAQ,OAAA,EAAS;AAAA,GAClB,CAAA;AACH;AAKA,eAAsB,yBAAA,CACpB,YACA,OAAA,EAC4B;AAC5B,EAAA,mCAAA,CAAoC,UAAU,CAAA;AAC9C,EAAA,OAAO,wBAAA,CAAyB;AAAA,IAC9B,IAAA,EAAM,UAAA,CAAW,GAAA,CAAI,MAAM,CAAA;AAAA,IAC3B,GAAG;AAAA,GACJ,CAAA;AACH","file":"server-nextjs.js","sourcesContent":["\"use server\";\n\nimport { headers } from \"next/headers\";\nimport {\n applyServerRequestOriginFromHeaders,\n normalizeRequestHostname,\n} from \"../../../../core/server/request-origin\";\n\n/**\n * Devuelve el host completo de la request (ej. \"plata950.ecomiq.pe\", \"localhost:3000\").\n */\nexport async function getHostname(): Promise<string | null> {\n const headerList = await headers();\n applyServerRequestOriginFromHeaders(headerList);\n return normalizeRequestHostname(headerList);\n}\n","\"use server\";\n\nimport { headers } from \"next/headers\";\nimport {\n applyServerRequestOriginFromHeaders,\n} from \"../../../../core/server/request-origin\";\nimport {\n fetchPublicStoreSettings,\n type FetchPublicStoreSettingsOptions,\n type PublicStoreResult,\n type PublicStoreSettingsSource,\n} from \"../../../../core/server/fetch-public-store\";\n\ntype GetPublicStoreOptions = {\n /** Si se omite, se usa `resolvePublicStoreSettingsSource()` (variable de entorno). */\n source?: PublicStoreSettingsSource;\n};\n\nexport type { PublicStoreResult, PublicStoreSettingsSource };\n\n/**\n * Obtiene la tienda pública (Next.js App Router).\n * Usa `headers()` para resolver host y origen del proxy.\n *\n * Identificador de tienda:\n * 1. `slugStore` en `ecomiq.config.js` (prioridad en localhost).\n * 2. Si no, deriva del header `Host`.\n */\nexport async function getPublicStore(\n options?: GetPublicStoreOptions,\n): Promise<PublicStoreResult> {\n const headerList = await headers();\n applyServerRequestOriginFromHeaders(headerList);\n return fetchPublicStoreSettings({\n host: headerList.get(\"host\"),\n source: options?.source,\n });\n}\n\n/**\n * Igual que `getPublicStore` pero con headers explícitos (tests, middleware custom).\n */\nexport async function getPublicStoreFromHeaders(\n headerList: { get(name: string): string | null },\n options?: Omit<FetchPublicStoreSettingsOptions, \"host\">,\n): Promise<PublicStoreResult> {\n applyServerRequestOriginFromHeaders(headerList);\n return fetchPublicStoreSettings({\n host: headerList.get(\"host\"),\n ...options,\n });\n}\n\nexport {\n fetchPublicStoreSettings,\n resolvePublicStoreSettingsSource,\n} from \"../../../../core/server/fetch-public-store\";\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { P as PublicStoreSettingsSource, a as PublicStoreResult, F as FetchPublicStoreSettingsOptions } from '../
|
|
2
|
-
export {
|
|
1
|
+
import { P as PublicStoreSettingsSource, a as PublicStoreResult, F as FetchPublicStoreSettingsOptions } from '../ecomiq-oauth-password-plugin-DJCOOij3.js';
|
|
2
|
+
export { a4 as CustomerAddress, _ as CustomerAddressSchema, a5 as CustomerAddressUpsert, $ as CustomerAddressUpsertSchema, a6 as CustomerMe, a0 as CustomerMeSchema, ad as CustomerOrderDetail, ad as CustomerOrderDetailDto, ab as CustomerOrderDetailSchema, ac as CustomerOrderListItem, ac as CustomerOrderListItemDto, aa as CustomerOrderListItemSchema, a7 as CustomerProfilePatch, a1 as CustomerProfilePatchSchema, a3 as CustomerRegisterRequest, T as CustomerRegisterRequestSchema, E as ECOMIQ_CLIENTS_STORE_KV_BINDING, S as StoreApiClient, l as StoreApiGetOptions, K as addCartCoupon, b as applyServerRequestOriginFromHeaders, p as buildStorefrontKvSnapshotKey, q as buildStorefrontKvSnapshotKeyFromStoreKey, N as checkoutCart, M as createCart, V as createCustomerAddress, k as createStoreApiClient, a2 as customerMeToProfilePatch, X as deleteCustomerAddress, e as ecomiqOAuthPassword, f as fetchPublicStoreSettings, G as getCart, H as getCartCheckout, Q as getCartPaymentMethods, U as getCustomerAddresses, Y as getCustomerMe, a9 as getCustomerOrder, a8 as getCustomerOrders, ae as getSharedOrderDraft, I as getShippingOptions, h as getStoreApiBaseUrl, j as getStoreApiClient, y as getStorefrontCollectionBySlug, x as getStorefrontCollections, A as getStorefrontPageBySlug, B as getStorefrontPagePreview, z as getStorefrontPages, w as getStorefrontProductBySlug, v as getStorefrontProducts, m as getStorefrontSettings, n as getStorefrontSettingsFromKv, o as getStorefrontSettingsFromKvByStoreKey, i as isCartNotActiveApiError, t as normalizeStoreHost, D as patchCartAddresses, C as patchCartBuyer, Z as patchCustomer, J as putCartShippingMethod, R as registerCustomer, L as removeCartCoupon, r as resolvePublicStoreSettingsSource, u as resolveStorefrontSettingsHost, g as setClientStoreId, c as setServerRequestOrigin, d as setServerStoreId, s as storeApiClient, W as updateCustomerAddress, O as uploadPaymentReceipt } from '../ecomiq-oauth-password-plugin-DJCOOij3.js';
|
|
3
3
|
export { S as StoreProxyHandlerConfig, h as handleStoreProxyRequest } from '../store-proxy-handler-CNzKlTFA.js';
|
|
4
|
+
import '../collection-BHD4hhQa.js';
|
|
4
5
|
import 'zod';
|
|
5
6
|
import 'better-auth';
|
|
6
7
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { applyServerRequestOriginFromHeaders, normalizeRequestHostname, fetchPublicStoreSettings } from '../chunk-
|
|
2
|
-
export { CustomerAddressSchema, CustomerAddressUpsertSchema, CustomerMeSchema, CustomerOrderDetailSchema, CustomerOrderListItemSchema, CustomerProfilePatchSchema, CustomerRegisterRequestSchema, StoreApiClient,
|
|
3
|
-
export { ECOMIQ_CLIENTS_STORE_KV_BINDING,
|
|
4
|
-
|
|
1
|
+
import { applyServerRequestOriginFromHeaders, normalizeRequestHostname, fetchPublicStoreSettings } from '../chunk-3C4ZLHSU.js';
|
|
2
|
+
export { CustomerAddressSchema, CustomerAddressUpsertSchema, CustomerMeSchema, CustomerOrderDetailSchema, CustomerOrderListItemSchema, CustomerProfilePatchSchema, CustomerRegisterRequestSchema, StoreApiClient, addCartCoupon, applyServerRequestOriginFromHeaders, checkoutCart, createCart, createCustomerAddress, createStoreApiClient, customerMeToProfilePatch, deleteCustomerAddress, ecomiqOAuthPassword, fetchPublicStoreSettings, getCart, getCartCheckout, getCartPaymentMethods, getCustomerAddresses, getCustomerMe, getCustomerOrder, getCustomerOrders, getSharedOrderDraft, getShippingOptions, getStoreApiBaseUrl, getStoreApiClient, getStorefrontCollectionBySlug, getStorefrontCollections, getStorefrontPageBySlug, getStorefrontPagePreview, getStorefrontPages, getStorefrontProductBySlug, getStorefrontProducts, getStorefrontSettings, isCartNotActiveApiError, patchCartAddresses, patchCartBuyer, patchCustomer, putCartShippingMethod, registerCustomer, removeCartCoupon, resolvePublicStoreSettingsSource, setClientStoreId, setServerRequestOrigin, setServerStoreId, storeApiClient, updateCustomerAddress, uploadPaymentReceipt } from '../chunk-3C4ZLHSU.js';
|
|
3
|
+
export { ECOMIQ_CLIENTS_STORE_KV_BINDING, buildStorefrontKvSnapshotKey, buildStorefrontKvSnapshotKeyFromStoreKey, getStorefrontSettingsFromKv, getStorefrontSettingsFromKvByStoreKey, normalizeStoreHost, resolveStorefrontSettingsHost } from '../chunk-W372BFMG.js';
|
|
4
|
+
import '../chunk-ASFU32ZM.js';
|
|
5
|
+
import '../chunk-EADDSNJS.js';
|
|
6
|
+
export { handleStoreProxyRequest } from '../chunk-3URTJY6X.js';
|
|
7
|
+
import '../chunk-S7CPZ4UE.js';
|
|
5
8
|
import { getRequestHeaders } from '@tanstack/react-start/server';
|
|
6
9
|
|
|
7
10
|
async function getHostname() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/react/frameworks/tanstack/actions/getHostname.ts","../../src/react/frameworks/tanstack/actions/getPublicStore.ts"],"names":["getRequestHeaders"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/react/frameworks/tanstack/actions/getHostname.ts","../../src/react/frameworks/tanstack/actions/getPublicStore.ts"],"names":["getRequestHeaders"],"mappings":";;;;;;;;;AAMA,eAAsB,WAAA,GAAsC;AAC1D,EAAA,MAAM,aAAa,iBAAA,EAAkB;AACrC,EAAA,mCAAA,CAAoC,UAAU,CAAA;AAC9C,EAAA,OAAO,yBAAyB,UAAU,CAAA;AAC5C;ACWA,eAAsB,eACpB,OAAA,EAC4B;AAC5B,EAAA,MAAM,aAAaA,iBAAAA,EAAkB;AACrC,EAAA,mCAAA,CAAoC,UAAU,CAAA;AAC9C,EAAA,OAAO,wBAAA,CAAyB;AAAA,IAC9B,IAAA,EAAM,UAAA,CAAW,GAAA,CAAI,MAAM,CAAA;AAAA,IAC3B,QAAQ,OAAA,EAAS;AAAA,GAClB,CAAA;AACH;AAEA,eAAsB,yBAAA,CACpB,YACA,OAAA,EAC4B;AAC5B,EAAA,mCAAA,CAAoC,UAAU,CAAA;AAC9C,EAAA,OAAO,wBAAA,CAAyB;AAAA,IAC9B,IAAA,EAAM,UAAA,CAAW,GAAA,CAAI,MAAM,CAAA;AAAA,IAC3B,GAAG;AAAA,GACJ,CAAA;AACH","file":"server-tanstack.js","sourcesContent":["import { getRequestHeaders } from \"@tanstack/react-start/server\";\nimport {\n applyServerRequestOriginFromHeaders,\n normalizeRequestHostname,\n} from \"../../../../core/server/request-origin\";\n\nexport async function getHostname(): Promise<string | null> {\n const headerList = getRequestHeaders();\n applyServerRequestOriginFromHeaders(headerList);\n return normalizeRequestHostname(headerList);\n}\n","import { getRequestHeaders } from \"@tanstack/react-start/server\";\nimport {\n applyServerRequestOriginFromHeaders,\n} from \"../../../../core/server/request-origin\";\nimport {\n fetchPublicStoreSettings,\n type FetchPublicStoreSettingsOptions,\n type PublicStoreResult,\n type PublicStoreSettingsSource,\n} from \"../../../../core/server/fetch-public-store\";\n\ntype GetPublicStoreOptions = {\n source?: PublicStoreSettingsSource;\n};\n\nexport type { PublicStoreResult, PublicStoreSettingsSource };\n\n/**\n * Obtiene la tienda pública en TanStack Start (server function, loader o server route).\n * Usa `getRequestHeaders()` del contexto de request activo.\n */\nexport async function getPublicStore(\n options?: GetPublicStoreOptions,\n): Promise<PublicStoreResult> {\n const headerList = getRequestHeaders();\n applyServerRequestOriginFromHeaders(headerList);\n return fetchPublicStoreSettings({\n host: headerList.get(\"host\"),\n source: options?.source,\n });\n}\n\nexport async function getPublicStoreFromHeaders(\n headerList: { get(name: string): string | null },\n options?: Omit<FetchPublicStoreSettingsOptions, \"host\">,\n): Promise<PublicStoreResult> {\n applyServerRequestOriginFromHeaders(headerList);\n return fetchPublicStoreSettings({\n host: headerList.get(\"host\"),\n ...options,\n });\n}\n\nexport {\n fetchPublicStoreSettings,\n resolvePublicStoreSettingsSource,\n} from \"../../../../core/server/fetch-public-store\";\n"]}
|